Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 02-16-2008, 08:53 PM
Private First Class
 
Join Date: Feb 2008
Posts: 7
Default php question

I keep geing an error on a log in script I am trying to execute-

Parse error: syntax error, unexpected '}' in /home/llllqubw/public_html/aftersolutions/register.php on line 53



- with the following script, line 53 is noted in the script, can someone help, new to php.
<?
session_start();
require ("dbts_asregister_config.php");
$username = $_SESSION[username];
$password = $_SESSION[password];
if ($dbts_username != $username or $dbts_password != $password){
$message = "Incorrect loggin!";
header("Location: dbts_users_loggin.php");
}
Line 53
$db = mysql_connect($db_host, $db_users, $db_password);
if ($db == FALSE)
die ("Connection Error. Please check parameters in the file config.php");
mysql_select_db($db_name, $db)
or die ("Database Selection Error. Please check parameters in the file config.php");
?>
<?php


//This code runs if the form has been submitted
if (isset($_POST['submit'])){
}
//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}
// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match.');
}
// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}
// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>

<h1>Registered</h1>
<p>Thank you, you have registered - you may now login</a>.</p>
<?php
}
else
{
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="10">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2" maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>
<?php
}
?>
I would greatly appreciate any help thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 02-16-2008, 09:17 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,643
Default Re: log in php problem

Will you post the complete script, that error can be caused by a mistake before or after line 53
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 02-16-2008, 09:33 PM
Private First Class
 
Join Date: Feb 2008
Posts: 7
Default Re: log in php problem

Here is a copy of the whole page - thank you



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="GENERATOR" content="Created by BlueVoda">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="bv_" style="position:absolute;left:0px;top:0px;width:12 72px;height:1401px;z-index:0" align="left">
<img src="bv01995.gif" id="Shape2" align="top" alt="" border="0" width="1272" height="1401"></div>
<img src="recruitmentblank (1020 x 222).jpg" id="Image2" alt="" align="top" border="0" width="1020" height="222" style="position:absolute;left:127px;top:42px;width :1020px;height:222px;z-index:1">
<div id="bv_" style="position:absolute;left:339px;top:98px;width :449px;height:24px;z-index:2" align="left">
<font style="font-size:21px" color="#000000" face="Arial"><b>Job Postings * Resume/Application Viewing</b></font></div>
<div id="bv_" style="position:absolute;left:334px;top:133px;widt h:451px;height:48px;z-index:3" align="left">
<font style="font-size:21px" color="#000000" face="Arial"><b>Recruitment Solutions * Retention Strategies</b></font></div>
<div id="bv_" style="position:absolute;left:351px;top:171px;widt h:417px;height:24px;z-index:4" align="left">
<font style="font-size:21px" color="#000000" face="Arial"><b>Career Counseling * Education * Training</b></font></div>
<div id="bv_" style="position:absolute;left:149px;top:259px;widt h:975px;height:36px;background-color:#FF04FF;z-index:5" align="left">
<table width="100%" border="5" cellpadding="1" cellspacing="3" bordercolor="#0000FF" id="Table2">
<tr>
<td align="left" valign="top" width="108" height="20">&nbsp;</td>
<td align="left" valign="top" width="116" height="20">&nbsp;</td>
<td align="left" valign="top" width="114" height="20">&nbsp;</td>
<td align="left" valign="top" width="108" height="20">&nbsp;</td>
<td align="left" valign="top" width="152" height="20">&nbsp;</td>
<td align="left" valign="top" width="108" height="20">&nbsp;</td>
<td align="left" valign="top" width="108" height="20">&nbsp;</td>
<td align="left" valign="top" width="124" height="20">&nbsp;</td>
</tr>
</table></div>
<div id="bv_" style="position:absolute;left:143px;top:373px;widt h:834px;height:480px;z-index:6" align="left">
<?
session_start();
require ("dbts_asregister_config.php");
$username = $_SESSION[username];
$password = $_SESSION[password];
if ($dbts_username != $username or $dbts_password != $password){
$message = "Incorrect loggin!";
header("Location: dbts_users_loggin.php");
}
$db = mysql_connect($db_host, $db_users, $db_password);
if ($db == FALSE)
die ("Connection Error. Please check parameters in the file config.php");
mysql_select_db($db_name, $db)
or die ("Database Selection Error. Please check parameters in the file config.php");
?>
<?php


