Jump to content


This topic is now archived and is closed to further replies.


DreamWeaver login php/mysql

Recommended Posts


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/xhtml1/DTD/xhtml1-transitional.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.



Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.