Jump to content

Recommended Posts

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\register_process.php on line 97

 

Here is the script hope fully someone can help me :D

 

 

i attached the script too

 

Shud not be a hard job

 

<?php

include 'includes/database.php';

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

$username = addslashes(trim($_POST['username']));
$email = addslashes(trim($_POST['email']));
$pass = addslashes(trim($_POST['password']));
$conf = addslashes(trim($_POST['confirm']));

$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d, m y");

if ( $_POST['password'] == $_POST['confirm'] )
{}else{

echo '<script>alert("Your passwords were not the same, please enter the same password in each field.");</script>';
echo '<script>history.back(1);</script>';
exit;

}

$password = md5($pass);

if ((((( empty($first) ) || ( empty($surname) ) || ( empty($username) ) || ( empty($email) ) || ( empty($password) )))))
{

echo '<script>alert("One or more fields was left empty, please try again.");</script>';
echo '<script>history.back(1);</script>';
exit;

}

if((!strstr($email , "@")) || (!strstr($email , ".")))
{


echo '<script>alert("The email you have entred is an invalid email address.")';</script>;
echo '<script>history.back(1);</script>';
exit;

}

$actkey = mt_rand(1, 500).'f78dj899dd';
$act = sha1($actkey);

$query = mysql_query("INSERT INTO Users (Username, Password, Email, Date, IP, Actkey) VALUES
('$username','$email','$date','@ip','$act')") or die(mysql_error());
$send = mail($email , "Registration Confirmation","Thank you for registrering with EthicGamer.com\n\nYour username and
password is below, along with details on how to activate your account.n\nUser:".$username."\nPass:".$pass."\n\nClick the link
below to activate your account:\nhttp://ethicgamers.com/activate.php?id=".$act."\n\nPlease do not reply, this is an automated
mailer.\n\nThanks","FROM: activate@ethicgamers.com");

if(($query)&&($send))
{

echo ' <html>
<head>
</head>

<body>

<div>
<p>Thank you for registering, you will recieve an email soon with your login details and your activation link so that you can activate your account.</p>
<p><a href="login.php">Click here</a> to login once you have activated.</p>
</div>

</body>
</html>
';

} else {

echo '
<html>

<body>

<div>
<p>We are sorry, there appears to be a problem with our script at the moment.</p>
<p>Your data was not lost. Username: '.$username.' | Password: '.$pass.' | Email: '.$email.'</p>
<p>Please try again later.</p>
</div>

</body>
</html>
';

}

} else {
?>

 

[attachment deleted by admin]

It's pretty obvious...

Did you look at the line it's talking about? Just looking at the code you can see a big error.

 

} else {

?>

 

Okay i have a probleme in the script and that did nnot help me mutch, Can you make it more detailed? :)

Updated code nothing to do whit the unexpected end

 

<?php

include 'includes/database.php';

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

$username = addslashes(trim($_POST['username']));
$email = addslashes(trim($_POST['email']));
$pass = addslashes(trim($_POST['password']));
$conf = addslashes(trim($_POST['confirm']));

$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d, m y");

if ( $_POST['password'] == $_POST['confirm'] )
{}else{

echo '<script>alert("Your passwords were not the same, please enter the same password in each field.");</script>';
echo '<script>history.back(1);</script>';
exit;

}

$password = md5($pass);

if ((((( empty($username) ) || ( empty($email) ) || ( empty($password) )))))
{

echo '<script>alert("One or more fields was left empty, please try again.");</script>';
echo '<script>history.back(1);</script>';
exit;

}

if((!strstr($email , "@")) || (!strstr($email , ".")))
{


echo '<script>alert("The email you have entred is an invalid email address.")';</script>;
echo '<script>history.back(1);</script>';
exit;

}

$actkey = mt_rand(1, 500).'f78dj899dd';
$act = sha1($actkey);

$query = mysql_query("INSERT INTO Users (Username, Password, Email, Date, IP, Actkey) VALUES
('$username','$email','$date','@ip','$act')") or die(mysql_error());
$send = mail($email , "Registration Confirmation","Thank you for registrering with EthicGamer.com\n\nYour username and
password is below, along with details on how to activate your account.n\nUser:".$username."\nPass:".$pass."\n\nClick the link
below to activate your account:\nhttp://ethicgamers.com/activate.php?id=".$act."\n\nPlease do not reply, this is an automated
mailer.\n\nThanks","FROM: activate@ethicgamers.com");

if(($query)&&($send))
{

echo ' <html>
<head>
</head>

<body>

<div>
<p>Thank you for registering, you will recieve an email soon with your login details and your activation link so that you can activate your account.</p>
<p><a href="login.php">Click here</a> to login once you have activated.</p>
</div>

</body>
</html>
';

} else {

echo '
<html>

<body>

<div>
<p>We are sorry, there appears to be a problem with our script at the moment.</p>
<p>Your data was not lost. Username: '.$username.' | Password: '.$pass.' | Email: '.$email.'</p>
<p>Please try again later.</p>
</div>

</body>
</html>
';

}

} else {
?>

 

[attachment deleted by admin]

Every single one of {'s has to have a matching }, or you will get an un-expected end.

 

AS for your update.

//fix this line:
echo '<script>alert("The email you have entred is an invalid email address.")';</script>;
//To this:
echo '<script>alert("The email you have entred is an invalid email address.")</script>';

//And remove 
else {
//From the very bottom.

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.