Jump to content

Recommended Posts

My users log in to a menu page, and then choose an updater page to go to from the menu. Once they are on the updater page I cant make the menu reload, either through the browser back button or by using a link. The menu page displays a blank page and I have to refresh the browser to display it.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/149990-solved-blank-screen-from-back-button/
Share on other sites

I think it is obvious from the lack of responses that none of us have any idea what you are talking about. How about more detail and I don't know some code might be very useful, and seeing that this might be a work in progress a link could also be helpful in making us understand the problem.

I think it is obvious from the lack of responses that none of us have any idea what you are talking about. How about more detail and I don't know some code might be very useful, and seeing that this might be a work in progress a link could also be helpful in making us understand the problem.

 

Nah no need to, let me use my PHP crystal ball

 

Hmmmmmm Hmmmmmm

I see ...

 

Line 394 is what you looking for

Beware the evil ;!

 

Nah just kidding hehe

 

Couls be a lot of things bro. A PHP error or a MySQL error with repporting set to 0 would do that.

I think it is obvious from the lack of responses that none of us have any idea what you are talking about. How about more detail and I don't know some code might be very useful, and seeing that this might be a work in progress a link could also be helpful in making us understand the problem.

No real need for that was there? Just a simple question from someone clearly not as experienced with the language as most of the users of this forum. Bit sarky don't you think?

 

Ok so this is the menu page...

<?php
//check for required fields from the form
if ((!isset($_POST["username"])) || (!isset($_POST["password"])))
{
header(("Locaction: home.php"));
exit;
}

//connect to server and select database
$mysqli = mysqli_connect("localhost", "root", "pass", "opp_group");

//create and issue the query
$sql = "SELECT firstname, surname
	FROM cms_users
	WHERE username = '".$_POST["username"]."'
	AND password = MD5('".$_POST["password"]."')";
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

//get the number of rows in the result set; should be 1 if a match
if (mysqli_num_rows($result) == 1)
{
//if authorised, get the values of firstname and surname
while ($info = mysqli_fetch_array($result))
{
	$firstname = stripslashes($info['firstname']);
	$surname = stripslashes($info['surname']);
}

//set authorisation cookie
setcookie("auth", "1", 0, "/", "localhost", 0);

//create display string
$display_block = "
<p>Hello ".$firstname.", please choose the feature you wish to change.</p>
";


}
else
{
//redirect back to login form if not authorised
header("Location: home.php");
exit;
}
?>
<html>
<head>
<link rel="stylesheet" href="backend.css">
<title>CMS Menu</title>
</head>
<body>
<br/>
<div align="center"><h1>Welcome to the Blandford Opportunity Group Staff Portal</h1>
<h2><?php echo "$display_block"; ?></h2></div>
<br/>
<table width="600" align="center" cellspacing="2"><tr>
<td><img src="spanner.gif" height="30"></td>
<td width="150" align="center" class="background" onClick="document.location.href='cms/manageusers.php'"><a href="cms/manageusers.php">Manage User Accounts</a></td>
<td></td>
<td width="150" align="center" class="background" bordercolor="#0066FF">Change Site Colour</td>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
<td><form action="logoutcms.php" method="GET"><input type="submit" name="logout" value="Logout"/></form></td>
</tr></table>
<br/></br>


</body>
</html>

 

And this is the updater, or "manage users" page that it links to....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<head>
<title>Manage User Accounts</title>
<link rel="stylesheet" href="../backend.css">
</head>
<body>
<div class="test">
<br/>
<h1>Content Management System</h1>
<p>
<h2>Manage User Accounts</h2><a href="../cmsmenu.php">Back to Menu</a>

</p>
<br/>
<hr/>
<h3>Add a New User</h3>
Complete the form below to add a new user
<br/>


<?php


