GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Apr-2008, 10:32
oggie oggie is offline
Awaiting Email Confirmation
 
Join Date: Nov 2007
Location: tattershall, UK
Posts: 28
oggie is on a distinguished road
Smile

Getting a line error in register


This is the code I have done but I am getting a line error when I upload it.

This the line error:
Parse error: syntax error, unexpected '}' in /home/ogl10b7/public_html/EricsCarRepairs/register.php on line 79

I have loked at line 79 and cannot understand why it is coming up with this.

Any correction to this will be most grateful.

PHP Code:

<?php # register.php
// This is the registration page for the site.
 
// Include the config file for error management and such.
require_once ('./includes/config.inc.php');
 
// Set the page title and include the HTML header.
$page_title = 'Register';
include ('./includes/header.html');
 
if (isset($_POST['submitted'])) { // Handle the form.
 
require_once ('../mysql_connect.php'); // Connect to the database.
 
// Check for a fisrt name.
if (ergi ('^[[:alpha:]\.\'\-]{2,15}$', stripslashes(trim($_POST['first_name'])))) {
$fn = escape_data($_POST['first_name']);
} else {
$fn = FALSE;
echo '<p><font color="red" size="+1">Please enter your first name!</font></p>';
}
 
// Check for a last name.
if (ergi ('^[[:alpaha:}\.\'\-]{2,30}$', stripslashes(trim($_POST['last_name'])))) {
$ln = escape_data($_POST['last_name']);
} else {
$ln = FALSE;
echo '<p><font color="red" size="+1">Please enter your last name!</font></p>';
}
 
// Check for an email address.
if (ergi('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($POST['email'])))) {
$e = escape_data($_POST['email']);
} else {
$e = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>';
}
 
// Check for a password and math against the conforme password.
if (ergi('^[[:alnum:]]{4,20}$', stripslashes(trim($_POST['password1'])))) {
if ($_POST['password1'] == $_POST['password2']) { 
$p = escape_data($_POST['password1']);
} else {
$p = FALSE;
echo '<p><font color="red" size="+1">Your password did not match the confirmed password!</font></p>';
}
} else {
$p = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid password!</font></p>';
}
 
if ($fn && $ln && $e && $p) { // If everything's OK.
 
// Make sure the email address is available.
$query = "SELECT user_id FROM register WHERE email='$e'";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL ERROR: " . mysql_error());
 
if (mysql_num_rows($result) == 0) { // Available.
 
// Create the activation code.
$a = md5(uniqid(rand(), true));
 
// Add the user.
$query = "INSERT INTO register (email, pass, first_name, last_name, active, registration_date) VALUES ('$e', SHA('$p'), '$fn', '$ln', '$a', NOW()";
$result = mysql_query ($query) or trigger_error("QUERY: $query\n<br />MySQL ERROR:" . mysql_error());
 
if (mysql_affected_rows() == 1) { // If it ran OK.
 
// Send the email.
$body = "Thankyou for registering. To activate your account, please click on this link:\n\n";
$body .="http://www.whateveraddressyouwantthere.com/activate.php?x=" . mysql_insert_id() . "&y=$a";
mail($_POST['email'],'Registration confirmation',$body);
 
// Finish the page.
echo '<h3>Thankyou for registering! A confirmation email has been sent to your address. Please click on the link in that the email in order to activate your account.</h3>';
include ('.includes/footer.html'); // Include the HTML footer.
exit ()
 
} else { // If it did not run OK.
echo '<p><font color="red" size="+1">You could not be registerd due to a system error. We apologize for any inconvenience.</font></p>';
}
 
} else { // The email address is not available.
echo '<p><font color="red" size="+1"> That email has already been registered. If you have forgotten your password, use the link to have your password sent to you.</font></p>';
}
 
} else { // If one of the data testa failed.
echo '<p><font color="red" size="+1">Please try again.</font></p>';
}
 
mysql_close(); // Close the database connection.
 
} // End of the main submit conditional.
?>
 
<h1>Register</h1>
<form action="register.php" method="post">
<fieldset>
 
<p><b>First Name:</b> <input type="text" name="first_name" size="15" maxlength="15" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /> </p>
 
<p><b>Last Name:</b> <input type="text" name="last_name" size="30" maxlength="30" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /> </p>
 
<p><b>Email:</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> </p>
 
<p><b>Password:</b> <input type="password" name="password1" size="20" maxlength="20" /><small>Use only letters and numbers. Must be between 4 and 20 characters long</small></p>
 
<p><b>Confirm Password:</b> <input type="password" name="password2" size="20" maxlength="20" /></p>
</fieldset>
 
<div align="center"><input type="submit" name="submit" value="Register" /></div>
<input type="hidden" name="submitted" value="TRUE" />
 
</form>
 
<?PHP // Include the HTML footer.
include ('./includes/footer.html')
?>



Thanx

Ian
Last edited by admin II : 14-Apr-2008 at 04:52. Reason: Please surround your PHP code with [php] your code [/php]
  #2  
Old 13-Apr-2008, 11:36
TurboPT's Avatar
TurboPT TurboPT is online now
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,124
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Getting a line error in register


The error is NOT always exactly where it (the parser) has complained. That is just a 'best guess' location as it was parsing.

So, as a hint, carefully look back around line 77 and see what is missing.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 13-Apr-2008, 12:01
oggie oggie is offline
Awaiting Email Confirmation
 
Join Date: Nov 2007
Location: tattershall, UK
Posts: 28
oggie is on a distinguished road

Re: Getting a line error in register


Hi,

Thanks forr that it was missing a ; on line 77.

It does work but why is it still coming up with the below error??

Ian

This is the header.html page:

PHP Code:

<?php # header.html
// This page begins the HTML header for the site.
 
// start output buffering.
ob_start();
// Initialise a session.
session_start(); [color=red]THIS IS LINE 7[/color]
 
// Check for a $page_title value.
if (!isset($page_title)) {
$page_title = 'Register';
}
?>
<!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" xml:lang="en"> 
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title><?php echo $page_title; ?>
</title>
<style type="text/css" media="screen"> @import url(./includes/layout.css);</style>
</head> 
 
<body>
<div id="Header">User Registration</div>
<div id="Content">


Code:
An error occurred in script '/home/ogl10b7/public_html/EricsCarRepairs/includes/header.html' on line 7: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/ogl10b7/public_html/EricsCarRepairs/includes/config.inc.php:42) Date/Time: 4-13-200818:04:34 Array ( [GLOBALS] => Array *RECURSION* [_ENV] => Array ( [PATH] => /usr/local/bin:/usr/bin:/bin [PWD] => / [LANG] => C [SHLVL] => 1 [_] => /usr/sbin/apache2 ) [HTTP_ENV_VARS] => Array ( [PATH] => /usr/local/bin:/usr/bin:/bin [PWD] => / [LANG] => C [SHLVL] => 1 [_] => /usr/sbin/apache2 ) [_POST] => Array ( ) [HTTP_POST_VARS] => Array ( ) [_GET] => Array ( ) [HTTP_GET_VARS] => Array ( ) [_COOKIE] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) [_SERVER] => Array ( [HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* [HTTP_REFERER] => loki.computing.boston.ac.uk [HTTP_ACCEPT_LANGUAGE] => en-gb [HTTP_UA_CPU] => x86 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2) [HTTP_HOST] => loki.computing.boston.ac.uk [HTTP_CONNECTION] => Keep-Alive [PATH] => /usr/local/bin:/usr/bin:/bin [SERVER_SIGNATURE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 Server at loki.computing.boston.ac.uk Port 80 [SERVER_SOFTWARE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 [SERVER_NAME] => loki.computing.boston.ac.uk [SERVER_ADDR] => 217.40.221.251 [SERVER_PORT] => 80 [REMOTE_ADDR] => 86.162.15.192 [DOCUMENT_ROOT] => /var/www/ [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /home/ogl10b7/public_html/EricsCarRepairs/register.php [REMOTE_PORT] => 64984 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /~ogl10b7/EricsCarRepairs/register.php [SCRIPT_NAME] => /~ogl10b7/EricsCarRepairs/register.php [PHP_SELF] => /~ogl10b7/EricsCarRepairs/register.php [REQUEST_TIME] => 1208106274 [argv] => Array ( ) [argc] => 0 ) [HTTP_SERVER_VARS] => Array ( [HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* [HTTP_REFERER] => http://loki.computing.boston.ac.uk/~ogl10b7/EricsCarRepairs/index.php [HTTP_ACCEPT_LANGUAGE] => en-gb [HTTP_UA_CPU] => x86 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2) [HTTP_HOST] => loki.computing.boston.ac.uk [HTTP_CONNECTION] => Keep-Alive [PATH] => /usr/local/bin:/usr/bin:/bin [SERVER_SIGNATURE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 Server at loki.computing.boston.ac.uk Port 80 [SERVER_SOFTWARE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 [SERVER_NAME] => loki.computing.boston.ac.uk [SERVER_ADDR] => 217.40.221.251 [SERVER_PORT] => 80 [REMOTE_ADDR] => 86.162.15.192 [DOCUMENT_ROOT] => /var/www/ [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /home/ogl10b7/public_html/EricsCarRepairs/register.php [REMOTE_PORT] => 64984 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /~ogl10b7/EricsCarRepairs/register.php [SCRIPT_NAME] => /~ogl10b7/EricsCarRepairs/register.php [PHP_SELF] => /~ogl10b7/EricsCarRepairs/register.php [REQUEST_TIME] => 1208106274 [argv] => Array ( ) [argc] => 0 ) [_FILES] => Array ( ) [HTTP_POST_FILES] => Array ( ) [_REQUEST] => Array ( ) [live] => [email] => InsertRealAddressHere [page_title] => Register [HTTP_SESSION_VARS] => Array ( ) [_SESSION] => Array ( ) ) An error occurred in script '/home/ogl10b7/public_html/EricsCarRepairs/includes/header.html' on line 7: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/ogl10b7/public_html/EricsCarRepairs/includes/config.inc.php:42) Date/Time: 4-13-200818:04:34 Array ( [GLOBALS] => Array *RECURSION* [_ENV] => Array ( [PATH] => /usr/local/bin:/usr/bin:/bin [PWD] => / [LANG] => C [SHLVL] => 1 [_] => /usr/sbin/apache2 ) [HTTP_ENV_VARS] => Array ( [PATH] => /usr/local/bin:/usr/bin:/bin [PWD] => / [LANG] => C [SHLVL] => 1 [_] => /usr/sbin/apache2 ) [_POST] => Array ( ) [HTTP_POST_VARS] => Array ( ) [_GET] => Array ( ) [HTTP_GET_VARS] => Array ( ) [_COOKIE] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) [_SERVER] => Array ( [HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* [HTTP_REFERER] => http://loki.computing.boston.ac.uk/~ogl10b7/EricsCarRepairs/index.php [HTTP_ACCEPT_LANGUAGE] => en-gb [HTTP_UA_CPU] => x86 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2) [HTTP_HOST] => loki.computing.boston.ac.uk [HTTP_CONNECTION] => Keep-Alive [PATH] => /usr/local/bin:/usr/bin:/bin [SERVER_SIGNATURE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 Server at loki.computing.boston.ac.uk Port 80 [SERVER_SOFTWARE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 [SERVER_NAME] => loki.computing.boston.ac.uk [SERVER_ADDR] => 217.40.221.251 [SERVER_PORT] => 80 [REMOTE_ADDR] => 86.162.15.192 [DOCUMENT_ROOT] => /var/www/ [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /home/ogl10b7/public_html/EricsCarRepairs/register.php [REMOTE_PORT] => 64984 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /~ogl10b7/EricsCarRepairs/register.php [SCRIPT_NAME] => /~ogl10b7/EricsCarRepairs/register.php [PHP_SELF] => /~ogl10b7/EricsCarRepairs/register.php [REQUEST_TIME] => 1208106274 [argv] => Array ( ) [argc] => 0 ) [HTTP_SERVER_VARS] => Array ( [HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* [HTTP_REFERER] => http://loki.computing.boston.ac.uk/~ogl10b7/EricsCarRepairs/index.php [HTTP_ACCEPT_LANGUAGE] => en-gb [HTTP_UA_CPU] => x86 [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2) [HTTP_HOST] => loki.computing.boston.ac.uk [HTTP_CONNECTION] => Keep-Alive [PATH] => /usr/local/bin:/usr/bin:/bin [SERVER_SIGNATURE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 Server at loki.computing.boston.ac.uk Port 80 [SERVER_SOFTWARE] => Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_jk/1.2.18 PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 [SERVER_NAME] => loki.computing.boston.ac.uk [SERVER_ADDR] => 217.40.221.251 [SERVER_PORT] => 80 [REMOTE_ADDR] => 86.162.15.192 [DOCUMENT_ROOT] => /var/www/ [SERVER_ADMIN] => webmaster@localhost [SCRIPT_FILENAME] => /home/ogl10b7/public_html/EricsCarRepairs/register.php [REMOTE_PORT] => 64984 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /~ogl10b7/EricsCarRepairs/register.php [SCRIPT_NAME] => /~ogl10b7/EricsCarRepairs/register.php [PHP_SELF] => /~ogl10b7/EricsCarRepairs/register.php [REQUEST_TIME] => 1208106274 [argv] => Array ( ) [argc] => 0 ) [_FILES] => Array ( ) [HTTP_POST_FILES] => Array ( ) [_REQUEST] => Array ( ) [live] => [email] => InsertRealAddressHere [page_title] => Register [HTTP_SESSION_VARS] => Array ( ) [_SESSION] => Array ( ) )
Last edited by admin II : 14-Apr-2008 at 04:55. Reason: Please surround your PHP code with [php] your code [/php]
  #4  
Old 13-Apr-2008, 12:17
TurboPT's Avatar
TurboPT TurboPT is online now
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,124
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Getting a line error in register


See your other post, I gave a link to info. that might help that session problem.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #5  
Old 13-Apr-2008, 13:31
oggie oggie is offline
Awaiting Email Confirmation
 
Join Date: Nov 2007
Location: tattershall, UK
Posts: 28
oggie is on a distinguished road

Re: Getting a line error in register


Hi,

I have had a look at the previous post you sent. But cannot see a link you said you posted on your last post.

Ian
  #6  
Old 13-Apr-2008, 17:16
TurboPT's Avatar
TurboPT TurboPT is online now
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,124
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Getting a line error in register


click here for the other post
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! Problems encountered while burning CD's RayDarkness Computer Software Forum - Windows 1 18-Nov-2006 05:54
getting an error while compiling and running using different IDE. jaro C Programming Language 0 25-Aug-2006 10:14
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 11:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 12:28
CD Buring Failed skanth2000 Computer Hardware Forum 1 15-Nov-2003 04:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:23.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.