//This code runs if the form has been submitted
if (isset($_POST['submit'])){
}
//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}
// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match.');
}
// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}
// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>

<h1>Registered</h1>
<p>Thank you, you have registered - you may now login</a>.</p>
<?php
}
else
{
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="10">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="pass2" maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>
<?php
}
?> </div>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 02-16-2008, 11:18 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,643
Default Re: log in php problem

It should be this line

PHP Code:
 if (isset($_POST['submit'])){

Make this
PHP Code:
if (isset($_POST['submit'])){ 
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 02-16-2008, 11:46 PM
Private First Class
 
Join Date: Feb 2008
Posts: 7
Default Re: log in php problem

Page came up with my banner but with no register form and new errors, I appreciate all your help on this, Im so tired of looking at this that I think its time to relax, and relook it tomorrow, I appreciate your help and I owe you one.







Page came up wWarning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/llllqubw/public_html/aftersolutions/register.php:10) in /home/llllqubw/public_html/aftersolutions/register.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at /home/llllqubw/public_html/aftersolutions/register.php:10) in /home/llllqubw/public_html/aftersolutions/register.php on line 40

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'llllqubw'@'localhost' (using password: YES) in /home/llllqubw/public_html/aftersolutions/register.php on line 43
Connection Error. Please check parameters in the file config.phpith my banner put no register form, new errors show-
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 02-16-2008, 11:51 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,643
Default Re: log in php problem

In this section of code
[php]
<?
session_start();
require ("dbts_asregister_config.php");
[/php

move this code

PHP Code:
session_start(); 
And place it at the very top. So the top will be
PHP Code:
<? session_start(); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
As far as the database connection make sure your username and password are correct, and that the username has access to the database
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 02-17-2008, 12:45 AM
Private First Class
 
Join Date: Feb 2008
Posts: 7
Default Re: log in php problem

same problem, I copied my config file eliminating usernames and passwords so you can see a copy

<?
$dbts_username="username";
$dbts_password="password";
$dbts_ownersite="http://www.aftersolutions.com";
$dbts_owneremail="info@aftersolutions.com";
$db_host="localhost";
$db_name="database_name";
$db_user="databease_username ";
$db_password="database_password";
?>

Again, thanks for the help, i owe you big time
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 02-17-2008, 12:49 AM
Private First Class
 
Join Date: Feb 2008
Posts: 7
Default Re: log in php problem

Skip last message, sorry system was a little slow moving along, have 2 new error messages:

Warning: Cannot modify header information - headers already sent by (output started at /home/llllqubw/public_html/aftersolutions/register.php:11) in /home/llllqubw/public_html/aftersolutions/register.php on line 41

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'llllqubw'@'localhost' (using password: YES) in /home/llllqubw/public_html/aftersolutions/register.php on line 44
Connection Error. Please check parameters in the file config.php



again thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old 02-17-2008, 05:11 PM
Watdaflip's Avatar
Brigadier General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 1,643
Default Re: log in php problem

Sorry didn't tell you the right thing to move (at least completely)

I assume you made the change so your code should have
PHP Code:
<? session_start(); ?>
at the top, replace that code with this code, which you need to move up from where it currently is
PHP Code:
 <? 
session_start
();
require (
"dbts_asregister_config.php");
$username $_SESSION[username];
$password $_SESSION[password];
if (
$dbts_username != $username or $dbts_password != $password){
$message "Incorrect loggin!";
header("Location: dbts_users_loggin.php");
  }
$db mysql_connect($db_host$db_users$db_password);
if (
$db == FALSE)
die (
"Connection Error. Please check parameters in the file config.php");
mysql_select_db($db_name$db)
or die (
"Database Selection Error. Please check parameters in the file config.php");
?>
And make sure you remove that code from where it is
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 12:18 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2007 VodaHost.com - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54