Jump to content

Recommended Posts

Hi,

 

I have got this script that confirms that a correct password was entered

 

<?php
case "logchk":

include_once("data/adminpw.php");

$useradmin = $_POST['useradmin'];
$adminpass = base64_encode($_POST['adminpass1']);
for($i=0; $i < count($data); $i++) {
if(($useradmin == $data[$i]['useradmin']) && ($adminpass == $data[$i]['adminpass1'])) {
$authorised = 'true';
}
}
if(!isset($authorised)) {
exit("You have entered the incorrect password. Please try again.");
}

setcookie('sbadmin', $useradmin, time()+3600);
header( 'Location: admin.php?cmd=panel' );
echo "login successful";

break;

?>

 

This confirms the login was successful but does not redirect the user to admin.php?cmd=panel

 

This did work, the only change I have made is to upgrade to IE8 - could this be what the problem is. Or have I made a mistake somewhere?

 

Thanks

No, if the problem is output before the header() call, the real solution would be to remove such output, as it doesn't make sense to output anything if the user is immediately redirected. Is there any output before the header() call? Could also be in any included file.

The only output before the header() call is

 

setcookie('sbadmin', $useradmin, time()+3600);

 

but even if I remove this, I still have the same problem.

 

The output for a successful login is under case "panel": which is in the code below this part of the script.

 

:(

Post the entire code please. As it is obvious we need more information. As for the "not getting any errors" do you have the following after the first <?php in your script to make sure errors are turned on?

 

error_reporting(E_ALL);
ini_set("display_errors", "on");

Hi premiso, thanks for your reply.

 

It would be impossible to post all the code, as the script is huge. I added the error reporting and solved the problem of the header function.

 

However, I now get this error

 

Notice: Undefined index: case in /home/moveitho/public_html/cgi-bin/sitebuilder/admin.php on line 5

 

which is this line:

 

$cmd = $_GET['cmd'];

 

this was all working fine before I upgraded to IE8, whats going wrong?

 

Thanks

$cmd = isset($_GET['cmd'])?$_GET['cmd']:'';

 

Will fix the undefined index.

 

It was not all "working fine" you just did not have errors reporting out. As far as why it took effect with IE 8, no clue. Could have been a buffering issue with IE 7 or 6 that IE 8 fixed.

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.