please help im a complete noob
Posted: Wed Jul 09, 2008 11:42 am
there seems to be someting wrong (probably my settings)
i have a problem, i should note this is code i have taken from a pre written script.
full code to register.php:
it gives output:
Parse error: syntax error, unexpected $end in C:\wamp\www\register.php on line 123
only thing is there is no line 123...
i have a problem, i should note this is code i have taken from a pre written script.
full code to register.php:
Code: Select all
<?php
require_once('db.php');
include('functions.php');
include('settings.php');
if (array_key_exists('_submit_check', $_POST))
{
if ( $_POST['username'] != '' && $_POST['password'] != '' && $_POST['password'] == $_POST['password_confirmed'] && $_POST['email'] != '' && valid_email ( $_POST['email'] ) == TRUE )
{
if ( ! checkUnique('Username', $_POST['username']) )
{
$error = 'Username already taken. Please try again!';
}
elseif ( ! checkUnique('Email', $_POST['email']) )
{
$error = 'The email you used is associated with another user. Please try again or use the "forgot password" feature!';
}
else {
$query = mysql_query("INSERT INTO users (`Username` , `Password`, `Email`, `Random_key`) VALUES ('".mysql_real_escape_string($_POST['username'])."', '".mysql_real_escape_string(md5($_POST['password']))."', '".mysql_real_escape_string($_POST['email'])."', '".random_string('alnum', 32)."')") or die(mysql_error());
$getUser = mysql_query("SELECT ID, Username, Email, Random_key FROM users WHERE Username = '".mysql_real_escape_string($_POST['username'])."'") or die(mysql_error());
if(mysql_num_rows($getUser)==1)
{
$row = mysql_fetch_assoc($getUser);
$headers = 'From: ' . $site_email . "\r\n" .
'Reply-To: ' . $site_email . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject = "Activation email from " . $domain_name;
$message = "Dear ".$row['Username'].", this is your activation link to join our website. In order to confirm your membership please click on the following link: ".$url."confirm.php?ID=".$row['ID']."&key=".$row['Random_key']." Thank you for joining";
if ( mail($row['Email'], $subject, $message, $headers ) )
{
$msg = 'Account created. Please login to the email you provided during registration and confirm your membership.';
}
else {
$error = 'I created the account but failed sending the validation email out.';
}
}
else {
$error = 'You just made possible the old guy (the impossible). Please inform my boss in order to give you the price for this.';
}
}
}
else {
$error = 'There was an error in your data. Please make sure you filled in all the required data, you provided a valid email address and that the password fields match one another';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>roScripts.com - PHP Login System Witn Admin Features</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<!--
____ __
/\ _`\ __ /\ \__
_ __ ___\ \,\L\_\ ___ _ __ /\_\ _____\ \ ,_\ ____
/\`'__\/ __`\/_\__ \ /'___\/\`'__\/\ \/\ '__`\ \ \/ /',__\
\ \ \//\ \L\ \/\ \L\ \/\ \__/\ \ \/ \ \ \ \ \L\ \ \ \_/\__, `\
\ \_\ \____/\ `\____\ \____\ \_\ \ \_\ \ ,__/\ \__\/\____/
\/_/ \/___/ \/_____/\/____/ \/_/ \/_/\ \ \/ \/__/\/___/
\ \_\
\/_/
Making your world easy
-->
</head>
<body>
<div id="log">
<?php if ( isset ( $error ) ) { echo ' <p class="error">' . $error . '</p>' . "\n"; } ?>
<?php if ( isset ( $msg ) ) { echo ' <p class="msg">' . $msg . '</p>' . "\n"; } else {//if we have a mesage we don't need this form again.?>
</div>
<div id="container" style="text-align:center">
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="_submit_check" value="1"/>
<table align="center" width="99%">
<tr>
<td><div align="left">Username</div></td>
</tr>
<tr>
<td><div align="left"><input class="input" type="text" id="username" name="username" size="32" value="<?php if(isset($_POST['username'])){echo $_POST['username'];}?>" /></div></td>
</tr>
<tr>
<td><div align="left">Password</div></td>
</tr>
<tr>
<td><div align="left"><input class="input" type="password" id="password" name="password" size="32" value="" /></div></td>
</tr>
<tr>
<td><div align="left">Re-Password</div></td>
</tr>
<tr>
<td><div align="left"><input class="input" type="password" id="password_confirmed" name="password_confirmed" size="32" value="" /></div></td>
</tr>
<tr>
<td><div align="left">Email</div></td>
</tr>
<tr>
<td><div align="left"><input class="input" type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /></div></td>
</tr>
<tr>
<td>
<input type="image" name="register" value="register" class="submit-btn" src="http://www.roscripts.com/forum/images/btn.gif" alt="submit" title="submit" />
<br class="clear" />
</td>
</tr>
</table>
</form>
</div>
<? } ?>
</body
</html>
Parse error: syntax error, unexpected $end in C:\wamp\www\register.php on line 123
only thing is there is no line 123...