473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP Error on Password Check (SQL Database)

Hi, I'm trying to get password recognition calling data froma table
called users('user_name' and 'user_password' using the below (bottom
of page) code.

However, I get the following warning from my browser

"Parse error: parse error, unexpected ';' in /data/members/paid/g/l/
glastonburytv.eu/htdocs/www/check_password.php3 on line 19

This is the line I have replaced my password with "MY PASSWORD"

Now I'm using the same connectivity activater (see line below) in
other pages
mysql_connect("localhost", "glastonburytv_eu", "MYPASSWORD")

Does anyone please have any ideas why I'm getting the error message on
the ";" (line 19)

(Full Code Below)
Thank You
--Sheik Ishmael

<html>
<head>
<title>Password Checking Script</title>
</head>
<body>
<?php
function print_form() {
?>
<form action="check_password.php3" method="POST">
<h3>Please Login</h3>
User Name: <input type="text" name="user_name">
<br>Password: <input type="password" name="password">
<input type="submit" name="submit" value="Login!">
</form>
<?
}

if(isset($submit)):
if(!$$db = mysql_connect("localhost", "glastonburytv_eu",
"MYPASSWORD"));
print("<h1>Can't Connect to the DB!</h1>\n");
else:
mysql_select_db("glastonburytv_eu_1");
endif;
$sql = "select * from users where user_name = '$user_name'";
$result = mysql_query($sql);
$row_count = mysql_num_rows($result);
if($row_count == 0):
?>
<h3>Wrong User Name! Try Again</h3>
<?
print_form();
else:
$row = mysql_fetch_array($result);
if($password != $row["user_password"]):
?>
<h3>Incorrect Password! Try Again</h3>
<?
print_form();
else:
?>
<h3>Password Accepted!</h3>
<?
endif;
endif;
else:
print_form();
endif;
?>
</body>
</html>

Jun 4 '07 #1
8 2023
Sheik Ishmael wrote:
Hi, I'm trying to get password recognition calling data froma table
called users('user_name' and 'user_password' using the below (bottom
of page) code.

However, I get the following warning from my browser

"Parse error: parse error, unexpected ';' in /data/members/paid/g/l/
glastonburytv.eu/htdocs/www/check_password.php3 on line 19

This is the line I have replaced my password with "MY PASSWORD"

Now I'm using the same connectivity activater (see line below) in
other pages
mysql_connect("localhost", "glastonburytv_eu", "MYPASSWORD")

Does anyone please have any ideas why I'm getting the error message on
the ";" (line 19)

(Full Code Below)
Thank You
--Sheik Ishmael

<html>
<head>
<title>Password Checking Script</title>
</head>
<body>
<?php
function print_form() {
?>
<form action="check_password.php3" method="POST">
<h3>Please Login</h3>
User Name: <input type="text" name="user_name">
<br>Password: <input type="password" name="password">
<input type="submit" name="submit" value="Login!">
</form>
<?
}

if(isset($submit)):
if(!$$db = mysql_connect("localhost", "glastonburytv_eu",
"MYPASSWORD"));
print("<h1>Can't Connect to the DB!</h1>\n");
else:
mysql_select_db("glastonburytv_eu_1");
endif;
$sql = "select * from users where user_name = '$user_name'";
$result = mysql_query($sql);
$row_count = mysql_num_rows($result);
if($row_count == 0):
?>
<h3>Wrong User Name! Try Again</h3>
<?
print_form();
else:
$row = mysql_fetch_array($result);
if($password != $row["user_password"]):
?>
<h3>Incorrect Password! Try Again</h3>
<?
print_form();
else:
?>
<h3>Password Accepted!</h3>
<?
endif;
endif;
else:
print_form();
endif;
?>
</body>
</html>
if statements do not have semicolons at the end of the conditional
clause. And btw, else doesn't have a colon, either.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 4 '07 #2
Thanks Jerry

I'm working from template code downloaded from
http://authors.phptr.com/essential/php/chapter8.html

Is this code now out of date? Or just wrong?

Eager to know as I'm using this book to learn from.

best
--Sheik Ishmael
if statements do not have semicolons at the end of the conditional
clause. And btw, else doesn't have a colon, either.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -

Jun 4 '07 #3
Sheik Ishmael wrote:
Thanks Jerry

I'm working from template code downloaded from
http://authors.phptr.com/essential/php/chapter8.html

Is this code now out of date? Or just wrong?

Eager to know as I'm using this book to learn from.

best
--Sheik Ishmael
>if statements do not have semicolons at the end of the conditional
clause. And btw, else doesn't have a colon, either.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================- Hide quoted text -

- Show quoted text -

I guess those are colons, not semicolons. It was hard to tell here.

And no, that code is not out of date. AFAIK it was never correct in any
version of PHP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 4 '07 #4
Really Strange

The code is exactly what is reproduced in the book "Essential PHP for
Web Developers".

--SI
Jun 4 '07 #5
Sheik Ishmael wrote:
Really Strange

The code is exactly what is reproduced in the book "Essential PHP for
Web Developers".

--SI

That could be. But it also doesn't mean the cod is correct.

I don't have a copy of the book, so I can't say one way or the other.
But I do know the code you posted is incorrect. I can only assume from
what you're saying that the book is incorrect, also.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 4 '07 #6
Message-ID: <Eb******************************@comcast.comfro m Jerry
Stuckle contained the following:
>That could be. But it also doesn't mean the cod is correct.
Yeah, it's very fishy.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jun 4 '07 #7
At Mon, 04 Jun 2007 05:09:03 -0700, Sheik Ishmael let h(is|er) monkeys
type:
Really Strange

The code is exactly what is reproduced in the book "Essential PHP for
Web Developers".

--SI
I don't recall : ever being syntactically correct following an if () or
else. But even if it ever was, it isn't anymore. The online source is
wrong. Besides your copy here isn't a 100% copy of the one in the page you
referred to, you put a ; where the code has a :

It probably works if you remove all the : following if/elses, but I'd have
my doubts about the dubious quality of the work altogether and find
something better.

All code was written when php3 was standard. We're at 5 now, you will find
many version 4 scripts and hosts, but no php3 ones anymore. (Now someone
probably shows me a link to a host using php3 or even older....)

www.php.net is a good starting point.

--
Schraalhans Keukenmeester - sc*********@the.Spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"

Jun 4 '07 #8
On Jun 4, 12:59 pm, Schraalhans Keukenmeester
<Schraalh...@the.spamtrapexample.nlwrote:
At Mon, 04 Jun 2007 05:09:03 -0700, Sheik Ishmael let h(is|er) monkeys
type:
Really Strange
The code is exactly what is reproduced in the book "Essential PHP for
Web Developers".
--SI

I don't recall : ever being syntactically correct following an if () or
else. But even if it ever was, it isn't anymore. The online source is
wrong. Besides your copy here isn't a 100% copy of the one in the page you
referred to, you put a ; where the code has a :

It probably works if you remove all the : following if/elses, but I'd have
my doubts about the dubious quality of the work altogether and find
something better.

All code was written when php3 was standard. We're at 5 now, you will find
many version 4 scripts and hosts, but no php3 ones anymore. (Now someone
probably shows me a link to a host using php3 or even older....)

www.php.netis a good starting point.

--
Schraalhans Keukenmeester - schraalh...@the.Spamtrapexample.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples','oranges') < 0"
Actually, the colon thing is perfectly acceptable syntax.

if (condition):

else:

endif;

Is valid PHP code. It also works for switch, while, for, foreach, etc.

http://www.phpbuilder.com/manual/en/...ive-syntax.php

"was never valid", indeed.

~A!

Jun 5 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
0
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type...
8
by: John | last post by:
Hello. I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running...
7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
5
by: Rafael Faria | last post by:
Hello All, I'm new to DB2, so apologies in advance for any stupid comments I might make on this replication problem. Using Information integrator and DB2 8.2 I managed to create a nickname that...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
6
by: Chris Love | last post by:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not...
3
by: amatuer | last post by:
ADODB.Recordset error '800a0cb3' Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. /devag/newProjSave.asp, line 321 ...
3
by: Ted | last post by:
In WSAT, I get the following error when trying to set up my provider: Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.