Jump to content

Getting error message that wasn't there before...


derekbelcher

Recommended Posts

I recently added a line of php code to a checklogin page and am getting some weird error:

 

 

Warning: session_register() [function.session-register]: open(/home/edlegs/tmp/sess_bc52abb2dba095cba858e0238af95f35, O_RDWR) failed: Permission denied (13) in /home/p2r71184/public_html/admin/checklogin.php on line 59

 

Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /home/p2r71184/public_html/admin/checklogin.php:59) in /home/p2r71184/public_html/admin/checklogin.php on line 59

 

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /home/p2r71184/public_html/admin/checklogin.php:59) in /home/p2r71184/public_html/admin/checklogin.php on line 59

 

Warning: Cannot modify header information - headers already sent by (output started at /home/p2r71184/public_html/admin/checklogin.php:59) in /home/p2r71184/public_html/admin/checklogin.php on line 63

 

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

 

Warning: Unknown: open(/home/edlegs/tmp/sess_bc52abb2dba095cba858e0238af95f35, O_RDWR) failed: Permission denied (13) in Unknown on line 0

 

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

 

Any ideas?

Link to comment
Share on other sites

It would be nice if you told us what line of code you added.

 

You have at least two problems -

 

1) The folder /home/edlegs/tmp/ does exist and is what session.save_path is set to but it does not have the proper permissions for php to create the session data files. This could either be due to an actual permission problem or session.save_path has been changed to a folder that is different from what it was.

 

2a) session_register() was depreciated long ago in php4.2 in the year 2002 and does not work when register_globals are off. session_register() and register_globals have been completely removed in php6. You must use $_SESSION variables instead.

 

2b) This error - Your script possibly relies on a session side-effect which existed until PHP 4.2.3... is only output when register_globals are off, which means that they are off, which they should be and that session_register() has no effect in your code.

Link to comment
Share on other sites

alright, i changed the session_register to $_SESSION.  That worked.  Now I can get to the "successful login page", however, the errors are still there at the top of the page.  It is finding a problem with the line that has this on it:

 

session_start()

 

I checked the spaces and additional characters and found none.  This is frustrating because I didn't change anything from last week and it worked fine then. 

 

Here is the complete code for the successful login page:

 

<?

 

session_start();

 

if(!session_is_registered(myusername)){

header("location:adminLogin.php");

}

 

ini_set("session.cookie_lifetime", "60")

 

?>

 

 

 

<?php $host="localhost"; // Host name

 

$username="p2r71184"; // Mysql username

 

$password="692134a"; // Mysql password

 

$db_name="p2r71184_regMembers"; // Database name

 

$tbl_name="MEMBERS"; // Table name

 

 

 

// Connect to server and select databse.

 

mysql_connect("$host", "$username", "$password")or die("cannot connect");

 

mysql_select_db("$db_name")or die("cannot select DB");

 

?>

<!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>

<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

  <!--DWLayoutTable-->

  <tr>

    <td height="44" colspan="3" valign="top"><p>Welcome <b><?PHP

 

$firstname = $_POST['firstname'] ;

$lastname = $_POST['lastname'] ;

$user = $_POST['username'] ;

 

$sql = "SELECT * FROM `MEMBERS` WHERE username = '{$_SESSION['myusername']}'" ;

 

$result = mysql_query($sql) ;

 

while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

 

  $dbfname = $row['firstname'] ;

  $dblname = $row['lastname'] ;

  $dbuser = $row['username'] ;

}

 

echo "$dbfname $dblname" ;

 

?></b><br />

      <img src="../images/admin/admin_title.gif" width="501" height="44" /></p>    </td>

  </tr>

  <tr>

    <td width="14" height="59"></td>

    <td width="473" valign="top">This admin area will allow you to manage your firefighter roster, your photogallery, and your message board. All changes become active when submitted. If you have problems with this site, please contact the webmaster. </td>

    <td width="14"></td>

  </tr>

  <tr>

    <td height="15"></td>

    <td></td>

    <td></td>

  </tr>

  <tr>

    <td height="186"></td>

    <td align="center" valign="top" bgcolor="#FFFFFF"><p><br />

        <a href="addMember.php"><img src="../images/stationAdmin/roster_buton.gif" width="305" height="48" border="0" /></a><br />

      <img src="../images/stationAdmin/photo_button.gif" width="305" height="48" /><br />

      <img src="../images/stationAdmin/message_button.gif" width="305" height="48" /></p></td>

  <td></td>

  </tr>

  <tr>

    <td height="19" colspan="3" valign="top"><div align="center"><a href="logout.php">Log Out of Admin Area </a></div></td>

  </tr>

</table>

</body>

</html>

 

Link to comment
Share on other sites

session_is_registered() is related to session_register() and does not work. Must be changed to $_SESSION

 

What is the current error message?

 

And - ini_set("session.cookie_lifetime", "60"); must go before every session_start() to have any effect.

Link to comment
Share on other sites

Alright...changed the session_is_registered.  Give it a try if you would like to:

 

Go to: http://www.mercercountyfa.org/stationAdmin/adminLogin.php

 

Username: admin  Password: 12345

 

Here is the code for the page you get when you login successfully:

 

<?php

 

session_start();

 

if($_SESSION['myusername']){

header("location:adminLogin.php");

}

 

ini_set("session.cookie_lifetime", "60")

?>

 

<?php

$host="localhost"; // Host name

 

$username="p2r71184"; // Mysql username

 

$password="692134a"; // Mysql password

 

$db_name="p2r71184_regMembers"; // Database name

 

$tbl_name="MEMBERS"; // Table name

 

// Connect to server and select databse.

 

mysql_connect("$host", "$username", "$password")or die("cannot connect");

 

mysql_select_db("$db_name")or die("cannot select DB");

?>

 

<!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>

<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">

  <!--DWLayoutTable-->

  <tr>

    <td height="44" colspan="3" valign="top"><p>Welcome <b>

<?php

 

$firstname = $_POST['firstname'] ;

$lastname = $_POST['lastname'] ;

$user = $_POST['username'] ;

 

$sql = "SELECT * FROM `MEMBERS` WHERE username = '{$_SESSION['myusername']}'" ;

 

$result = mysql_query($sql) ;

 

while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

 

  $dbfname = $row['firstname'] ;

  $dblname = $row['lastname'] ;

  $dbuser = $row['username'] ;

}

 

echo "$dbfname $dblname" ;

 

?></b><br />

      <img src="../images/admin/admin_title.gif" width="501" height="44" /></p>    </td>

  </tr>

  <tr>

    <td width="14" height="59"></td>

    <td width="473" valign="top">This admin area will allow you to manage your firefighter roster, your photogallery, and your message board. All changes become active when submitted. If you have problems with this site, please contact the webmaster. </td>

    <td width="14"></td>

  </tr>

  <tr>

    <td height="15"></td>

    <td></td>

    <td></td>

  </tr>

  <tr>

    <td height="186"></td>

    <td align="center" valign="top" bgcolor="#FFFFFF"><p><br />

        <a href="addMember.php"><img src="../images/stationAdmin/roster_buton.gif" width="305" height="48" border="0" /></a><br />

      <img src="../images/stationAdmin/photo_button.gif" width="305" height="48" /><br />

      <img src="../images/stationAdmin/message_button.gif" width="305" height="48" /></p></td>

  <td></td>

  </tr>

  <tr>

    <td height="19" colspan="3" valign="top"><div align="center"><a href="logout.php">Log Out of Admin Area </a></div></td>

  </tr>

</table>

</body>

</html>

 

Link to comment
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.