Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using ph to create a password protection web site

Status
Not open for further replies.

rosesau

Programmer
May 24, 2001
9
AU
Hi,

ok this is a long one. i have created a password protection web page using asp. i have just found out that the web server does not support asp but do support php. so i am trying to convert the page to php. i am having a few problems. the page is trying to access a ms access database.

this is the code i have currently to which there is a problem in it.

<html>
<head>
<title>login.php3</title>
</head>
<body>
<SCRIPT language =&quot;php&quot;>

$UserName=$HTTP_POST_VARS[&quot;username&quot;];
$Password=$HTTP_POST_VARS[&quot;password&quot;];

$MyConn=odbc_connect(&quot;
$SQL=&quot;Select UserName, Password From tblLogin
_,Where UserName=$UserName,Password=$Password&quot;;

$RS_query=odbc_exec($MyConn,($SQL));
$RS_ptr=1;
$RS=odbc_fetch_row($RS_query,$RS_ptr++);

if (!($RS==0))
{

$allow_session=true;

header(&quot;Location: &quot;.&quot;Default.htm&quot;);
exit;
}
else
{

header(&quot;Location: &quot;.&quot;main.htm&quot;);
exit;

odbc_close($MyConn);
$RS=null;

$MyConn=null;

}
</script>
</html>

the problem seems to be with the $SQL statement and the $MyConn=odbc_connect..... statement. the errors that i am getting is as follows

Warning: Wrong parameter count for odbc_connect() in C:\Inetpub\ on line 11

Warning: Supplied argument is not a valid ODBC-Link resource in C:\Inetpub\ on line 16

Warning: Supplied argument is not a valid ODBC result resource in C:\Inetpub\ on line 18

Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\ in C:\Inetpub\ on line 31

does anyone have any ideas as to where i am going wrong. any help would be great.

Regards

Rose
 
wrong parameter count, means u have to set more parameters between the ():
use:
int odbc_connect (string dsn, string user, string password [, int cursor_type])

and dont forget user and password.
Second warning is because there is no result, and ure headers cant be sent cause the warnings have been send.

Fix the odbc_connect and u will be fine, tip: check if there is a result and then go on, (before row 16 ofcourse)

Good luck
MiQ
mick@vandermostvanspijk.nl
currently installed: html, JavaScript, dhtml, css, php, mysql, postgresql, xml, linux, apache
about to install: java, c++
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top