Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy register script syntax error

    Can anyone please tell me what is wrong with this script:

    I get a blank screen and nothing comes up,

    PHP Code:
          <html>

          <head>
            <title>Register</title>
          </head>

          <body>

          <?
         
    // error_reporting();

          
    $conn mysql_connect("localhost","root","triadpass");
          
    mysql_select_db("mydb"$conn)or die("Could not select database");

          
    //take out later
          // function to display form ;)
          
    function formcall() {
          
    ?>



          <form method=post action='register.php'>
          <b>First Name*&nbsp; : </b><input type='text' name='name'><br />
          <b>Last Name*&nbsp;&nbsp; : </b><input type='text' name='lname'><br />
          <b>Email Address*: </b><input type='text' name='email'><br />
          <b>Age*&nbsp;&nbsp;&nbsp;&nbsp; : </b><input type='text' name='age'><br />
          <b>Username* &nbsp; &nbsp;    : </b><input type='text' name='user'><br />
          <b>Password*  &nbsp; &nbsp;    : </b><input type='text' name='pass'><br />
          <input type='submit' name='submit'><br>
          <b>* = Required</b>
          </form>
          <?
          
    }



          
    // REGISTER
          // ok always remember this  ;)



          
    if(isset($_POST['submit'])) {


          
    // lets check they didnt leave the god damned things blank
          // for future reference
          // name = $name = $_POST['name']
          // lastname = $lname = $_POST['lname']
          // email address = $email = $_POST['email']
          // age = $age = $_POST['age']
          // username = $user = $_POST['user']
          // password = $pass = $_POST['pass'] remember to md5
          // signdate = now()

          
    $name $_POST['name'];
          
    $lname $_POST['lname'];
          
    $email $_POST['email'];
          
    $user $_POST['user'];
          
    $pass $_POST['pass'];
          
    $age $_POST['age'];
          
    $submit $_POST['submit'];


          
    // make sure no users typed any characters that they shouldnt have

          
    $name stripslashes($name);
          
    $lname stripslashes($lname);
          
    $email stripslashes($email);
          
    $user stripslashes($user);
          
    $age stripslashes($age);


          
    //check if they entered it
          
    $username_check mysql_query("SELECT * FROM users WHERE username='$user'");
          
    $email_check mysql_query("SELECT * FROM users WHERE email_address='$email'");
          
    $norow_username mysql_num_rows($username_check);
          
    $norow_email mysql_num_rows($email_check);
          
    // error check
          
    if(!$name||!$lname||!$email||!$user||!$pass||$norow_username 0||$norow_email 0) {
                                    if(!
    $name) {
                                    echo 
    "<font color=\"red\"><b>Please enter your first name</font></b><br>";

                                    }
                                    if(!
    $lname) {
                                    echo  
    "<font color=\"red\"><b>Please enter your last name</font></b><br>";

                                    }
                                    if(!
    $email) {
                                    echo  
    "<font color=\"red\"><b>Please enter your email</font></b><br>";

                                    }
                                    if(!
    $user) {
                                    echo 
    "<font color=\"red\"><b>Please enter a username</font></b><br>";

                                    }
                                    if(!
    $pass) {
                                    echo  
    "<font color=\"red\"><b>Please enter a password</font></b><br>";

                                    }
                                    if (
    $norow_username 0) {
                                    echo  
    "<font color=\"red\"><b>Sorry username already exists :D</b></font>";
                                    }
                                    if (
    $norow_email 0) {
                                    echo  
    "<font color=\"red\"><b>Sorry email address is already registered</b></font>";
                                    }
                                    
    formcall();
                                    }

          
    // make the password md5 secure ;)

          
    $monkey $pass;
          
    $pass md5($pass);
          
    // see if they already exist


          // ok lets put it in :D
          // error_reporting(E_ALL);

          // connected!
          //oops forgot to register time ;)
          
    $mydate now();

          
    //CONNECT TO DATABASE

          
    $checkquery "SELECT 'userID' FROM 'users' WHERE username='$user' AND password='$pass'";
          
    $checkquery_res mysql_query($checkquery$conn);
          
    $querys "
          INSERT INTO users(first_name, last_name, email_address, username, password, age, signup_date)
          VALUES('$name','$lname','$email','$user','$pass','$mydate')"
    ;

          if (
    mysql_query($querys,$conn)) {
                  
    //IF INSERT QUERY IS SUCCESSFULL


                  //WHY HAVE YOU PUT THIS HERE? YOU DONT USE IT...
                  
    $userid mysql_result($checkquery_res0'userid');
                  
    //CONSTRUCTING MAIL
                  
    $to $email;
                  
    $subject "Membership at TiG, $name $lname";
                  
    $message "Dear $name $lname

                  you have recently signed up at TiG, we thank you for this...
                  you must click the link below to activate your account thank you

                  click here: http://tig.deathdragon.net/test/activate.php?id="
    .$userid"&code=".$pass"

                  if the link does not appear copy the link to your address bar

                  You signed up with the following information
                  Username : "
    .$user"
                  Password : "
    .$monkey"

                  Thanks!
                  TiG Staff

                  This is a automatic response please do not reply!"
    ;
                  
    $headers "From: TiG\n
                  X-Mailer: PHP/" 
    phpversion();

                  
    mail($to$subject$message$headers);


                  print 
    "Your membership details have been mailed to the address supplied please follow the instructions in the email";

          } else {
                  
    //IF INSERT QUERY IS UNSUCCESSFULL
                  
    formcall();
          }
          }else{
                  
    formcall();

          }

          
    ?>


          </body>

          </html>
    i swear , i fix this and i wont bother you lot again
    by the way the
    PHP Code:
    error_reporting(E_ALL); 
    does not work
    ...not bad for a thirteen year old

  • #2
    Regular Coder
    Join Date
    Mar 2004
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
     <html> 

          <head> 
            <title>Register</title> 
          </head> 

          <body> 

          <? 
         error_reporting
    (E_ALL);

          
    $conn mysql_connect("localhost","root","triadpass"); 
          
    mysql_select_db("mydb"$conn)or die("Could not select database"); 

          
    //take out later 
          // function to display form ;) 
          
    function formcall() { 
          
    ?> 



          <form method=post action='register.php'> 
          <b>First Name*&nbsp; : </b><input type='text' name='name'><br /> 
          <b>Last Name*&nbsp;&nbsp; : </b><input type='text' name='lname'><br /> 
          <b>Email Address*: </b><input type='text' name='email'><br /> 
          <b>Age*&nbsp;&nbsp;&nbsp;&nbsp; : </b><input type='text' name='age'><br /> 
          <b>Username* &nbsp; &nbsp;    : </b><input type='text' name='user'><br /> 
          <b>Password*  &nbsp; &nbsp;    : </b><input type='text' name='pass'><br /> 
          <input type='submit' name='submit'><br> 
          <b>* = Required</b> 
          </form> 
          <? 
          




          
    // REGISTER 
          // ok always remember this  ;) 



          
    if(isset($_POST['submit'])) { 


          
    // lets check they didnt leave the god damned things blank 
          // for future reference 
          // name = $name = $_POST['name'] 
          // lastname = $lname = $_POST['lname'] 
          // email address = $email = $_POST['email'] 
          // age = $age = $_POST['age'] 
          // username = $user = $_POST['user'] 
          // password = $pass = $_POST['pass'] remember to md5 
          // signdate = now() 

          
    $name $_POST['name']; 
          
    $lname $_POST['lname']; 
          
    $email $_POST['email']; 
          
    $user $_POST['user']; 
          
    $pass $_POST['pass']; 
          
    $age $_POST['age']; 
          
    $submit $_POST['submit']; 


          
    // make sure no users typed any characters that they shouldnt have 

          
    $name stripslashes($name); 
          
    $lname stripslashes($lname); 
          
    $email stripslashes($email); 
          
    $user stripslashes($user); 
          
    $age stripslashes($age); 


          
    //check if they entered it 
          
    $username_check mysql_query("SELECT * FROM users WHERE username='$user'"); 
          
    $email_check mysql_query("SELECT * FROM users WHERE email_address='$email'"); 
          
    $norow_username mysql_num_rows($username_check); 
          
    $norow_email mysql_num_rows($email_check); 
          
    // error check 
          
    if(!$name||!$lname||!$email||!$user||!$pass||$noro||$w_username 0||$norow_email 0) { //you where missing a $ and a || here
                                    
    if(!$name) { 
                                    echo 
    "<font color=\"red\"><b>Please enter your first name</font></b><br>"

                                    } 
                                    if(!
    $lname) { 
                                    echo  
    "<font color=\"red\"><b>Please enter your last name</font></b><br>"

                                    } 
                                    if(!
    $email) { 
                                    echo  
    "<font color=\"red\"><b>Please enter your email</font></b><br>"

                                    } 
                                    if(!
    $user) { 
                                    echo 
    "<font color=\"red\"><b>Please enter a username</font></b><br>"

                                    } 
                                    if(!
    $pass) { 
                                    echo  
    "<font color=\"red\"><b>Please enter a password</font></b><br>"

                                    } 
                                    if (
    $norow_username 0) { 
                                    echo  
    "<font color=\"red\"><b>Sorry username already exists :D</b></font>"
                                    } 
                                    if (
    $norow_email 0) { 
                                    echo  
    "<font color=\"red\"><b>Sorry email address is already registered</b></font>"
                                    } 
                                    
    formcall(); 
                                    } 

          
    // make the password md5 secure ;) 

          
    $monkey $pass
          
    $pass md5($pass); 
          
    // see if they already exist 


          // ok lets put it in :D 
          

          // connected! 
          //oops forgot to register time ;) 
          
    $mydate now(); 

          
    //CONNECT TO DATABASE 

          
    $checkquery "SELECT 'userID' FROM 'users' WHERE username='$user' AND password='$pass'"
          
    $checkquery_res mysql_query($checkquery$conn); 
          
    $querys 
          INSERT INTO users(first_name, last_name, email_address, username, password, age, signup_date) 
          VALUES('$name','$lname','$email','$user','$pass','  $mydate')"


          if (
    mysql_query($querys,$conn)) { 
                  
    //IF INSERT QUERY IS SUCCESSFULL 


                  //WHY HAVE YOU PUT THIS HERE? YOU DONT USE IT... 
                  
    $userid mysql_result($checkquery_res0'userid'); 
                  
    //CONSTRUCTING MAIL 
                  
    $to $email
                  
    $subject "Membership at TiG, $name $lname"
    // you where missing a couple of periods in section below
                  
    $message "Dear $name $lname 

                  you have recently signed up at TiG, we thank you for this... 
                  you must click the link below to activate your account thank you 

                  click here: http://tig.deathdragon.net/test/activate.php?id="
    .$userid."&code=".$pass.

                  if the link does not appear copy the link to your address bar 

                  You signed up with the following information 
                  Username : "
    .$user.
                  Password : "
    .$monkey.

                  Thanks! 
                  TiG Staff 

                  This is a automatic response please do not reply!"

                  
    $headers "From: TiG\n 
                  X-Mailer: PHP/" 
    phpversion(); 

                  
    mail($to$subject$message$headers); 


                  print 
    "Your membership details have been mailed to the address supplied please follow the instructions in the email"

          } else { 
                  
    //IF INSERT QUERY IS UNSUCCESSFULL 
                  
    formcall(); 
          } 
          }else{ 
                  
    formcall(); 

          } 

          
    ?> 


          </body> 

          </html>

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please can you tell me in what way did you change it ??

    Please can you tell me in what way did you change it ??
    ...not bad for a thirteen year old

  • #4
    Regular Coder
    Join Date
    Mar 2004
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i added two comments where i change script look closer


  •  

    Posting Permissions

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