473,800 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Error on Password Check (SQL Database)

Hi, I'm trying to get password recognition calling data froma table
called users('user_nam e' 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.e u/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>Passwo rd Checking Script</title>
</head>
<body>
<?php
function print_form() {
?>
<form action="check_p assword.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($submi t)):
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($sq l);
$row_count = mysql_num_rows( $result);
if($row_count == 0):
?>
<h3>Wrong User Name! Try Again</h3>
<?
print_form();
else:
$row = mysql_fetch_arr ay($result);
if($password != $row["user_passw ord"]):
?>
<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 2053
Sheik Ishmael wrote:
Hi, I'm trying to get password recognition calling data froma table
called users('user_nam e' 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.e u/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>Passwo rd Checking Script</title>
</head>
<body>
<?php
function print_form() {
?>
<form action="check_p assword.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($submi t)):
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($sq l);
$row_count = mysql_num_rows( $result);
if($row_count == 0):
?>
<h3>Wrong User Name! Try Again</h3>
<?
print_form();
else:
$row = mysql_fetch_arr ay($result);
if($password != $row["user_passw ord"]):
?>
<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*******@attgl obal.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...@attgl obal.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...@attg lobal.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*******@attgl obal.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*******@attgl obal.net
=============== ===
Jun 4 '07 #6
Message-ID: <Eb************ *************** ***@comcast.com from 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 .Spamtrapexampl e.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...@th e.spamtrapexamp le.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 .Spamtrapexampl e.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
5041
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 double-checked the path to my error log. It is in /var/www/logs/php_error_log Thanks. :) -Wayne Stevenson
0
1193
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 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select database(); +------------+ | database() | +------------+
8
18471
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 locally with Apache 1.3.27 on Windows XP Pro. I seem to have finally got MySQL running after a lot of difficulty. In the book it says to type source C:\mysql\newland_tours.sql at the mysql> prompt, to generate the newland_tours database in my...
7
3418
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 are input in login screen. The password in the database is a number field. I am writing the dynamic sql statement as follows below. I believe I am going wrong in the password section of the code. I appreciate any help. Thanks. Regards.
5
5285
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 references a table sitting on an Oracle 10g Database on a different server. I can reference the nickname and retrieve all the information on that table from my DB2 instance. The plan now is to have a replica of that table on my DB2 instance. I
12
2795
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 both the iis and sql server in a single machine. Not too long ago, the machine had some hardware problems, and management has decided to purchase new servers, for both asp.net and sql server.
6
4958
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 allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) I get this the frist time I open an ASP.NEt 2.0 site on my development machine now. It started happening when I tried to use the...
3
616
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 sqlOCF = "SELECT * FROM DA_OtherCFacilities" set rstOCF = CreateObject("ADODB.Recordset")
3
13364
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 Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider. On Windows XP Pro, I am using MS Visual Studio 2005, and I am using the developer's edition of...
10
6982
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 of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.