ID: 39950
Updated by: [EMAIL PROTECTED]
Reported By: phunsanit at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: windows xp
PHP Version: 4.4.4
New Comment:
Remove BOM from the beginning of the file.
Previous Comments:
------------------------------------------------------------------------
[2006-12-26 07:48:12] phunsanit at hotmail dot com
ok i found
it error when use utf-8 (i tranfer from ansi witc editplus 2.3)
now transfer back to ansi it work
php non subport utf-8 ?
------------------------------------------------------------------------
[2006-12-26 07:07:06] phunsanit at hotmail dot com
same as this test.php
<?php
ob_start();
echo'eeeeeeeeeeeeeee bug';
setcookie("TestCookie", $value, time()+3600);
ob_end_flush();
?>
return
eeeeeeeeeeeeeee bug
Warning: Cannot modify header information - headers already sent by
(output started at C:\AppServ\www\ob.php:1) in C:\AppServ\www\ob.php on
line 4
------------------------------------------------------------------------
[2006-12-26 06:55:10] phunsanit at hotmail dot com
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 this bug report at http://bugs.php.net/?id=39950&edit=1