SunQuest
 
           PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old March 20th, 2003, 02:12 AM
inthestars inthestars is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 inthestars User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Errors with php authentication script

I am getting this error with the script below:

Parse error: parse error, unexpected T_VARIABLE in /htdocs/users/authenticate.php on line 25

I don't see any extra characters, do you guys see any?


<?php

if ((!$username) || (!$password)) { print "Please fill out both entries."; exit;}



$db_name="tempagencyreviews";

$table_name="temp_user";

$connection = @mysql_connect("localhost", "xxxxx", "xxxxx") or die ("Couldn't connect.");

$db= @mysql_select_db($db_name, $connection) or die("Couldn't select database.");

$sql = "SELECT confirmed FROM temp_user WHERE username = '$username'";
$result = mysql_query("select confirmed from temp_user where username='$username'");
if (!$result)
return "Could not execute query";
if ($confirmed == 1) {
print "Your account has not been confirmed. <a href=\"/users/reconfirm.php\">Go here</a>";

exit;
}

$sql="select * from temp_user where username="$username" and password="$password"";

$result = @mysql_query($sql,$connection) or die "Couldn't execute query.");

$num = mysql_numrows($result);

if ($num=0) { $msg = "<p> Congratulations, you're authorized!</p>";} else {
echo "We were not able to authenticate your username. Did you forget your password
and username? <a href=\"/users/retrieve.php\">Retrieve it here</a>. "; exit; }

?>

Reply With Quote
  #2  
Old March 20th, 2003, 12:01 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Change this
PHP Code:
 $sql="select * from temp_user where username="$username" and password="$password""

To this:
PHP Code:
 $sql="select * from temp_user where username='$username' and password='$password'"


and also change this
PHP Code:
 $result = @mysql_query($sql,$connection) or die "Couldn't execute query."); 
To this:
PHP Code:
 $result = @mysql_query($sql,$connection) or die ("Couldn't execute query."); 
You forgot the first ( after die

Reply With Quote
  #3  
Old March 20th, 2003, 05:45 PM
inthestars inthestars is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 inthestars User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, that worked perfectly.. you're a godsend

Reply With Quote
  #4  
Old March 20th, 2003, 10:46 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 653 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 52 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Any time Glad it worked for you.

Did you notice the differences by the way? You can see the color differences in the code.. need to watch the quotes when doing queries..

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Errors with php authentication script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway