Jump to content

Recommended Posts

help please  next error

Parse error: syntax error, unexpected T_ECHO in /Applications/XAMPP/xamppfiles/htdocs/register2.php on line 47

<?php

$host="localhost"; 
$username=""; 
$password=""; 
$db_name="test"; 
$tbl_name="userinfo"; 

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$mypassword2=$_POST['mypassword2'];
$email=$_POST['email'];
$email2=$_POST['email2'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$mypassword2 = stripslashes($mypassword2);
$email = stripslashes($email);
$email2 = stripslashes($email2);

$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$mypassword2 = mysql_real_escape_string($mypassword2);
$email = mysql_real_escape_string($email);
$email2 = mysql_real_escape_string($email2);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' ";
$result=mysql_query($sql);


$count=mysql_num_rows($result);



if($count==1){
echo"name already used"
;
}
else{
if ($mypassword != $mypassword1){
echo"you filld in 2 diffrend passwords";
}
else{
if ($email != $email1{
echo"you filld in 2 diffrend emails";
}
else{

ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

function checkemail($email)
{

    if(!stristr($email, '@'))
    {
        return false;
    }
    $email_split = explode("@", $email);

    if(count($email_split) != 2)
    {
        return false;
    }
    $email_user = $email_split[0];
    $email_host = $email_split[1];

    if(!getmxrr($email_host, $var))
    {
        return false;
    }

    if(!preg_match("/^[0-9a-z]([-_.~]?[0-9a-z])*$/i", $email_user))
    {
        return false;
    }
    return trsue;
}


$email = (isset($_POST['email'])) ? $_POST['email'] : '';


if(!checkemail($email))
{
    echo 'not failid email<br />';
}
else
{
$sql="SELECT * FROM $tbl_name WHERE email='$email'";
$result2=mysql_query($sql2);


$count2=mysql_num_rows($result2);



if($count2==1){
echo"email already used"
}
else
{

mysql_query("INSERT INTO $tbl_name VALUES ( '$myusername', $mypassword, '$email','0' )"); 

echo"registred succesfull,you can login now";  
}  
}
}
}
}
?>

 

MOD EDIT:

 . . . 

tags added.

Link to comment
https://forums.phpfreaks.com/topic/265703-registration2/
Share on other sites

tnx that helped now i got this

 

Parse error: syntax error, unexpected '}', expecting ',' or ';' in /Applications/XAMPP/xamppfiles/htdocs/register2.php on line 102

<code>

<?php

 

$host="localhost";

$username="";

$password="";

$db_name="test";

$tbl_name="userinfo";

 

mysql_connect("$host", "$username", "$password")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");

 

$myusername=$_POST['myusername'];

$mypassword=$_POST['mypassword'];

$mypassword2=$_POST['mypassword2'];

$email=$_POST['email'];

$email2=$_POST['email2'];

$myusername = stripslashes($myusername);

$mypassword = stripslashes($mypassword);

$mypassword2 = stripslashes($mypassword2);

$email = stripslashes($email);

$email2 = stripslashes($email2);

 

$myusername = mysql_real_escape_string($myusername);

$mypassword = mysql_real_escape_string($mypassword);

$mypassword2 = mysql_real_escape_string($mypassword2);

$email = mysql_real_escape_string($email);

$email2 = mysql_real_escape_string($email2);

 

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' ";

$result=mysql_query($sql);

 

 

$count=mysql_num_rows($result);

 

 

 

if($count==1){

echo"name already used"

;

}

else{

if ($mypassword != $mypassword1){

echo"you filld in 2 diffrend passwords";

}

else{

if ($email != $email1){

echo"you filld in 2 diffrend emails";

}

else{

 

ini_set('display_errors', 1); // 0 = uit, 1 = aan

error_reporting(E_ALL);

 

function checkemail($email)

{

 

    if(!stristr($email, '@'))

    {

        return false;

    }

    $email_split = explode("@", $email);

 

    if(count($email_split) != 2)

    {

        return false;

    }

    $email_user = $email_split[0];

    $email_host = $email_split[1];

 

    if(!getmxrr($email_host, $var))

    {

        return false;

    }

 

    if(!preg_match("/^[0-9a-z]([-_.~]?[0-9a-z])*$/i", $email_user))

    {

        return false;

    }

    return trsue;

}

 

 

$email = (isset($_POST['email'])) ? $_POST['email'] : '';

 

 

if(!checkemail($email))

{

    echo 'not failid email<br />';

}

else

{

$sql="SELECT * FROM $tbl_name WHERE email='$email'";

$result2=mysql_query($sql2);

 

 

$count2=mysql_num_rows($result2);

 

 

 

if($count2==1){

echo"email already used"

}

else

{

 

mysql_query("INSERT INTO $tbl_name VALUES ( '$myusername', $mypassword, '$email','0' )");

 

echo"registred succesfull,you can login now"; 

}

}

}

}

?>

</code>

Link to comment
https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361667
Share on other sites

oops i mean

<?php

$host="localhost"; 
$username=""; 
$password=""; 
$db_name="test"; 
$tbl_name="userinfo"; 

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$mypassword2=$_POST['mypassword2'];
$email=$_POST['email'];
$email2=$_POST['email2'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$mypassword2 = stripslashes($mypassword2);
$email = stripslashes($email);
$email2 = stripslashes($email2);

$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$mypassword2 = mysql_real_escape_string($mypassword2);
$email = mysql_real_escape_string($email);
$email2 = mysql_real_escape_string($email2);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' ";
$result=mysql_query($sql);


$count=mysql_num_rows($result);



if($count==1){
echo"name already used"
;
}
else{
if ($mypassword != $mypassword1){
echo"you filld in 2 diffrend passwords";
}
else{
if ($email != $email1){
echo"you filld in 2 diffrend emails";
}
else{

ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

function checkemail($email)
{

    if(!stristr($email, '@'))
    {
        return false;
    }
    $email_split = explode("@", $email);

    if(count($email_split) != 2)
    {
        return false;
    }
    $email_user = $email_split[0];
    $email_host = $email_split[1];

    if(!getmxrr($email_host, $var))
    {
        return false;
    }

    if(!preg_match("/^[0-9a-z]([-_.~]?[0-9a-z])*$/i", $email_user))
    {
        return false;
    }
    return trsue;
}


$email = (isset($_POST['email'])) ? $_POST['email'] : '';


if(!checkemail($email))
{
    echo 'not failid email<br />';
}
else
{
$sql="SELECT * FROM $tbl_name WHERE email='$email'";
$result2=mysql_query($sql2);


$count2=mysql_num_rows($result2);



if($count2==1){
echo"email already used"
}
else
{

mysql_query("INSERT INTO $tbl_name VALUES ( '$myusername', $mypassword, '$email','0' )"); 

echo"registred succesfull,you can login now";  
}  
}
}
}
}
?>

can some one eddit that?

Link to comment
https://forums.phpfreaks.com/topic/265703-registration2/#findComment-1361675
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.