...

View Full Version : I just downloaded a script...could someone help debug it?



Crazydog
07-02-2007, 06:52 AM
There seem to be some problems with this script...can anyone figure out how to fix them? (They're not too big)

First:
This page: (admin.php)


<?php
include("include.php");
session_start();
if (@$_SESSION['loggedin'] == 1){
?>
You are currently loggedin.<br>
You will automatically be logged out if you return to the SMS main page.<br>
You may select a sorting pattern or click submit to view messages with default sorting.<br><br>
<form action="messages.php" method="post">
<input type='checkbox' name="sortbyname">
sort by name
<input type='checkbox' name="sortbydate">
sort by date <br />
<br />
<input type='submit' name="passsubmit" value="SUBMIT" />
</p>
</form><br>
<?php
echo "<p><a href='sms3.php'>Click here to logout</a></p>";
}else{

?>


Gives me:


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at include.php:58) in admin.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at include.php:58) in admin.php on line 3


and here's lines 50-65 in include.php:


$pagenext = $_REQUEST['pagenext'];
$pageprev = $_REQUEST['pageprev'];
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$PHP_SELF = $_SERVER['PHP_SELF'];
?>
<!-- Header data -->
<HTML>
<HEAD>
<script type="text/javascript" src="/overlibmws/overlibmws.js"></script>
<title>Simple Message System 3.0</title>
<SCRIPT LANGUAGE="Javascript">
<!---
function decision(message, url){
if(confirm(message)) location.href = url;
}
// --->

Xer0-
07-02-2007, 08:34 AM
(admin.php)


<?php
session_start();
include("include.php");



looks like the error is because the header is sent before the session is started.
switching those lines should fix it if I'm not mistaken.

Crazydog
07-02-2007, 01:49 PM
that fixed it...and the other problem was caused by a comment..
thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum