Registration Script

Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 49
  1. #31
    0xC0FFEE spikensbror is offline
    MemberRank
    Dec 2006 Join Date
    SwedenLocation
    1,855Posts

    Re: Registration Script

    Quote Originally Posted by zyberscape View Post
    Learn to use the "printSign()" function I am using and you have a perfect registration script.
    I believe this is saying that it is perfect?
    Also, the script isn't as effecient as it could be. Plus you crammed everything into one file. The mssql_connection and everything which I believe isn't very secure.
    Also, do NOT use else ifs.

  2. #32
    <?="Hello World.";?> wutyes is offline
    MemberRank
    Feb 2008 Join Date
    251Posts

    Re: Registration Script

    And why shouldn't I use "else if"'s? Its an easy way to find out some information and set off events accordingly.

  3. #33
    Member Diumelia is offline
    MemberRank
    Apr 2009 Join Date
    BelgiumLocation
    60Posts

    Re: Registration Script

    Also, do NOT use else ifs.
    Lol?! Now you have to tell me why we shouldn't use else if's..

  4. #34
    This is bullshit. alextepes is offline
    MemberRank
    Sep 2006 Join Date
    CanadaLocation
    310Posts

    Re: Registration Script

    I wrote this up because I'm tired of douche bags like these guys pretending to be smart, when the server software itself is free, flyff, mssql, php, apache and so on, and thus so should be any knowledge acquired from it, if you're too bloody lazy to share what you got for free because it takes five damn minutes don't post at all.

    Here you go guys.

    PHP Code:
    <?php
    session_start
    ();
    //Needs salt to work -- Updated, if using v11 change to nForceisGay
    $salt 'kikugalanet';
    //MSSQL Settings
    $serverdb 'CHANGEME1\SQLEXPRESS';
    $admin_username 'sa';
    $admin_pass '*Your password*';
    $accounts 'ACCOUNT_DBF';
    $registerurl 'register.php';
    //DB Connection
    $link = @mssql_connect($serverdb$admin_username$admin_pass) or die ("Server is down!");
    $db = @mssql_select_db($accounts) or die ("Accout table is missing!");

    //Check Username
    function doesUsernameExist($name){
        
    $exit FALSE;
        
    $rsql "SELECT * FROM ACCOUNT_TBL WHERE account='" $name "'"
        
    $result = @mssql_query($rsql);
        if (
    $result) {
        if(
    mssql_num_rows($result) != 0){
            
    $exit TRUE;
        }
    }
        else{
            
    $exit FALSE;
        }
        return 
    $exit;

    }

    //Check if something was submitted
    if(isset($_POST['submit'])){
        
    $userRev preg_replace ("[^A-Za-z0-9]"""$_POST['username']);
        
    $passRev preg_replace ("[^A-Za-z0-9]"""$_POST['password']);
        
    $day = (int) $_POST['day'];
        
    $month = (int) $_POST['month'];
        
    $year = (int) $_POST['year'];
        
    $email $_POST['email'];
        if(
    $_POST['username'] == ""){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Please enter an username';
    }
        else if(
    $_POST['email'] == ""){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Please enter an email';
        }
        else if(
    $_POST['password'] == ""){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Please enter a password';
        }
        else if(
    $day == "" || $month == "" || $year == "" || strlen($day) > || strlen($month) > || strlen($year) != || $day == 00 || $month == 00 || $year == 0000){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Please enter a correct birthday';
        }
        else if(
    strlen($_POST['username']) > 15){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Your username cannot contain more than 15 characters';
        }
        else if(
    strlen($_POST['password']) > 36){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Your password cannot contain more than 36 characters';
        }
        else if(
    $_POST['username'] != $userRev){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Your username contains illegal characters or words';
        }
        else if(
    $_POST['password'] != $passRev){
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Your password contains illegal characters';
        }
        else if(
    strlen(filter_var($emailFILTER_VALIDATE_EMAIL)) == 0){ 
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
        
    $_SESSION['regerror'] = 'Your is email is wrong please check it';
        }
        else {
            
    //Making salt
            
    $passRev md5($salt $passRev);
            
    //End salt
            
    $bday $month.'/'.$day.'/'.$year;
            
    $email $_POST['email'];
            if(!
    doesUsernameExist($userRev)){
                
    $stmt mssql_init('webCreateAcc'$link);
                
    mssql_bind($stmt'@account'$userRevSQLVARCHARfalsefalse15);
                
    mssql_bind($stmt'@password'$passRevSQLVARCHARfalsefalse36);
                
    mssql_bind($stmt'@birthday'$bdaySQLVARCHARfalsefalse120);
                
    mssql_bind($stmt'@email'$emailSQLVARCHARfalsefalse120);
                
    mssql_execute($stmt) or die ("Something is wrong on the execution");
                
    mssql_free_statement($stmt);
        
    $_SESSION['regerror'] = '<font color="green">Thank you for registering with the name "'.$userRev.'".</font>';
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
            }
            else {
        
    $_SESSION['regerror'] = 'Username is already taken.';
        echo 
    '<script language="JavaScript">';
        echo 
    'window.location="'.$registerurl.'";';
        echo 
    '</script>';
            }
        }
    }
    //We need a form to produce results with
    else if (!$_POST['submit']) {
    if (
    $_SESSION['regerror'] != '') echo   $_SESSION['regerror'] . '<br>';
    ?>
    <form method="post" action="#">
    <legend>Username</legend>
    <input type="text" name="username">

    <legend>Password:</legend>
    <input type="password" name="password">

    <legend>Birthday (Ex: Month Day Year)</legend>
    <input type="text" name="month" value="08"><input type="text" name="day" value="13"><input type="text" name="year" value="1947">

    <legend>Email</legend>
    <input type="text" name="email">
    <legend>Submit Registration</legend>
    <input type="submit" name="submit" value="Register!">
    </form>
    <?php
    }
    ?>
    Credits for the functions and base of this script go to the opening poster.
    Last edited by alextepes; 01-02-10 at 01:43 AM.

  5. #35
    Account Upgraded | Title Enabled! ryuchao009 is offline
    MemberRank
    Feb 2009 Join Date
    United StatesLocation
    601Posts

    Re: Registration Script

    pretty nice code. I would suggest
    Code:
    else
        if (a == b)
        {   execute code }
    instead of cramming it all on the same line as an else if. It's not wrong the way you did it, just not as easy to read through it.

    The only other thing I would say is your indenting seems kinda off in a few places. Good job on the coding :D

  6. #36
    This is bullshit. alextepes is offline
    MemberRank
    Sep 2006 Join Date
    CanadaLocation
    310Posts

    Re: Registration Script

    Quote Originally Posted by ryuchao009 View Post
    pretty nice code. I would suggest

    The only other thing I would say is your indenting seems kinda off in a few places. Good job on the coding :D
    Thanks, I just indented for easier reading, one tab basically. You're free to clean and do whatever you wish with it.

    It was just I was frustrated with the OP and wanted to get it done as quick as possible, code is code, the result is the same. I find anyways. If you can read it and it's not gibberish then it could be worse. :)

    Thanks for the advice though, it's appreciated, I've got about 3 years of PHP and 5 years DB structure experience on my shoulders now.
    Hopefully it shows.

  7. #37
    Account Upgraded | Title Enabled! ryuchao009 is offline
    MemberRank
    Feb 2009 Join Date
    United StatesLocation
    601Posts

    Re: Registration Script

    Quote Originally Posted by alextepes View Post
    Thanks, I just indented for easier reading, one tab basically. You're free to clean and do whatever you wish with it.

    It was just I was frustrated with the OP and wanted to get it done as quick as possible, code is code, the result is the same. I find anyways. If you can read it and it's not gibberish then it could be worse. :)

    Thanks for the advice though, it's appreciated, I've got about 3 years of PHP and 5 years DB structure experience on my shoulders now.
    Hopefully it shows.
    Very nice. That explains why the code looked fairly professional to me (I've only been working with PHP and relational databases for around 7 months lol)

    It's effective, and that's what matters. The majority of people are just going to copy-paste it, so I don't think they're worried about how easy it is to analyze the script

    Edit: After looking back at the OP's code, I can't say I blame you for being frustrated. That was rather pathetic source code on his part
    Last edited by ryuchao009; 31-01-10 at 10:54 PM.

  8. #38
    This is bullshit. alextepes is offline
    MemberRank
    Sep 2006 Join Date
    CanadaLocation
    310Posts

    Re: Registration Script

    I apologize it appears he left out more then I thought, there isn't any md5 going on, so I actually have to fix the script again to work. Will edit this once complete in previous post.

    Edit: Salt added, update scripts to acquire the benefits of salt(Working registration with a password that gets md5 hashed)
    Last edited by alextepes; 01-02-10 at 01:44 AM.

  9. #39
    Member djhulk001 is offline
    MemberRank
    Jan 2010 Join Date
    Homestead, FlorLocation
    84Posts

    Re: Registration Script

    i need a little help with that im very confused and dont know how to do this. help me!!! thanks.

  10. #40
    Account Upgraded | Title Enabled! ryuchao009 is offline
    MemberRank
    Feb 2009 Join Date
    United StatesLocation
    601Posts

    Re: Registration Script

    Quote Originally Posted by djhulk001 View Post
    i need a little help with that im very confused and dont know how to do this. help me!!! thanks.
    ok see these lines?
    PHP Code:
    $serverdb 'CHANGEME1\SQLEXPRESS'//your computer's name
    $admin_username 'sa'//leave this alone!
    $admin_pass '*Your password*'//password for your database 
    Go to the windows control panel, then go to System (I'm on Vista so this may be slightly different on Windows 7). You should see a section titled "Computer name, domain, and workgroup settings". Underneath that it says your pc name. This goes (in all caps) where the code says CHANGEME1.

    If your instance name for the server is different (you'll know if it is), change SQLEXPRESS to match it

    Make sure you leave the \ intact or the script WILL NOT WORK

    The password you should already know if you've used SQL Server Management Studio.

  11. #41
    Enthusiast reefer is offline
    MemberRank
    Jan 2010 Join Date
    28Posts

    Re: Registration Script

    Quote Originally Posted by alextepes View Post
    I apologize it appears he left out more then I thought, there isn't any md5 going on, so I actually have to fix the script again to work. Will edit this once complete in previous post.

    Edit: Salt added, update scripts to acquire the benefits of salt(Working registration with a password that gets md5 hashed)
    Thanks for the nice script, test it gave me some error on line 221-224

  12. #42
    Proficient Member ancelmylove is offline
    MemberRank
    Aug 2008 Join Date
    C:\WindowsLocation
    182Posts

    Re: Registration Script

    It is a blank page.. i used Wamp but the register page dont show.

  13. #43
    Member djhulk001 is offline
    MemberRank
    Jan 2010 Join Date
    Homestead, FlorLocation
    84Posts

    Re: Registration Script

    same here. my page is empty and i dont see anything. i did everything correctly.

  14. #44
    <?="Hello World.";?> wutyes is offline
    MemberRank
    Feb 2008 Join Date
    251Posts

    Re: Registration Script

    You didn't do it right other wise you would see a page... I posted the finished page on the 1st post...
    Last edited by wutyes; 06-02-10 at 10:26 AM.

  15. #45
    Member musiboy is offline
    MemberRank
    Nov 2006 Join Date
    89Posts

    Re: Registration Script

    Ok i went over the code a couple of times and by what i see i changed everything needed to work correctly and i still get blank page nothing else.

    And was wondering if that have to be changed to something :
    Code:
     $rsql = "SELECT * FROM ACCOUNT_TBL WHERE account='" . $name . "'";
    Sorry i'm kinda new with the PHP coding so i'm doing it on insticts :D

    EDIT* Ok i fixed that apperently i forgot to check the extensions for mssql.
    But now it just says Server is Offline and i'm pretty sure i wrote the correct DB and pass for it.
    Last edited by musiboy; 06-03-10 at 01:30 PM.



Page 3 of 4 FirstFirst 1234 LastLast

Advertisement