Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-02-2007, 06:35 PM   PM User | #1
xxdanielxx
New to the CF scene

 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
xxdanielxx is an unknown quantity at this point
Need Help with login page erro

Hi I am using dreamweaver as web tool and phpdev5 as testserver I already have them up and running. When I try to preview the login page I get a bunch of errors on the page this is the script i used any help would be grate. Also I entered the errors I get at the very end.

PHP Code:
<?php virtual('/Connections/db.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;
}
}
?><?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 "/index.html";
  
$MM_redirectLoginFailed "/login.php";
  
$MM_redirecttoReferrer false;
  
mysql_select_db($database_db$db);
  
  
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",
    
GetSQLValueString($loginUsername"text"), GetSQLValueString($password"text")); 
   
  
$LoginRS mysql_query($LoginRS__query$db) 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>
<style type="text/css">
<!--
#Layer1 {    position:absolute;
    left:70px;
    top:106px;
    width:637px;
    height:84px;
    z-index:1;
}
-->
</style>
</head>

<body>
<div id="Layer1">
  <div align="center">
    <form action="<?php echo $loginFormAction?>" method="POST" name="form1" id="form1">
      <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">&nbsp;</td>
          <td><input type="submit" name="Submit" value="Submit" /></td>
        </tr>
      </table>
    </form>
  </div>
</div>
</body>
</html>
Warning: Cannot send session cookie - headers already sent in c:\phpdev5\www\login.php on line 10

Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev5\www\login.php:10) in c:\phpdev5\www\login.php on line 10

Warning: open(/tmp\sess_3e99c8161c6f5b3f7912d40d6d20a9cd, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\login.php on line 10

Warning: open(/tmp\sess_3e99c8161c6f5b3f7912d40d6d20a9cd, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

Last edited by xxdanielxx; 02-02-2007 at 06:41 PM..
xxdanielxx is offline   Reply With Quote
Old 02-02-2007, 06:48 PM   PM User | #2
CFMaBiSmAd
Senior Coder

 
CFMaBiSmAd's Avatar
 
Join Date: Oct 2006
Location: Denver, Colorado USA
Posts: 2,712
Thanks: 2
Thanked 251 Times in 243 Posts
CFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the rough
There is a newline between the first closing ?> tag and the next opening <?php tag -
Code:
<?php virtual('/Connections/db.php'); ?>  <---- newline
<?php
This is being output to the browser and prevents any further headers for cookies/sessions/redirect... from being sent.

Repeatedly switching into and out of php mode by closing/opening tags where it does not serve any purpose, is poor programming practice.

The meaning of the session save path errors are given in the error messages...
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.
CFMaBiSmAd is offline   Reply With Quote
Old 02-05-2007, 02:16 PM   PM User | #3
SNC-Zach
New to the CF scene

 
Join Date: Sep 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
SNC-Zach is an unknown quantity at this point
Why are you making a virtual() call? Just use include() or require_once().
SNC-Zach is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:52 AM.


Advertisement
Log in to turn off these ads.