Forums

PHP

This topic is locked

query string

Posted 02 Jan 2002 10:35:50
1
has voted
02 Jan 2002 10:35:50 matt harris posted:
I'm new to PHP and have a simple validation that I want to implement on the log in screen of the admin section of the site - just a simple user name and password that matches those set in the database table.

I have the log in screen and the validation page with the following php :

<?php
$rsAdminLogin__varUser = "fdg";
if (isset(Request.Form("tfAdminUsername"))
{$rsAdminLogin__varUser = Request.Form("tfAdminUsername";}
?>
<?php
$rsAdminLogin__varPass = "sdfg";
if (isset(Request.form(tfAdminPassword"))
{$rsAdminLogin__varPass = Request.form(tfAdminPassword";}
?>
<?php
$rsAdminLogin=$php_conn->Execute("SELECT * FROM admin_entrance WHERE admin_user='" . ($rsAdminLogin__varUser) . "' AND admin_pass='" . ($rsAdminLogin__varPass) . "'" or DIE($php_conn->ErrorMsg());
$rsAdminLogin_numRows=0;
$rsAdminLogin__totalRows=$rsAdminLogin->RecordCount();
?>

however when I enter any details in the log in I get this response :
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /home/wisefox/public_html/admin/admin_validation.php on line 11

I expect i'm getting my syntax mixed up with ASP but I haven't found a work around yet - BTW I set up the validation recordset through phakt and on running a test it returns the correct results and appears to be working fine.

matt

<html>

Replies

Replied 03 Jan 2002 10:21:01
03 Jan 2002 10:21:01 Tim Green replied:
Unfortunately you are combining PHP code with ASP terminology within that code, and that will never work.

Here is the corrected version of your code:-

<?php
$rsAdminLogin__varUser = "fdg";
if (isset($HTTP_POST_VARS["tfAdminUsername"]))
{$rsAdminLogin__varUser = $HTTP_POST_VARS["tfAdminUsername"];}
?>
<?php
$rsAdminLogin__varPass = "sdfg";
if (isset($HTTP_POST_VARS["tfAdminPassword"]))
{$rsAdminLogin__varPass = $HTTP_POST_VARS["tfAdminPassword"];}
?>
<?php
$rsAdminLogin=$php_conn->Execute("SELECT * FROM admin_entrance WHERE admin_user='" . ($rsAdminLogin__varUser) . "' AND admin_pass='" . ($rsAdminLogin__varPass) . "'" or DIE($php_conn->ErrorMsg());
$rsAdminLogin_numRows=0;
$rsAdminLogin__totalRows=$rsAdminLogin->RecordCount();
?>

Alternatively I would suggest that you use the standard User Authentication set of server behaviours, specifically designed for this when using the PHP Server Model.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic