0

Hello all,

I am currently getting this error message:

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

Using php 5.12
here is the code at the top of the page:

<?php
$db_host 	= "xxx.xx.xx.xx";
$db_user 	= "xxxxxxxx";
$db_password = "xxxxxxxxxx";
$db_name = "xxxxxxxxx";
// connect to mysql server
session_start();
//include( "include/connect.inc.php" );
// connect to mysql server
 	$db = mysql_connect( $db_host, $db_user, $db_password ) or die(mysql_error() );
	// select the database to use
	mysql_select_db( $db_name ) or die( mysql-error() );
?>

Followed by:

<div id="navigation">
   <hr />
      <span class="class1">
	<a class="home" href="index.php">Blog</a>  ||
	<a class="submit" href="input.php">Post a entry</a>  ||
	<?php if( strcmp( $_SESSION["logged_in"], "OK!" ) == 0): ?>
	<a class="logout" href="logout.php">Logout</a>
      </span>
   <hr />	
</div>
   <?php
	$result = mysql_query("SELECT timestamp, id, title, author FROM micro_blog_posts ORDER BY id DESC");
	   while($row = mysql_fetch_array($result)) 
             {
	       $date  = date("l F d Y",$row['timestamp']);
	       $id = $row['id'];
	       $title = strip_tags(stripslashes($row['title']));
	       $author = stripslashes($row['author']);
	          if (mb_strlen($title) >= 20) 
                     {
		        $title = substr($title, 0, 20);
		        $title = $title . "...";
		     }
		print("<a href=\"update.php?id=" . $id . "\">" . $date . " -- " . $author . " -- " . $title . "</a><br />");
	     }
	     mysql_close();
	     ?>
		<?php else: ?>
		   <a href="login.php">Login</a>
		   <?php endif; ?>

If I refresh the page the error disappears. What is the problem? Does it have to do with: session_start();? How do I solve it It's all a learning experience and the more I know the better I can be at helping someone else down the road. Any help would be appreciated.

P Chuprina

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by PChuprina
0

try writing your MySQL connection inside the

if( strcmp( $_SESSION["logged_in"], "OK!" ) == 0)

Edited by P0lT10n: n/a

Votes + Comments
follow some search
1

session_start() should always stay at the first line of the others.

<?php
session_start();

//some scripts after this line

?>
0

try writing your MySQL connection inside the

if( strcmp( $_SESSION["logged_in"], "OK!" ) == 0)

Being relatively new i'm not sure what you mean or how about this. Could you please explain?

Thanks

P chuprina

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.