if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') 
{
  // add a new record to the database
//Adding a new user
$mysqli = mysqli_connect("localhost","root","pass","opp_group");

$f = $_POST['firstname'];
$s = $_POST['surname'];
$u = $_POST['username'];
$p = $_POST['password'];

$addUser_sql = "INSERT INTO cms_users (firstname, surname, username, password) 
				VALUES ('$f', '$s','$u',MD5('$p'))";
$addUser_res = mysqli_query($mysqli, $addUser_sql) or die(mysqli_error($mysqli));
mysqli_close($mysqli);
// reload page
  	header("Location:manageusers.php");
  	exit();
}

echo "<form method=\"POST\" action=\"".$_SERVER["PHP_SELF"]."\"> 
<table>
<tr><td>First Name: </td><td><input type=\"text\" name=\"firstname\" size=\"20\" maxlength=\"25\"/></td></tr>
<tr><td>Surname: </td><td><input type=\"text\" name=\"surname\" size=\"20\" maxlength=\"25\" /></td></tr>

<tr><td>Username: </td><td><input type=\"text\" name=\"username\" size=\"15\"maxlength=\"10\"/></td></tr>
<tr><td>Password: </td><td><input type=\"password\" name=\"password\" size=\"15\" maxlength=\"10\"/></td></tr>
</table>
<p><h4>Username is first letter of firstname followed by surname, max 8 characters. e.g. jsmith. <br/>Password must be exactly 8 characters long</h4></p>
<input type=\"submit\" name=\"submit\" value=\"Submit\" />
<hr class=\"short\" align=\"left\"/>
</form>
";

?>



<h3>Edit or Delete a User</h3>
Choose the user from the drop down list and click "View" to see their details.<br/><br/>

<script type="text/javascript">
function eventWindow(url) 
{
event_popupWin = window.open(url, 'event', 'resizable=yes,scrollbars=yes,toolbar=no,width=450,height=500');
event_popupWin.opener = self;
}
</script>


<?php
$mysqli = mysqli_connect("localhost","root","pass","opp_group");
//Get list of users in drop down

$getUsers_sql ="SELECT id, firstname, surname FROM cms_users ORDER BY firstname";
$getUsers_res = mysqli_query($mysqli, $getUsers_sql)or die(mysqli_error()); 

echo "<form method=\"POST\" action=\"../user.php\"  >
<select name=\"users\">";

while ($row = mysqli_fetch_assoc($getUsers_res)) 
{ 

    echo '<option value="' . $row['id'] . '">' . $row['firstname'] . ' ' . $row['surname'] . '</option>'; 
$id = $row['id'];
} 
echo "</select>
<a href=\"javascript:eventWindow('../user.php?i=".$id."');\">
<input type=\"submit\" name=\"viewuser\" value=\"View\" />
</a>";

?>
</form>
</div>
</body>
</html>

I realise I probably didnt need to post all of this code, but I'm new with php, so I'm not sure which bits of code this will apply to. The problem is that when I select to go back to the menu page from the update users page, the menu page is blank, whether I do it from the browser back button, or from the link you can see in the code.

 

Thanks for any helpguys, what does your crystal ball say now drisate????!!! ;D

When you get to this blank page what does your header say or maybe I should say what does your url say? Trying to limit the scope of the problem down now as I am at work and do not have a test server in front of me.

Maybe a bit "sarky" if you will but I got the information that I requested did I not? Also there has been a lot of very vague posters today, so really it was nothing personal.

I've put that into my header, but I dont get any errors. The url that it is trying to load is

 

http://localhost/Site%20Pages/cmsmenu.php

 

which is the correct url for that page. Really don't know what's going on!

Can anybody please help me out here? I am now using a simple hyperlink e.g. <a href="../cmsmenu.php">Back</a> ...but the page still returns blank. Does it have anything to do with the session variables being passed between each other??

Look, the most likely cause of your problem is out put buffering, just like Zanus said. So you need to take some time and research out put buffering, and how it relates to your issue. Then you need to see if adjustments to your buffer help you to fix this problem.

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.