#39950 [NEW]: ob_start not work
| From: | phunsanit at hotmail dot com | Date: | Tue, 26 Dec 2006 06:55:11 +0000 |
| Subject: | #39950 [NEW]: ob_start not work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-106877@lists.php.net to get a copy of this message | ||
From: phunsanit at hotmail dot com
Operating system: windows xp
PHP version: 4.4.4
PHP Bug Type: *General Issues
Bug description: ob_start not work
Description:
------------
i think ob_start not work
try no appserv 2.4.7 and 2.5.7
windows xp with ajax frame work
Reproduce code:
---------------
// * ALL.php for Ahtoring
<?php
ob_start();
header('Content-Type: text/html; charset=utf-8');
define('CONTENTS', true);
include_once('dynamic/dynamic.php');
echo"\n<! window fragment>\n";
if(isset($_REQUEST['modules'])){
$modules = $_REQUEST['modules'];
if(isset($_REQUEST['file'])){
include_once("dynamic/modules/$modules/".$_REQUEST['file']);
}else{
include_once("dynamic/modules/$modules/contents.php");
}
}else{
header("location : index.php");
}
/*
$error = $db->sql_error($result);
foreach ($error as $value) {
echo "<br />$value\n";
}
*/
echo"\n<! window fragment>\n";
ob_end_flush();
?>
// login script
<?php
if (!defined('CONTENTS')) {
die ('<div class="blockError">You can\'t access this file
directly...</div>');
}
function form(){
?>
<div align="center">
<form method="post" action="all.php?modules=Pitt_Accounts&op=login"
onsubmit="return post(this ,'content');">
<table>
<tr>
<td
colspan="2">สมาชิกเข้าสู่ระบบ</td>
</tr>
<tr>
<td>ชื่อเรียก:</td>
<td><input name="username" type="text" size="15"
maxlength="25"
/></td>
</tr>
<tr>
<td>รหัสผ่าน:</td>
<td><input name="user_password" type="text" size="15"
maxlength="20"
/></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="Submit2" value="Reset" />
</td>
</tr>
</table>
</form>
</div>
<?php
}
function login(){
global $db;
$user = $_POST['username'];
$passwd = $_POST['user_password'];
$sql = "SELECT * FROM
pitt_accounts WHERE username ='$user'";
$result = $db->sql_query($sql);
$field = $db->sql_fetchrow($result);
$pitt_uid = $field['user_id'];
$adusr = $field['username'];
$valid_user = strcmp($user, $adusr);
$valid_passwd = strcmp(md5($passwd), $field['password']);
if ($valid_user == 0 && $valid_passwd == 0) {
/*
ถ้าชื่อผู้ใช้และรหัสผ่านถูกต้อง
เราจะสร้าง
session
pitt_uid
ที่เก็บรหัสผู้ใช้
pitt_user
เก็บชื่อผู้ใช้
pitt_group
เก็บกลุ่มผู้ใช้
*/
$ip = ''.getenv("REMOTE_ADDR").'';
$time = 'sign in '.date("Y-m-d ,H:i").'';
$sql="INSERT INTO pitt_accounts_log ( user_id , sign ,
ip )
VALUES ( '$pitt_uid', '$time', '$ip');";
$db->sql_query($sql);
/* CSLOX ใช้ php V4.3.1
มี BUG ไม่ SUBPORT output buffering
1
ห้ามส่งข้อมูลก่อน
COOKIE / SESSION
2
เรียงชื่อตัวแปรด้วย
?
3 ว่างๆ ส่ง chang
Log
ไปให้ดูด้วย
*/
setcookie('pitt_uid' ,$pitt_uid ,time()+2592000);
// setcookie('pitt_group' ,$field['group'] ,time()+2592000);
setcookie('pitt_user' ,$adusr ,time()+2592000);
$_SESSION['pitt_group'] = $field['group'];
$client++; setcookie("client[$client]",
urlencode("window.parent.location='admin.php?session=".rand()."';"));
}else{
$client++; setcookie("client[$client]",
urlencode("alert('รหัส
หรือ
ชื่อผู้ใช้ผิด');"));
}
}
switch($_REQUEST['op']){
case 'login': { login(); break;}
case 'logout' : {
setcookie('pitt_uid');
setcookie('pitt_user');
unset($_SESSION['pitt_group']);
$client++; setcookie("client[$client]",
urlencode("window.parent.location='admin.php?session=".rand()."';"));
break;
}
default : { form(); }
}
?>
Expected result:
----------------
Warning: Cannot modify header information - headers already sent by
(output started at C:\AppServ\www\SCT_CSS\all.php:1) in
C:\AppServ\www\SCT_CSS\all.php on line 3

Warning: Cannot modify header information - headers already sent by
(output started at C:\AppServ\www\SCT_CSS\all.php:1) in
C:\AppServ\www\SCT_CSS\dynamic\modules\Pitt_Accounts\contents.php on line
68
--
Edit bug report at http://bugs.php.net/?id=39950&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39950&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39950&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39950&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39950&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39950&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39950&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39950&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39950&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39950&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39950&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39950&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39950&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39950&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39950&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39950&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39950&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39950&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39950&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39950&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39950&r=mysqlcfg