Click here to Skip to main content
15,074,483 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
config.php file

require_once 'messages.php';

//site specific configuration declartion
define( 'BASE_PATH', 'http://localhost/user_login/');
define( 'DB_HOST', 'localhost' );
define( 'DB_USERNAME', 'root');
define( 'DB_PASSWORD', 'ricky');
define( 'DB_NAME', 'user_login');

function __autoload($class)
    $parts = explode('_', $class);
    $path = implode(DIRECTORY_SEPARATOR,$parts);
    require_once $path . '.php';

function.php file

    class users
        protected $_con;

        public function __construct()
            $db=new DataBase();

        public function insert(array $data)

                $sql="insert into users(username,password,email,name) values(NULL,'$username','$password','$email','$name')";
                if(mysqli_query($this->_con,$sql)) return TRUE;

                throw new Exception(USER_REGISTRATION_FAIL);

message.php file

define('FIELDS_MISSING', 'Some Fields Are Missing');
define('PASSWORD_NOT_MATCH', 'Passwords do not match');
define('USER_REGISTRATION_FAIL', 'User registration failed');
define('USER_REGISTRATION_SUCCESS', 'User registration was successful, You may login now');

define('LOGIN_FIELDS_MISSING', 'Email and Password are missing');
define('LOGIN_FAIL', 'Email and Password are mismatch');

define('PASSOWRD_CHANAGE_SUCCESS', 'Password changed successfully.');

registration.php file

     require_once 'config.php';
        try {
            $user_obj = new users();
            $data = $user_obj->insert( $_POST );
            if($data)$success = USER_REGISTRATION_SUCCESS;
        } catch (Exception $e) {
            $error = $e->getMessage();

<!doctype html>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name='reg' >
Full Name
<input type="text" name="username"/>
<input type="password" name="password"/>
<input type="text" name="name"/>
<input type="text" name="email"/>
<input type="submit" name="submit" value="Register"/>

when I run my registration page it show blank with require_once.But when I move the require once then it show me the form.Please suggest
Rakesh 00 2-Feb-15 14:20pm
Is anyone there to help?????????????????????????
ZurdoDev 2-Feb-15 15:08pm
1. Please be patient. This is a volunteer site.
2. I don't do PHP but if it works by removing that then why do you need it and if you do need it then there is likely an error in it since it won't work when you do include it.
ZurdoDev 2-Feb-15 15:08pm
And do not repost.
Mohibur Rashid 3-Feb-15 1:44am
You did not include message.php anywhere. But you are trying to use the defined macros.
Your error_reporting is turned off. That is why, when there is a error your page will turn blank.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900