Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23
  1. #11
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Caleb: what do you mena the $link in the mysql_select_db? I couldn't find that variable.

  2. #12
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    I meant $mysql_connection, my bad.

  3. #13
    Join Date
    Jun 2005
    Posts
    2,688
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Hypertext
    You mispelt mysql_connect
    mysql_pconnect is a perfectly legit function. I agree in the context of this script mysql_connect would be a better preference as there is no reason to have a persistent connection to MySQL. mysql_pconnect should only be used in certain circumstances and therefore is not required for most basic web scripts.

    Quote Originally Posted by HyperText
    single quotes are faster than doubles
    Yes, they may be faster, however for a simple small web application this doesn't need to be taken into account. It will make no difference at all. Saying they are faster really only applies for much larger sites such as FaceBook.

    Quote Originally Posted by HyperText
    $logged['in'] should be set as true or false, not 1 or 0.
    Same thing:

    PHP Code:
    $i=0;
    if(
    $i) echo 'true'; else echo 'false'
    Would echo false.

    PHP Code:
    $i=1;
    if(
    $i) echo 'true'; else echo 'false'
    Would echo true.

    Quote Originally Posted by HyperText
    I personally wouldn't use a mysql connection resource in your database selector
    You should. It is good practice especially later on when you develop further and wish to connect to several databases at the same time.

    Quote Originally Posted by HyperText
    please check your code in a debugger or an ide, coming on here asking about mysql_pconnect, it's to be honest wasting everybodys time when you could see that individual mistake in quarter of a second on an ide or a debugger.
    This forum is partly to help other users, therefore if a user posts asking for help you shouldn't turn them away. If the user's PHP level isn't as good as yours, (No offence aimed at you LoserWill) then you should be offering advice. Life is all about learning, not saying "go away".

    Quote Originally Posted by HyperText
    ips are dynamic a lot of the time so don't use them
    Not true all the time. There are ways of creating IP comparison scripts to help track users on dynamic IPs.

    Quote Originally Posted by HyperText
    ++$error;
    is faster than
    $error++
    No it isn't, they are the same thing.

    Quote Originally Posted by HyperText
    Use echo equals like <?= $var ?>
    Saying that may be another form of "echo" however you need the short_open_tag option enabled in the PHP Configuration.

    Quote Originally Posted by HyperText
    HOW THE HECK ARE YOU DOING ALL THIS WITHOUT A SINGLE ERROR TO PRODUCE FOR US?
    I won't comment..

    Quote Originally Posted by HyperText
    oh and get rid of $insert = ...why is that there in the first place!!??!
    It is good practice to assign querys to a variable.

    Quote Originally Posted by HyperText
    Seriously Caleb, have you even heard about something called benchmarks, the stuff I said is faster is faster because it is. And your thing about <?= ?> is just plain funny. Your the noob!, noob.
    It may be faster in large scale websites however in this instance it will make no difference at all.

  4. #14
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    No, that's not it Caleb. (thanks btw.)

  5. #15
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    I've tried a lot of things and nothing is working. Anybody have any ideas?

  6. #16
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Change the query to

    PHP Code:
    $insert mysql_query "INSERT INTO `users` (username, password, email, ip, joindate, jointime) VALUES('$username', '$password', '$email', '$ip', '$date', '$time')" ) or die ( mysql_error () ); 

  7. #17
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Nope, it still doesn't add it to the database, take a look: http://kolzy.com/ws/register.php

  8. #18
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    PHP Code:
    <?php

    if($logged['in'] == 1){
        
    header("Location: index.php");
    }

    if(
    row_exists('users','ip',$ip)){ ?>
        Your IP ($ip) has already been registered with.
    <?php }

    else{
        if(
    $_GET["action"] == "register"){
            
    $username clean($_POST['username']);
            
    $email clean($_POST['email']);
            
    $password clean($_POST['password']);
            
    $cpassword clean($_POST['cpassword']);
            
            
    $errors 0;
            
    $error_message '';
            
            if(empty(
    $username) || empty($email) || empty($password) || empty($cpassword)){
                
    $errors++;
                
    $error_message 'All fields must be filled in.';
            }
            
            if(
    row_exists('users','username',$username)){
                
    $errors++;
                
    $error_message 'That username is already taken.';
            }
            
             if(
    row_exists('users','email',$email) || !is_valid_email($email)){
                 
    $errors++;
                
    $error_message 'That email is alreayd in use or is incorrect.';    
             }
             
             
    $password enc($password);
             
    $cpassword enc($cpassword);
             
             if(
    $password != $cpassword){
                 
    $errors++;
                 
    $error_message 'The two passwords you entered do not match.';
             }
             
             if(
    $errors 0){
                 
    $insert mysql_query("INSERT INTO `users` (`username`,`password`,`email`,`ip`,`joindate`,`jointime`) VALUES ('".$username."','".$password."','".$email."','".$ip."','".$date."','".$time."')");
                 
                 
    $subject "Welcome to willSystem";
                 
    $body "Thanks for joining (test message from willSystem demo.)";
                 
    send_mail($email,$subject,$body);
                 
                 
    ?>

    Thanks for joining, you may now <a href="login.php">login</a>.
                 
    <?php

    exit();
             } else{
                 echo 
    $error_message;
             }
             
        }

    ?>
    <form method="post" action="?action=register">
    Username<br />
    <input type="text" name="username" value="<?=$username?>" maxlength="12"><br /><br />
                     
    Email<br />
    <input type="text" name="email" value="<?=$email?>"><br /><br />
                     
    Password<br />
    <input type="password" name="password"> Confirm <input type="password" name="cpassword"><br /><br />
                     
    <input type="submit" name="register" value="Register"><br /><br />
                     
    All fields are required.
    </form>

    <?php
    }
    ?>

  9. #19
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    I'll try it when I get back on my main pc. Thanks again for your help.

  10. #20
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    I've tried adding an action to the form (like yours) and it didn't do anything. I've looked it through many times and fail to see what's wrong with it.

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •