note 102635 added to function.odbc-connect
[email protected] Fri, 25 Feb 2011 04:05:16 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
ca you please help me with these codes? I am making a login page using ms access as the database
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
session_start();
$tbl_name="tbllogin";
$connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("C:\Users\SASHUU\Desktop\troll\DBstudent.mdb").";";
$conn=odbc_connect($connstr,'','')
or die("connect error: ".odbc_error());
// get passed parameters
$username=trim(stripslashes($_POST['username']));
$password=trim(stripslashes($_POST['password']));
$sql="SELECT * FROM $tbllogin WHERE username='$username' and password='$password'";
// prepare and execute in 1 statement
$result=odbc_exec($conn,$stmt)
or die ("result error ".odbc_error().'-'.odbc_errormsg());
// if no result: no rows read
if (!odbc_fetch_row($result))
die("Wrong Username or Password");
// else: all is okay
else {
$_SESSION['username']=$username;
$_SESSION['password']=$password;
header("form.html");
}
odbc_close($conn);
?>
</body>
</html>
----
Server IP: 69.147.83.197
Probable Submitter: 112.202.158.146
----
Manual Page -- http://www.php.net/manual/en/function.odbc-connect.php
Edit -- https://master.php.net/note/edit/102635
Del: integrated -- https://master.php.net/note/delete/102635/integrated
Del: useless -- https://master.php.net/note/delete/102635/useless
Del: bad code -- https://master.php.net/note/delete/102635/bad+code
Del: spam -- https://master.php.net/note/delete/102635/spam
Del: non-english -- https://master.php.net/note/delete/102635/non-english
Del: in docs -- https://master.php.net/note/delete/102635/in+docs
Del: other reasons-- https://master.php.net/note/delete/102635
Reject -- https://master.php.net/note/reject/102635
Search -- https://master.php.net/manage/user-notes.php