Registration Page

Results 1 to 6 of 6
  1. #1
    Member brunno951 is offline
    MemberRank
    Aug 2010 Join Date
    73Posts

    happy Registration Page

    Anyone here has a link for a registration page for PW that i can download? thanks


  2. #2
    Black Magic Development das7002 is offline
    MemberRank
    Apr 2010 Join Date
    EarthLocation
    2,188Posts

    Re: Registration Page

    PHP Code:
    <?php if($_POST){
    if{
    $_POST['pass'] !== $_POST['pass2']) die("Passwords don't match");
    $db mysql_connect('user''pass''host') or die("MySQL connection failed");
    if(!
    $db){
    die(
    "MySQL resource null, connection failed");
    } else {
    $u $_POST['uname'];$s "0x".md5($u.$_POST['pass']);$e $_POST['eml'];
    mysql_query("call adduser '$u',$s,'0','0','0','0','$e','0','0','0','0','0','0','0','','0',$s";);
    die(
    "User registered!");
    }
    }
    <
    body>
    <
    form action="" method="post">
    Username<input type="text" name="uname">
    Password<input type="password" name="pass">
    Password repeat<input type="password" name="pass2">
    Email(not required)<input type="text" name="eml">
    <
    input type="submit" value="Register">
    </
    form>
    </
    body>
    Tada, just came up with that on the spot, probably isn't one I'd use but it'll do the job...

  3. #3
    Account Upgraded | Title Enabled! xAtticusx is offline
    MemberRank
    May 2010 Join Date
    EnglandLocation
    388Posts

    Re: Registration Page

    PHP Code:
    <?
        
    include "config.php"//Path to your config file
            
        
    if (isset($_POST['login']))
            {
                
    $Link MySQL_Connect($DBHost$DBUser$DBPassword) or die ();
                
    MySQL_Select_Db($DBName$Link) or die ("Database ".$DBName." does not exists."); //Connect to the database, or "die" and give the error message
                
                
    $Login $_POST['login'];
                
    $realname $_POST['realname'];
                
    $Pass $_POST['passwd'];
                
    $Repass $_POST['repasswd'];
                
    $Email $_POST['email'];
                
                
    $Login StrToLower(Trim($Login));
                
    $realname Trim($realname);
                
    $Pass StrToLower(Trim($Pass));
                
    $Repass StrToLower(Trim($Repass));
                
    $Email Trim($Email); //All of the above processes the form data, then strips it down.
        
            
    if (empty($Login) || empty($Pass) || empty($Repass) || empty($Email) || empty($realname)) //Checks if any of the fields were left empty
                
    {
                    echo 
    "<br /><font color='red'>Please complete all fields.</font><br />";
                }
            
            
            elseif (
    ereg("[^0-9a-zA-Z_-]"$Login$Txt)) //Checks to see if any of the characters entered in the login field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Username contains illegal characters.</font><br />";
                }
            elseif (
    StrPos('\''$realname)) //Checks to see if any of the characters entered in the real name field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Real Name contains illegal characters.</font><br />";
                }            
            elseif (
    ereg("[^0-9a-zA-Z_-]"$Pass$Txt)) //Checks to see if any of the characters entered in the password field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Password contains illegal characters.</font><br />";    
                }
            
            elseif (
    ereg("[^0-9a-zA-Z_-]"$Repass$Txt)) //Checks to see if any of the characters entered in the repeat password field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Password contains illegal characters.</font><br />";    
                }
            elseif (
    StrPos('\''$Email)) //Checks to see if any of the characters entered in the email field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Email contains illegal characters.</font><br />";    
                }    
            else
                {
                    
    $Result MySQL_Query("SELECT name FROM users WHERE name='$Login'") or ("Can't execute username check."); //Checks if the username was already registered.
                    
            
    if (MySQL_Num_Rows($Result))
                {
                    echo 
    "<br /><font color='red'>Username <b>".$Login."</b> has already been registered.</font><br />";
                }
            elseif ((
    StrLen($Login) < 4) or (StrLen($Login) > 10)) //Limits the amount of characters in the username field.
            
                
    {
                    echo 
    "<br /><font color='red'>Username is too short. Must be between 4 and 10 characters.</font><br />";
                }
            elseif ((
    StrLen($realname) < 4) or (StrLen($realname) > 30)) //Limits the amount of characters in the realname field.
            
                
    {
                    echo 
    "<br /><font color='red'>Real Name is too short. Must be between 4 and 30 characters.</font><br />";
                }
            elseif ((
    StrLen($Pass) < 4) or (StrLen($Pass) > 10)) //Limits the amount of characters in the password field.
            
                
    {
                    echo 
    "<br /><font color='red'>Password is too short. Must be between 4 and 10 characters.</font><br />";
                }
                
            elseif ((
    StrLen($Repass) < 4) or (StrLen($Repass) > 10)) //Limits the amount of characters in the repeat password field.
                
    {
                    echo 
    "<br /><font color='red'>Password is too short. Must be between 4 and 10 characters.</font><br />";
                }
                
            elseif ((
    StrLen($Email) < 4) or (StrLen($Email) > 25)) //Limits the amount of characters in the email field.
                
    {
                    echo 
    "<br /><font color='red'>Email is too short. Must be between 4 and 25 characters.</font><br />";
                }
            
            elseif (
    $Pass != $Repass//Checks to see if the password and repeat password fields match.
                
    {
                    echo 
    "<br /><font color='red'>Passwords do not match.</font><br />";
                }        
            else
                {
                    
    $Salt $Login.$Pass;
                    
    $Salt md5($Salt);
                    
    $Salt "0x".$Salt//Encrypts the password
                    
    MySQL_Query("call adduser('$Login', $Salt, '0', '0', '$realname', '0', '$Email', '0', '0', '0', '0', '0', '0', '0', '', '0', $Salt)") or die ("Can't execute query."); //Enters the information into the database
                    
    echo "<br /><font color='Green'>Username <b>".$Login."</b> created successfully!</font><br />";
                }        
            }    
        }

        
    ?>
    <form action="register.php" method="post">
            <label for="username">Username </label> <input id="username" name="login" size="50" type="text" />
            <label for="password">Password </label> <input id="password" name="passwd" size="50" type="password" />
            <label for="rpassword">Repeat Password </label> <input id="rpassword" name="repasswd" size="50" type="password" />
            <label for="realname">Real Name </label> <input id="realname" name="realname" size="50" type="text" />
            <label for="email">Email </label> <input id="email" name="email" size="50" type="text" />
            <input type="submit" name="login" value="Register" />

    </form>
    Then the config.php file:

    PHP Code:
    <? 

        $DBHost 
    "";  // mySQL IP (usually localhost or 127.0.0.1)
        
    $DBUser "";  // mySQL username
        
    $DBPassword "";  // mySQL password
        
    $DBName ""//Database name
        
    ?>
    I commented it all for you, to make it easier to edit.
    Last edited by xAtticusx; 12-01-11 at 11:49 AM.

  4. #4
    Member brunno951 is offline
    MemberRank
    Aug 2010 Join Date
    73Posts

    Re: Registration Page

    Quote Originally Posted by das7002 View Post
    PHP Code:
    <?php if($_POST){
    if{
    $_POST['pass'] !== $_POST['pass2']) die("Passwords don't match");
    $db mysql_connect('user''pass''host') or die("MySQL connection failed");
    if(!
    $db){
    die(
    "MySQL resource null, connection failed");
    } else {
    $u $_POST['uname'];$s "0x".md5($u.$_POST['pass']);$e $_POST['eml'];
    mysql_query("call adduser '$u',$s,'0','0','0','0','$e','0','0','0','0','0','0','0','','0',$s";);
    die(
    "User registered!");
    }
    }
    <
    body>
    <
    form action="" method="post">
    Username<input type="text" name="uname">
    Password<input type="password" name="pass">
    Password repeat<input type="password" name="pass2">
    Email(not required)<input type="text" name="eml">
    <
    input type="submit" value="Register">
    </
    form>
    </
    body>
    Tada, just came up with that on the spot, probably isn't one I'd use but it'll do the job...
    Thanks mate!

    ---------- Post added at 10:20 PM ---------- Previous post was at 10:19 PM ----------

    Quote Originally Posted by xAtticusx View Post
    PHP Code:
    <?
        
    include "config.php"//Path to your config file
            
        
    if (isset($_POST['login']))
            {
                
    $Link MySQL_Connect($DBHost$DBUser$DBPassword) or die ();
                
    MySQL_Select_Db($DBName$Link) or die ("Database ".$DBName." does not exists."); //Connect to the database, or "die" and give the error message
                
                
    $Login $_POST['login'];
                
    $realname $_POST['realname'];
                
    $Pass $_POST['passwd'];
                
    $Repass $_POST['repasswd'];
                
    $Email $_POST['email'];
                
                
    $Login StrToLower(Trim($Login));
                
    $realname Trim($realname);
                
    $Pass StrToLower(Trim($Pass));
                
    $Repass StrToLower(Trim($Repass));
                
    $Email Trim($Email); //All of the above processes the form data, then strips it down.
        
            
    if (empty($Login) || empty($Pass) || empty($Repass) || empty($Email) || empty($realname)) //Checks if any of the fields were left empty
                
    {
                    echo 
    "<br /><font color='red'>Please complete all fields.</font><br />";
                }
            
            
            elseif (
    ereg("[^0-9a-zA-Z_-]"$Login$Txt)) //Checks to see if any of the characters entered in the login field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Username contains illegal characters.</font><br />";
                }
            elseif (
    StrPos('\''$realname)) //Checks to see if any of the characters entered in the real name field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Real Name contains illegal characters.</font><br />";
                }            
            elseif (
    ereg("[^0-9a-zA-Z_-]"$Pass$Txt)) //Checks to see if any of the characters entered in the password field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Password contains illegal characters.</font><br />";    
                }
            
            elseif (
    ereg("[^0-9a-zA-Z_-]"$Repass$Txt)) //Checks to see if any of the characters entered in the repeat password field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Password contains illegal characters.</font><br />";    
                }
            elseif (
    StrPos('\''$Email)) //Checks to see if any of the characters entered in the email field were "illegal" which could cause sql injection.
                
    {
                    echo 
    "<br /><font color='red'>Email contains illegal characters.</font><br />";    
                }    
            else
                {
                    
    $Result MySQL_Query("SELECT name FROM users WHERE name='$Login'") or ("Can't execute username check."); //Checks if the username was already registered.
                    
            
    if (MySQL_Num_Rows($Result))
                {
                    echo 
    "<br /><font color='red'>Username <b>".$Login."</b> has already been registered.</font><br />";
                }
            elseif ((
    StrLen($Login) < 4) or (StrLen($Login) > 10)) //Limits the amount of characters in the username field.
            
                
    {
                    echo 
    "<br /><font color='red'>Username is too short. Must be between 4 and 10 characters.</font><br />";
                }
            elseif ((
    StrLen($realname) < 4) or (StrLen($realname) > 30)) //Limits the amount of characters in the realname field.
            
                
    {
                    echo 
    "<br /><font color='red'>Real Name is too short. Must be between 4 and 30 characters.</font><br />";
                }
            elseif ((
    StrLen($Pass) < 4) or (StrLen($Pass) > 10)) //Limits the amount of characters in the password field.
            
                
    {
                    echo 
    "<br /><font color='red'>Password is too short. Must be between 4 and 10 characters.</font><br />";
                }
                
            elseif ((
    StrLen($Repass) < 4) or (StrLen($Repass) > 10)) //Limits the amount of characters in the repeat password field.
                
    {
                    echo 
    "<br /><font color='red'>Password is too short. Must be between 4 and 10 characters.</font><br />";
                }
                
            elseif ((
    StrLen($Email) < 4) or (StrLen($Email) > 25)) //Limits the amount of characters in the email field.
                
    {
                    echo 
    "<br /><font color='red'>Email is too short. Must be between 4 and 25 characters.</font><br />";
                }
            
            elseif (
    $Pass != $Repass//Checks to see if the password and repeat password fields match.
                
    {
                    echo 
    "<br /><font color='red'>Passwords do not match.</font><br />";
                }        
            else
                {
                    
    $Salt $Login.$Pass;
                    
    $Salt md5($Salt);
                    
    $Salt "0x".$Salt//Encrypts the password
                    
    MySQL_Query("call adduser('$Login', $Salt, '0', '0', '$realname', '0', '$Email', '0', '0', '0', '0', '0', '0', '0', '', '0', $Salt)") or die ("Can't execute query."); //Enters the information into the database
                    
    echo "<br /><font color='Green'>Username <b>".$Login."</b> created successfully!</font><br />";
                }        
            }    
        }

        
    ?>
    <form action="register.php" method="post">
            <label for="username">Username </label> <input id="username" name="login" size="50" type="text" />
            <label for="password">Password </label> <input id="password" name="passwd" size="50" type="password" />
            <label for="rpassword">Repeat Password </label> <input id="rpassword" name="repasswd" size="50" type="password" />
            <label for="realname">Real Name </label> <input id="realname" name="realname" size="50" type="text" />
            <label for="email">Email </label> <input id="email" name="email" size="50" type="text" />
            <input type="submit" name="login" value="Register" />

    </form>
    Then the config.php file:

    PHP Code:
    <? 

        $DBHost 
    "";  // mySQL IP (usually localhost or 127.0.0.1)
        
    $DBUser "";  // mySQL username
        
    $DBPassword "";  // mySQL password
        
    $DBName ""//Database name
        
    ?>
    I commented it all for you, to make it easier to edit.
    Thanks for your help!

  5. #5
    Apprentice alkaedaluck is offline
    MemberRank
    Jan 2009 Join Date
    24Posts

    Re: Registration Page

    on the basis of it was needing a login.php for user authorization for the control panel could someone develop, upon this record?

  6. #6
    Account Upgraded | Title Enabled! xAtticusx is offline
    MemberRank
    May 2010 Join Date
    EnglandLocation
    388Posts

    Re: Registration Page

    A login script is something I'm having issues with. Mainly because of the password salt.



Advertisement