PHP - Headers And Session
Simple question. How do I redirect the header location on a session page. I thought I could go a different direction, but now I'm back to this one.
I tried just adding header("Location: newpage.php") at the end of a query insert, but it gave me the warning that it can't modify the head. But I need the page to redirect after the query is done. Thoughts? Similar TutorialsI am trying to create an index page which contains registration and login field the problem that i get is on successful login a warning is displayed session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\Eventz.com\index.php:116) in C:\xampp\htdocs\Eventz.com\index.php on line 235 This is the login part of my index.php this tag is inside an html table below the login form I also have a registration form and its php code above the login form Code: [Select] <?php if (isset($_REQUEST['pass'])) { $id=$_POST['id']; $pass=$_POST['pass']; $conn =mysql_connect("localhost","root",""); if (!$conn) { die('Could not connect: ' . mysql_error()); } /* checking connection....success! */ $e=mysql_select_db('test', $conn); if(!$e) { die(''.mysql_error()); } else { echo 'database selected successfully'; } if (isset($_REQUEST['id']) || (isset($_REQUEST['pass']))) { if($_REQUEST['id'] == "" || $_REQUEST['pass']=="") { echo "login fields cannot be empty"; } else { $sql=mysql_query("Select email,password from login where email='$id' AND password='$pass'"); $count=mysql_num_rows($sql); if($count==1) /* $count checks if username and password are in same row */ { session_start(); $_SESSION['id']=$id; echo "</br>Login Successful</br>"; } else { echo "</br>invalid</br>"; echo "please try to login again</br>"; } } } } ?> Any help or suggestion would be appreciated I am confused why I am getting the following error and was wondering if I could get a 2nd pair of eyes.. error: [29-Jul-2010 20:58:01] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in /home/curren11/public_html/mysite***.com/file_monitor.php on line 2 [29-Jul-2010 20:58:01] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/curren11/public_html/mysite***.com/file_monitor.php:2) in /home/curren11/public_html/mysite***.com/file_monitor.php on line 2 Here is the code: <?php session_start(); $root_path = realpath(getcwd()); $error_monitor_file = $root_path.'/file_modify.txt'; $hour = date("H"); $today = date("m-d-Y"); $myFile2 = "file_monitor.php.log"; $fh3 = fopen($myFile2, 'a'); $log_msg = "Last ran on: ".$today." at: ".$hour." \n"; fwrite($fh3, $log_msg); function scan_dir($path) { $out = array(); $files = opendir($path); while ($f = readdir($files)) { $extension = substr($f,-3); if ($f=='.' or $f=='..' or $extension=='jpg' or $extension=='JPG' or $extension=='png' or $extension=='gif' or $f=='file_monitor.php' or $f=='file_modify.txt' or $f=='file_monitor.php.log' or $f =='error_log' ) { continue; } if (is_dir($path.'/'.$f)) { $out = array_merge($out, scan_dir($path.'/'.$f)); } //if (((!is_dir($path.'/'.$f)) && ($f!='.' or $f!='..' or $extension!='jpg' or $extension!='JPG' or $extension!='png' or $extension!='gif')) else // { $out[] = $path. '/'. $f; //} } $_SESSION['all_files'] = $out; return $out; } $a = scan_dir(getcwd()); $count_array = count($_SESSION['all_files']); $loop_count=0; while($loop_count < $count_array) { // file in directory when was it last changed ? $filechange1 = date("m-d-Y-H", filemtime($_SESSION['all_files'][$loop_count])); // was it chnaged today and have I sent out an alert yet? if($filechange1 == $today."-".$hour) { $fh2 = fopen($error_monitor_file, 'a'); fwrite($fh2, "\n alert, file: ".$_SESSION['all_files'][$loop_count]." was changed today within the last hour ! \n"); fclose($fh2); } $loop_count ++; // log file? was it changed this past hour? if (file_exists($error_monitor_file)) { $filechange_log = date("m-d-Y-H", filemtime($error_monitor_file)); if ( ($loop_count == $count_array ) && ($filechange_log == $today."-".$hour ) ) { email(); } } } // function for email... function email() { require_once ('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "localhost"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "**c66@***ar.com"; // SMTP username $mail->Password = "*****"; // SMTP password $mail->From = "***@***.com"; $mail->FromName = "Colonial Cottage File Changed"; $mail->AddAddress("email@*****.com"); $mail->WordWrap = 50; // set word wrap //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); $mail->IsHTML(true); // send as HTML $mail->Subject ="Unauthorized file changed today!"; $mail->Body = "" ; $mail->AltBody = "This is the text-only body"; if(!$mail->Send()) { exit(); } } if ((file_exists($error_monitor_file)) && $hour == "00") { unlink($error_monitor_file); } fclose($fh3); exit(); ?>
I'm trying to start a session in a simple php file.
Here's *all* the code:
Here's the URL: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/hedgehog/public_html/class/class.phpmailer.php:3005) in /home/hedgehog/public_html/admin/class/authenticate.class.php on line 15 I own a website, www.gpstudios.com Some time ago I started recieiving this error after posting comments on the playgame page/news page. Try posting comments yourself on this game: http://www.gpstudios.com/playgame.php?gameid=324 I have attached a picture of the error. Unfortunately, I have no idea when this bug appeared. It must have happened a while ago, but I never noticed. Anyone know how or why I am getting this bug? Because I'm unsure as to where/when the error occurred, I cannot supply the code. Sorry for the lack of details, but I'm hoping someone will understand this error a little better than me :S Thanks, -Tom Hi Everyone I am having a few issues with my website. I have developed in on my xampp local host and it works ok but when I upload the files and try to renew a membership using stripe I get the following messages. Warning: session_start(): Cannot start session when headers already sent in /customers/a/d/f/mywebsite.co.uk/httpd.www/mywebsite/inc/settings.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /customers/a/d/f/mywebsite.co.uk/httpd.www/mywebsite/procedures/payments/charge.php:1) in /customers/a/d/f/mywebsite.co.uk/httpd.www/mywebsite/procedures/payments/charge.php on line 141 I have some includes that appear on every page. This is the bootstrap.php file. This file holds the settings.php which connects to my database and other function files. In this settings page I call the session_start() php function and then connect to my database. I call the bootstrap.php file on every page to there for call the session_start() on every page. I am using sessions alot so is this the right thing to do? I have attached the renew_membership payment page which holds the form. The user fills out the payment page and the form data gets sent to a script called charge.php which uses the stripe objects to make the payment. I then want to do a redirect to the paymentSuccess.php page to output to the user that the payment was made successfully. This is where the issues arrise. I have split the charge file into 3 screen shots so it is more readable. Hope someone can help me. Thanks a lot David
Edited April 26 by Irish_Dave I am having trouble resolving an error. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/s519970/public_html/header.php:27) in /home/s519970/public_html/admin/login.php on line 2 What I can gather is I can't use "header (Location: 'admin.php')" after i've used session_start(). I have tried to replace the header (Location: 'admin.php') with this: echo "<script>document.location.href='admin.php'</script>"; echo "<script>'Content-type: application/octet-stream'</script>"; I've been trying to read up on solutions but haven't been able to get it sorted. If anyone can offer some advice that would be greatly appreciated as im new to php. Code: [Select] <?php session_start(); if(isset($_SESSION['user'])) echo "<script>document.location.href='admin.php'</script>"; echo "<script>'Content-type: application/octet-stream'</script>"; ?> <div id="loginform"> <form action="dologin.php" method="post"> <table> <tr> <td><span>Username:</span></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><span>Password:</span></td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="login" value="Login" /></td> </tr> </table> </form> </div> I have tried using require_once('yourpage.php'); before my <head></head> tags in the header document where I've specified the html information but this doesn't seem to work. I've been advised to use ob_start("ob_gzhandler"); but I am not sure how to implement this. Any advice is greatly appreciated! in this page http://maximaart.com/newscp/ i have this problem Code: [Select] Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/maximasy/public_html/newscp/index.php:1) in /home/maximasy/public_html/newscp/index.php on line 2 my source code is <?php session_start(); include_once("config.php"); include_once("functions.php"); $errorMessage = ''; if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) { if ($_POST['txtUserId'] === "$user" && $_POST['txtPassword'] === "$pass") { // the user id and password match, $_SESSION['basic_is_logged_in'] = true; require("main.php"); exit;?> hi everyone. i'm wondering what the best way is to create a session variable and pass it to an iframe. i need to do something along these lines, but it doesn't seem to pass the ID. Any hints on how i should accomplish this? Code: [Select] session_start(); $_SESSION['ID']=$_GET['ID']; // id from previous page $ID=session_id(); <iframe src="iframepage.php?ID=<?php echo $ID; ?>" style="width:680px; height:200px;" noresize="noresize" frameborder="0" border="0" scrolling="Yes" allowtransparency="true" /> </iframe> I'm making a simple login system with MySQL and PHP (very simple, I'm just starting with PHP). The MySQL portion is done, but I need to ensure only people who are logged in can see certain content. To check if people are logged in, my website checks that they have the $_SESSION['user'] variable set. If it is set, then it lets them continue through the website, if not, it tells them to login. Is that enough security, or can people simply inject a session cookie into their browser to spoof that they are logged in? My idea was to generate a session key cookie when they login (just a random string of letters and numbers) and store that in the database, then on every page, check to make sure their session key is the same thing that's in the database. Is this necessary? It seems expensive. Evening! I've been iffing and ahhing over this and well im not too sure, hence the post. Code: [Select] // Redirects if there is no session id selected and echos the error on the previous page if(!isset($_GET['get']) || ($_GET['getget'])){ header("Location: #.php?error"); } So it should simply check if get is set if it isnt then see if getget is set? If not redirect and show the error. Now ive tried it and even when get/getget is set it still redirects, probably something silly. Care to share anyone? Harry. Just curious how other people feel about this. I am working on an application where a lot of info is pulled from MySQL and needed on multiple pages.
Would it make more sense to...
1. Pull all data ONCE and store it in SESSION variables to use on other pages
2. Pull the data from the database on each new page that needs it
I assume the preferred method is #1, but maybe there is some downside to using SESSION variables "too much"?
Side question that's kind of related: As far as URLs, is it preferable to have data stored in them (i.e. domain.com/somepage.php?somedata=something&otherdata=thisdata) or use SESSION variables to store that data so the URLs can stay general/clean (i.e. domain.com/somepage.php)?
Both are probably loaded questions but any possible insight would be appreciated.
Thanks!
Greg
Edited by galvin, 04 November 2014 - 10:30 AM. Okay, I've read all the rules for Headers...still can't it to execute properly. At the bottom is my code. I basically want to check the database, see if the user is already registered, and redirect as appropriate (there is no HTML on my page, no info sent to the browser). My server doesn't send any error messages. All I get are white screens. Now, if I do the headers_sent()...it tells me that it's sent right after the initial connection with the database. The ONLY way I can get it to redirect, is if I put <?php header("location:index.php?msg=3"); ?> at hte very top, but then I can't evalute...which doesn't help me much. Here is the code (obviously, I have more...but it's sending headers in these lines) <?php $connection = mysql_connect("localhost","####","#####"); if (!$connection){ echo mysql_errno().": ".mysql_error()."<br/>"; exit; } if(!mysql_select_db("prixaurora")){ echo("Database not found<br>"); } My error: Code: [Select] Warning: Cannot modify header information - headers already sent by (output started at /www/zxq.net/w/e/b/webaskius/htdocs/index.php:7) in /www/zxq.net/w/e/b/webaskius/htdocs/functions.php on line 6 Now, I can't quite figure out why it's doing this. The section of code that is causing this problem is above any HTML tags, at the very beginning of the file. <?php include('functions.php'); ?> <link href="style.css" rel="stylesheet" type="TEXT/CSS"> <img src="logo.png" border="0"> <div id="maincontent"> As you can see, the functions that cause this error are at the VERY beginning of my file. This is where they are called within index.php: if(mysql_num_rows($query_verify_login) > 0) { create_cookie(10000, 'user', $username); redirect('index.php'); } else { echo 'Woops! You\'ve entered in the wrong username and password combination!'; } And finally, my functions: <?php //our cookie creator function function create_cookie($time, $name, $data) { setcookie($name, $data, time()+$time); } function redirect($url) { header('Location: '. $url .''); } function get_replies($id) { //set query to find posts that match our id $query_get_replies = mysql_query("SELECT * FROM replies WHERE to = {$id}"); return mysql_num_rows($query_get_replies); } ?> I have a form as a php include and it's giving me this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/altimusw/public_html/www.csmsolution.com/register.php:6) in /home/altimusw/public_html/www.csmsolution.com/core.php on line 17 Here is the main page that includes the php include: <!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>CSM Solution </title> <style type="text/css"> <!-- #Layer1 { position:absolute; left:100px; top:70px; width:800; height:62px; z-index:1; } .style1 { font-family: Arial, Helvetica, sans-serif; color: #535959; font-size: 12px; } --> </style> </head> <body> <div id="Layer1"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="97"><img src="images/header.jpg" width="800" height="59" border="0" usemap="#Map" /><br /> <img src="images/navbar.jpg" width="800" height="38" border="0" usemap="#Map2" /> <map name="Map2" id="Map2"> <area shape="rect" coords="506,1,552,26" href="contact.php" /><area shape="rect" coords="459,1,502,26" href="form.php" /><area shape="rect" coords="396,-1,455,25" href="login.php" /> <area shape="rect" coords="357,0,393,26" href="index.php" /> </map> </td> </tr> <tr> <td><img src="images/welcome_img.jpg" width="131" height="21" /></td> </tr> <tr> <td><?php include("form.php"); ?></td> </tr> <tr> <td><img src="images/placeholderclouds_bottem.jpg" width="800" height="60" /></td> </tr> </table> </div> </body> </html> Here is the Core.php the error is referring to: <?php //CSM Solution Core. Rahul Parkar 2010 $_config = array(); $_config['db_type'] = "mysql"; $_config['db_server'] = "localhost"; $_config['db_username'] = "altimusw_csm"; $_config['db_password'] = ']17=rXh7tJ0~'; $_config['db_database'] = "altimusw_csm"; $_config['db_tbl_prefix'] = ''; $_config['user_table'] = "customers"; $_config['user_username'] = "username"; $_config['user_password'] = "password"; $_config['user_active'] = "approved"; $_config['user_role1'] = "prirole"; $_config['user_role2'] = "secrole"; $_config['pass_hash_func'] = "SHA1"; session_start(); function fetch_row($query) { build_connection($db); sql_exec($db, $query, $result); sql_fetchone($result, $row); finish_connection($db); return $row; } function build_connection(&$db) { global $_config; if ($_config['db_type'] == "mysql") { $db = mysql_connect($_config['db_server'], $_config['db_username'], $_config['db_password']) or die(mysql_error()); mysql_select_db($_config['db_database'], $db) or die(mysql_error()); } } function sql_exec(&$db, $query, &$result) { global $_config; if ($_config['db_type'] == "mysql") $result = mysql_query($query, $db) or die(mysql_error() . "/$query"); } function sql_fetchone(&$result, &$row) { global $_config; if ($_config['db_type'] == "mysql") { $row = mysql_fetch_assoc($result); @mysql_free_result($result); } } function sql_do(&$db, $query) { global $_config; sql_exec($db, $query, $noclue); finish_connection($db); } function finish_result(&$result) { global $_config; if ($_config['db_type'] == "mysql") @mysql_free_result($result); } function finish_connection(&$db) { global $_config; if ($_config['db_type'] == 'mysql') mysql_close($db); } function check_auth($username, $password) { global $_config; $row = fetch_row("SELECT `" . $_config['user_active'] . "`, `" . $_config['user_password'] . "`, " . $_config['pass_hash_func'] . "('" . $password . "') AS `passcheck`, `fname`, `lname` FROM `" . $_config['user_table'] . "` WHERE `" . $_config['user_username'] . "`='" . $username . "' LIMIT 1"); if (!$row[$_config['user_active']]) { return -1; } else { if ($row[$_config['user_active']] != 1) { return -2; } else if ($row[$_config['user_password']] == $row['passcheck']) { $_SESSION['username'] = $username; $_SESSION['fname'] = $row['fname']; $_SESSION['lname'] = $row['lname']; return 1; } else { return -1; } } } function load_access() { global $_config; if ($_SESSION['username']) { $row = fetch_row("SELECT `" . $_config['user_role1'] . "` FROM `" . $_config['user_table'] . "` WHERE `" . $_config['user_username'] . "`='" . $_SESSION['username'] . "' LIMIT 1"); $role1 = $row[$_config['user_role1']]; $_SESSION['role1'] = $role1; } else { return -1; } } function has_level() { for ($i = 0; $i < func_num_args(); $i++) { if (func_get_arg($i) == $_SESSION['role1']) { return 1; } } return 0; } ?> I am trying to do a page redirect using the header() function.
I am aware that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
and also that reading code with include, or require, functions, or another file access function, can create spaces or empty lines that are output before header() is called. thus causing a redirect failure.
I have therefore used this output control function (ob_start(); ob_implicit_flush() right at the top of my page.
I am then creating the redirect like this as part of my login() function:
if($user_role == ADMIN_LEVEL || $user_role == EDITOR_LEVEL) { if (!headers_sent($filename, $linenum)) { return header("Location:http://mysite.com/dashboard.php"); exit; } else { echo "Headers already sent in $filename on line $linenum\n" . "Cannot redirect\n"; exit; } }Unfortunately I am still getting this error: Headers already sent in /home/steveoje/public_html/login.php on line 1 Cannot redirectAnd this is what I have at the top of the login.php page: <?php ob_start(); ob_implicit_flush(); require_once 'includes/config.php'; if(isset($_POST['submit'])) { login($_POST['username'], $_POST['password']); } require_once "includes/header.inc.php" ?> //other html contentSo why would the redirect fail in this instance? Thanks. Edited by terungwa, 28 September 2014 - 05:28 AM. Hi all, It's probably something obvious, but perhaps someone could explain to me what is going on here... I spent a lot of time this afternoon trying to fix what seemed to be a very odd problem, which involved an image being chucked out like so: Code: [Select] <?php header("Content-Type: image/png"); echo file_get_contents("http://www.example.com/some_image.png"); ?> Except the image was coming out as corrupted, ultimately because I had some white space before this snippet (foolish, I know). The reason it took me so long to diagnose the problem was because I wasn't getting PHP errors (even though they were switched on). As far as the script was concerned, it seems I wasn't sending anything before attempting to modify the headers. After solving the problem, I put the following little bit of code together, trying to force a header error... And yet I get nothing. It all works, and I get redirected, when I'm sure I shouldn't be. I've run this on a default install of XAMPP, and a configured CentOS server, and the same thing happens on both. If anyone can explain to me what is going on, I would be most appreciative! There are some inline comments which should help clarify what I mean. Code: [Select] <?php error_reporting(E_ALL); ini_set("display_errors","1"); ?> <p>Hello! The very existence of this text should really have resulted in the headers being sent... Shouldn't it?</p> <p>So I'd expect to see a "Headers already sent" message... Shouldn't I?</p> <?php // Headers sent? echo "<p>"; echo "Headers "; if(!headers_sent()) { echo "not "; // This "not" does echo out. } echo "sent.</p>"; // This WILL start a session (or at least, won't throw an error) session_start(); // This redirect WILL work, and you will never see the above messages. header("Location: redirect.php"); // What?! ?> Thanks! Dave hello, I'm using this code: <?php if (isset($_REQUEST['email'])) { $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $code = $_REQUEST['code'] ; $from = $email; mail("email@email.com", "Winner request id: $name - code: $code", "From:" . $from); } $headers = "From:" . $from; header('Location: index.php?done'); ?> And I'm getting: Code: [Select] Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/config.php:10) in /home/site/public_html/send.php on line 13 This worked before. Many thanks Hi I am getting the following php error that is on all my pages and it works fine on the other pages except index.php Code: [Select] <?php session_start(); include 'includes/conn_db.php'; if (isset($_POST['submit'])) { if (empty($_POST['userName'])) { $u = FALSE; $nouser = '<font color="red" size="2" face="arial">You forgot to enter your username!</font>'; } else { $u = $_POST['userName']; } if (empty($_POST['userPassword'])) { $p = FALSE; $nopass = '<font color="red" size="2" face="arial">You forgot to enter your password!</font>'; } else { $p = $_POST['userPassword']; } $errorMessage = $nouser . "<br>" . $nopass; if ($u && $p) { $query = "SELECT * from clients WHERE email = '$u' AND pword = '$p'"; $result = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($result)){ if ($u == $row["email"] && $p == $row["pword"]) { $query_name = "SELECT * FROM clients WHERE email = '$u' AND pword = '$p'"; $result_name = @mysql_query ($query_name); while ($row_name = mysql_fetch_assoc($result_name)){ $client_id_out = $row_name['client_id']; $firstname_out = $row_name['firstname']; $lastname_out = $row_name['lastname']; // Create sessions $_SESSION['client_id'] = $client_id_out; $_SESSION['firstname'] = $firstname_out; $_SESSION['lastname'] = $lastname_out; ob_end_clean(); header ("Location: myaccount.php"); exit(); }} } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="layout.css" rel="stylesheet" type="text/css" /> <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="js/cufon-yui.js" type="text/javascript"></script> <script src="js/cufon-replace.js" type="text/javascript"></script> <script src="js/Futura_Bk_BT_400.font.js" type="text/javascript"></script> <script src="js/Futura_XBlk_BT_400.font.js" type="text/javascript"></script> <!--[if lt IE 7]> <script type="text/javascript" src="js/ie_png.js"></script> <script type="text/javascript"> ie_png.fix('.png'); </script> <![endif]--> </head> Thanks Lional ok i read the header part but i sure i did it rite but its givong me those erros Code: [Select] <?php session_start(); $username = $_SESSION['username']; ?> <?php require "scripts/connect.php"; if($_POST['submitbtn']){ $body = mysql_real_escape_string($_POST['area1']); if($body){ $query = mysql_query("UPDATE history SET body ='$body'"); echo $msg = "UPDATED GOOD"; header('location: http://www.rbrhslsp.org/rbrhsadmins/edithistory'); }else $msg = "Please fill in the body"; } mysql_close(); ?> <?php require "scripts/connect.php"; $query = mysql_query("SELECT * FROM history"); $rows = mysql_fetch_assoc($query); $body = stripslashes($rows['body']); mysql_close(); ?> <?php require "header.php"; ?> <?php if ($username){?> <div id="leftContent"> <h4> Your page </h4> <?php echo $msg;?> <form action='edithistory' method='post'> <textarea style="height: 100px; width:490px;" name="area1" cols="58"><?php echo $body;?></textarea> <input type='submit' name='submitbtn' value='Submit' /> </form> </div> |