another error.help needed Parse error: syntax error, unexpected T_STRING in /home/tam

Discussion in 'PHP' started by sandeepdude, Dec 17, 2007.

  1. #1
    just yesterday i came out from an error and today another error.i have no idea.please tell me.
    the error is Parse error: syntax error, unexpected T_STRING in /home/tamilweb/public_html/register.php on line 6.
    here is my register.php page.
    <?
    $dbhost = "correct";
    $dbname = "correct";
    $dbuser = "correct";
    $dbpass = "correct";
    mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
    mysql_select_db($dbname) or die(mysql_error());
    $name = $_POST['name'];
    $email = $_POST['email'];    
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $emailedpass = $_POST['password'];
     if((!$name) || (!$email) || (!$username)){
       echo 'Please re-enter in your information as you missed some required fields! <br />';
       if(!$name){
           echo "Your name is a required field.<br />";
       }
       if(!$email){
           echo "Your email is required so we can send you your registration information.<br />";
       }
       if(!$username){
           echo "Your username is required.  You cannot login without it!<br />";
       }
       if(!$password){
        echo "You must enter in a password.  You cannot login without it!<br />";
    }
    
       include 'register.html';
       
       exit();
    } 
    
    $checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");
    
    $username_exist = mysql_num_rows($checkuser);
    
    if($username_exist > 0){
        echo "I'm sorry but the username you specified has already been taken.  Please pick another one.";
        unset($username);
        include 'register.html';
        exit();
    }
    
    $query = "INSERT INTO users (name, email, username, password)
    VALUES('$name', '$email', '$username', '$password')";
    mysql_query($query) or die(mysql_error());
    mysql_close();
    
    echo "You have successfully Registered";
    
    $yoursite = ‘tamilweb.insanegb.com’;
    $webmaster = ‘sandeep’;
    $youremail = "";
    
    $subject = "You have successfully registered at $yoursite...";
    $message = "Dear $name, you are now registered at our web site.  
        To login, simply go to our web page and enter in the following details in the login form:
        Username: $username
        Password: $emailedpass
        
        Please print this information out and store it for future reference.
    
    A HUMBLE REQUEST:Help us to grow.just pass the information about this website to atleast 2 of your friends
        
        Thanks,
        $webmaster";
        
    mail($email, $subject, $message, "From: $yoursite <$youremail>\nX-Mailer:PHP/" . phpversion());
        
    echo "Your information has been mailed to your email address.";
    ?>
    PHP:

    similarly,when i try to enter my email address in the above page,i get an errpr as UNEXPECTED symbol '@' in......
    please tell me how to insert my email address.
    thank you
     
    sandeepdude, Dec 17, 2007 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you want your code to be secure, you need to use mysql_real_escape_string
     
    matthewrobertbell, Dec 17, 2007 IP
  3. sunnyverma1984

    sunnyverma1984 Well-Known Member

    Messages:
    342
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #3
    you code is working on my wampserver try again
     
    sunnyverma1984, Dec 17, 2007 IP