Jump to content


DreamWeaver login php/mysql

  • Please log in to reply
No replies to this topic

#1 yandoo

  • Members
  • PipPipPip
  • Advanced Member
  • 472 posts

Posted 29 May 2006 - 03:34 PM


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'); ?>
// *** Validate request to login to this site.
if (!isset($_SESSION)) {

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];

if (isset($_POST['username'])) {
$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...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>



<div align="center">
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="400" border="0" cellspacing="0" cellpadding="3">
<td width="100">Username:</td>
<td><input name="username" type="text" id="username"></td>
<td width="100">Password:</td>
<td><input name="password" type="password" id="password"></td>
<td width="100">&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"></td>


Please help as im slightly confused.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users