Parse Error, Unexpected /
Started by Tubby, May 11 2005 01:55 PM
13 replies to this topic
#1
Posted 11 May 2005 - 01:55 PM
Hey
I created a Member system for my site, here, and everytime I try to activate a test account, I get the following message:
Parse error: parse error, unexpected '/' in /home/tubbyani/public_html/activate.php on line 54
Anyone got any solutions? Post if you need the code to the pages to help etc.
See it for yourself if it helps. Just go here and register, get emailed the link and click to activate it, and I get that lame message.
Any help would be greatly appreciated thanks
I created a Member system for my site, here, and everytime I try to activate a test account, I get the following message:
Parse error: parse error, unexpected '/' in /home/tubbyani/public_html/activate.php on line 54
Anyone got any solutions? Post if you need the code to the pages to help etc.
See it for yourself if it helps. Just go here and register, get emailed the link and click to activate it, and I get that lame message.
Any help would be greatly appreciated thanks
#2
Posted 11 May 2005 - 02:05 PM
Show us the code for 'activate.php' and I'll help you point out what's wrong mate.
#3
Posted 11 May 2005 - 02:19 PM
Quote
<?php
include 'config.php';
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM Users WHERE Actkey = '$id' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
if(mysql_num_rows($query) > 0){
$user = $row['id'];
$do = mysql_query("UPDATE Users SET Activated = 1 WHERE id = '$user' LIMIT 1") or die(mysql_error());
$send = mail($row['Email'] , "Activation Confirmation" , "Thank you for activating your account, you are now fully registered and able to use our services.\n\nTo login, click the link below:\nhttp://www.tubbyanimations.com/login.php" , "FROM: auto@mailer.com");
if(($do)&&($send))
{
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="success">
<p>Activation successful! A confirmation email has been dispatched. You can now login!</p>
<p><a href="/login.php">Click here</a> to goto the login page.</p>
</div>';
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>We are sorry, there appears to be an error processing your activation. Please try again later.</p>
</div>';
}
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>Sorry, your activation code was incorrect. Please try again.</p>
</div>';
}
mysql_close($l);
include 'config.php';
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM Users WHERE Actkey = '$id' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
if(mysql_num_rows($query) > 0){
$user = $row['id'];
$do = mysql_query("UPDATE Users SET Activated = 1 WHERE id = '$user' LIMIT 1") or die(mysql_error());
$send = mail($row['Email'] , "Activation Confirmation" , "Thank you for activating your account, you are now fully registered and able to use our services.\n\nTo login, click the link below:\nhttp://www.tubbyanimations.com/login.php" , "FROM: auto@mailer.com");
if(($do)&&($send))
{
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="success">
<p>Activation successful! A confirmation email has been dispatched. You can now login!</p>
<p><a href="/login.php">Click here</a> to goto the login page.</p>
</div>';
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>We are sorry, there appears to be an error processing your activation. Please try again later.</p>
</div>';
}
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css">
<div id="error">
<p>Sorry, your activation code was incorrect. Please try again.</p>
</div>';
}
mysql_close($l);
That's what I got. Its from a Tut. from P2L.
#4
Posted 11 May 2005 - 02:39 PM
That can't be right, since there is no line 54. Are you sure you posted the right error?
#5
Posted 11 May 2005 - 02:46 PM
I copied and pasted it from the error message. Try it yourself
#6
Posted 11 May 2005 - 04:32 PM
Tubby, on May 11 2005, 04:46 PM, said:
I copied and pasted it from the error message. Try it yourself
#7
Posted 11 May 2005 - 11:44 PM
Yea, I must be in your config file. I did notice that you have a / before login.php, which is not needed.
#8
Posted 12 May 2005 - 09:45 AM
Edit: I fixed the Activation problem, so accounts can now be created and activated, but I'm now having problems logging in. Here's my login script, followed by the error message shown:
Login Script (login.php):
[quote]<?php
session_start();
include 'config.php';
if(isset($_POST['login']))
{
$username = trim(addslashes($_POST['username']));
$password = md5(trim($_POST['password']));
$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
// now we check if they are activated
if(mysql_num_rows($query) > 0)
{
if($row['Activated'] > 0)
{
$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];
header("Location: member.php");
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>
</body>
</html>
';
}
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
</div>
</body>
</html>
';
}
} else {
?>
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the login page</div><br>
<div id="main">
<p>You must login to view this page. Enter your username and password below and hit submit:</p>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<p>Username:<br>
<input name="username" type="text" Cid="username">
<p>Password:<br>
<input name="password" type="password" id="password">
</p>
<p>
<input name="login" type="submit" id="login" value="Submit">
</p>
</form>
<p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
<p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>
</div>
</div>
</body>
</html>
<? } mysql_close($l); ?>[/quote]
Error Message recieved after attempting to log in:
[quote]Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/tubbyani/public_html/login.php:9) in /home/tubbyani/public_html/login.php on line 10
Warning: Cannot modify header information - headers already sent by (output started at /home/tubbyani/public_html/login.php:9) in /home/tubbyani/public_html/login.php on line 35[/quote]
Any help would once again be greatly appreciated
Login Script (login.php):
[quote]<?php
session_start();
include 'config.php';
if(isset($_POST['login']))
{
$username = trim(addslashes($_POST['username']));
$password = md5(trim($_POST['password']));
$query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query);
// now we check if they are activated
if(mysql_num_rows($query) > 0)
{
if($row['Activated'] > 0)
{
$_SESSION['s_logged_n'] = 'true';
$_SESSION['s_username'] = $username;
$_SESSION['s_name'] = $row['Name'];
header("Location: member.php");
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div>
</body>
</html>
';
}
} else {
echo '
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p>
<p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
</div>
</body>
</html>
';
}
} else {
?>
<html>
<head>
<title>Login</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the login page</div><br>
<div id="main">
<p>You must login to view this page. Enter your username and password below and hit submit:</p>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<p>Username:<br>
<input name="username" type="text" Cid="username">
<p>Password:<br>
<input name="password" type="password" id="password">
</p>
<p>
<input name="login" type="submit" id="login" value="Submit">
</p>
</form>
<p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>
<p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p>
</div>
</div>
</body>
</html>
<? } mysql_close($l); ?>[/quote]
Error Message recieved after attempting to log in:
[quote]Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/tubbyani/public_html/login.php:9) in /home/tubbyani/public_html/login.php on line 10
Warning: Cannot modify header information - headers already sent by (output started at /home/tubbyani/public_html/login.php:9) in /home/tubbyani/public_html/login.php on line 35[/quote]
Any help would once again be greatly appreciated
#9
Posted 13 May 2005 - 02:20 AM
Right at the top of the page, before anything else, put:
That should stop the header errors.
<?php ob_start(); ?>
That should stop the header errors.
#10
Posted 13 May 2005 - 11:13 AM
Ok, Thanks a lot
#11
Posted 13 May 2005 - 11:25 AM
Nope, its still not happy when I attempt to log in
#12
Posted 22 May 2005 - 04:03 AM
how many times do you have session_start in the page... is it in any included pages aswell?
#13
Posted 22 May 2005 - 01:07 PM
why so much code for a login script?
#14
Posted 02 June 2005 - 05:44 PM
I dont have any Session_script on any page on my site at all
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
