yandoo Posted May 29, 2006 Share Posted May 29, 2006 Hi, im new this DreamWeaver lark and am having few probs. Ive followed this tutorial: [a href=\"http://www.adesdesign.net/php/tutorials/dreamweaver/secure_login.php\" target=\"_blank\"]http://www.adesdesign.net/php/tutorials/dr...ecure_login.php[/a].Its basically creating a login using just usernames and password. ive connected the mysql database ok and added an entry using phpmyadmin as "admin" for username and "password" for password. My problem is that when i test it, entering the the username and password i get this follwowing error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Name='admin' AND Password='password'' at line 1..The following code is what is created by dreamweaver: <?php require_once('Connections/Net_Sol_Connection.php'); ?><?php// *** Validate request to login to this site.if (!isset($_SESSION)) { session_start();}$loginFormAction = $_SERVER['PHP_SELF'];if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck'];}if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "report.php"; $MM_redirectLoginFailed = "login.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_Net_Sol_Connection, $Net_Sol_Connection); $LoginRS__query=sprintf("SELECT username, password FROM login WHERE username='%s' AND password='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $Net_Sol_Connection) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); }}?><!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=iso-8859-1" /><title>Untitled Document</title></head><body><p> </p><br><br><div align="center"><form name="form1" method="POST" action="<?php echo $loginFormAction; ?>"><table width="400" border="0" cellspacing="0" cellpadding="3"><tr><td width="100">Username:</td><td><input name="username" type="text" id="username"></td></tr><tr><td width="100">Password:</td><td><input name="password" type="password" id="password"></td></tr><tr><td width="100"> </td><td><input type="submit" name="Submit" value="Submit"></td></tr></table></form></div></body></html>Please help as im slightly confused. Thanks Yandoo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.