Jump to content

Recommended Posts

im just a beginner in php and dw..im doing a site and

i actually setting my log in page in dreamweaver

and i made it easily but when i try to run it theres an error..

im trying to find the error but still i cant find it!pls help me..i need to make

this site for our thesis..pls help me.. this is the code......

thank you!also i want to know if my codes are correct..i dont have any experience in php and mysql thats why it was hard for me to find the errors thanks! :-[

 

<?php ('connection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = 

"") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string

($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}


mysql_select_db($database_connection, $connection);
$query_rsLog = "SELECT * FROM users WHERE users.username=users.password";
$rsLog = mysql_query($query_rsLog, $connection) or die(mysql_error());
$row_rsLog = mysql_fetch_assoc($rsLog);
$totalRows_rsLog = mysql_num_rows($rsLog);
?><?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 = "access_level";
  $MM_redirectLoginSuccess = "/for women/home.php";
  $MM_redirectLoginFailed = "/for women/account.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_connection, $connection);
  	
  $LoginRS__query=sprintf("SELECT username, password, access_level FROM users WHERE 

username=%s AND password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $connection) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'access_level');
    
    //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=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
body {
background-color: #00FFFF;
background-image: url(g);
}
s {
}
-->
</style>

<style type="text/css">
<!--
a:hover {
color: #FF66FF;
}
-->
</style>
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --><style 

type="text/css">
<!--
.style5 {
font-family: "Adobe Garamond Pro Bold";
color: #66FF66;
font-weight: bold;
}
.style6 {font-size: 24px}
-->
</style></head>

<body>
<p align="center"> </p>
<table width="643" height="210" border="2" align="center">
  <tr>
    <td background="pictures/banner2.jpg" bgcolor="#FF00FF"><blockquote>
      <ul id="MenuBar1" class="MenuBarVertical">
        <li>
          <div align="center"><a href="#home.php">Home</a> </div>
        </li>
        <li>
          <div align="center"><a href="#account.php">My Account</a></div>
        </li>
        <li>
          <div align="center"><a href="#us.php">About Us</a> </div>
        </li>
        <li>
          <div align="center"><a href="#contact.php">Contact </a></div>
        </li>
      </ul>
</blockquote></td>
  </tr>
</table>
<p> </p>
<p> </p>
<table width="700" border="2" align="center">
  <tr>
    <td bgcolor="#000000"><table width="287" border="2">
      <tr>
        <td height="22" bgcolor="#FF00FF"><div align="center" class="style5">
          <p class="style6">Registered Customer?</p>
          <p class="style6">Username</p>
          <form action="<?php echo $loginFormAction; ?>" method="POST" name="form1" 

target="_self" id="form1">
            <label>
              <input name="username" type="text" id="username" maxlength="50" />
              </label>
            <p class="style6">Password</p>
            <p>
              <label>
              <input name="password" type="password" id="password" maxlength="50" />
              </label>
            </p>
            <p> </p>
            <p>
              <label>
              <input type="submit" name="submit" id="submit" value="Submit"/>
              </label>
            </p>
          </form>
          <p class="style6"> </p>
          <p class="style6"> </p>
          <p class="style6"> </p>
        </div></td>
      </tr>
    </table>
      <table width="195" border="2">
        <tr>
          <td width="183"> </td>
        </tr>
      </table>  
      <blockquote>
      <blockquote>
        <p> </p>
      </blockquote>
    </blockquote></td>
  </tr>
</table>
<p> </p>
<script type="text/javascript">

var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", 

{imgRight:"/SpryAssets/SpryMenuBarRightHover.gif"});

</script>
<?php
mysql_free_result($rsLog);

</body>
</html>
<?php ('connection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = 

"") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string

($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}


mysql_select_db($database_connection, $connection);
$query_rsLog = "SELECT * FROM users WHERE users.username=users.password";
$rsLog = mysql_query($query_rsLog, $connection) or die(mysql_error());
$row_rsLog = mysql_fetch_assoc($rsLog);
$totalRows_rsLog = mysql_num_rows($rsLog);
?><?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 = "access_level";
  $MM_redirectLoginSuccess = "/for women/home.php";
  $MM_redirectLoginFailed = "/for women/account.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_connection, $connection);
  	
  $LoginRS__query=sprintf("SELECT username, password, access_level FROM users WHERE 

username=%s AND password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $connection) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'access_level');
    
    //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=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
body {
background-color: #00FFFF;
background-image: url(g);
}
s {
}
-->
</style>

<style type="text/css">
<!--
a:hover {
color: #FF66FF;
}
-->
</style>
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --><style 

type="text/css">
<!--
.style5 {
font-family: "Adobe Garamond Pro Bold";
color: #66FF66;
font-weight: bold;
}
.style6 {font-size: 24px}
-->
</style></head>

<body>
<p align="center"> </p>
<table width="643" height="210" border="2" align="center">
  <tr>
    <td background="pictures/banner2.jpg" bgcolor="#FF00FF"><blockquote>
      <ul id="MenuBar1" class="MenuBarVertical">
        <li>
          <div align="center"><a href="#home.php">Home</a> </div>
        </li>
        <li>
          <div align="center"><a href="#account.php">My Account</a></div>
        </li>
        <li>
          <div align="center"><a href="#us.php">About Us</a> </div>
        </li>
        <li>
          <div align="center"><a href="#contact.php">Contact </a></div>
        </li>
      </ul>
</blockquote></td>
  </tr>
</table>
<p> </p>
<p> </p>
<table width="700" border="2" align="center">
  <tr>
    <td bgcolor="#000000"><table width="287" border="2">
      <tr>
        <td height="22" bgcolor="#FF00FF"><div align="center" class="style5">
          <p class="style6">Registered Customer?</p>
          <p class="style6">Username</p>
          <form action="<?php echo $loginFormAction; ?>" method="POST" name="form1" 

target="_self" id="form1">
            <label>
              <input name="username" type="text" id="username" maxlength="50" />
              </label>
            <p class="style6">Password</p>
            <p>
              <label>
              <input name="password" type="password" id="password" maxlength="50" />
              </label>
            </p>
            <p> </p>
            <p>
              <label>
              <input type="submit" name="submit" id="submit" value="Submit"/>
              </label>
            </p>
          </form>
          <p class="style6"> </p>
          <p class="style6"> </p>
          <p class="style6"> </p>
        </div></td>
      </tr>
    </table>
      <table width="195" border="2">
        <tr>
          <td width="183"> </td>
        </tr>
      </table>  
      <blockquote>
      <blockquote>
        <p> </p>
      </blockquote>
    </blockquote></td>
  </tr>
</table>
<p> </p>
<script type="text/javascript">

var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", 

{imgRight:"/SpryAssets/SpryMenuBarRightHover.gif"});

</script>
<?php
mysql_free_result($rsLog);

</body>
</html>
?>

Link to comment
https://forums.phpfreaks.com/topic/145098-i-dont-know-whats-the-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.