1
MS-2001
Curious Thing: php script returns other than it should
  • 2005/10/31 18:18

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Hi there,

here I'm back with an other curious thing I just managed to find out. I wrote an extended private messaging system. There is a php file which checks if there are any new messages for a specific user.

if there are, a popup will be created. but as i just told you I managed to find out something i really don't like.


that's how an "empty" return should look like:
<html>
<
head><title>title>
<
script type="text/javascript" src="http://www.myurl.de/include/xoops.js">script>
<
script type="text/javascript">
    script>
head>
<
body onload=setInterval('self.location.reload()',10000)>
body>
html>


But instead of getting the thing above I just get the following (in some realy rarely cases):
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <
HTML><HEAD>
 <
META http-equiv=Content-Type content="text/html; charset=windows-1252">HEAD>
 <
BODY>BODY>HTML>


But why is that? I don't understand it. Here the first lines out of the mentioned php script:
include "../../mainfile.php";
global 
$xoopsDB$xoopsConfig$xoopsModule$HTTP_SERVER_VAR;
$online_handler =& xoops_gethandler('online');

if (
is_object($xoopsUser)) {
    
$uid $xoopsUser->getVar('uid');
    
$uname $xoopsUser->getVar('uname');
} else {
    
$uid 0;
    
$uname '';
}
if (
is_object($xoopsModule)) {
    
$online_handler->write($uid$unametime(), $xoopsModule->getVar('mid'), $HTTP_SERVER_VARS['REMOTE_ADDR']);
} else {
    
$online_handler->write($uid$unametime(), 0$HTTP_SERVER_VARS['REMOTE_ADDR']);
}
        
if (!
$xoopsUser) exit();
$uid $xoopsUser->getVar('uid');
$result $xoopsDB->query("SELECT msg_id, from_userid, msg_time FROM ".$xoopsDB->prefix("priv_msgs")." WHERE to_userid=".$uid." AND read_msg=0");
?>


As u can see I'm doing an update of the user-session here and get all new pns (if there are any) and start then with a "small-written" and NO specified doctype.

So where does that come from? Result of all of that is that the users don't get the private messages stored in the database. but after all. somethimes it could happen that the script works and the user gets his pns.

I have to add that this problem allways occurs with the same users.

any idea?

2
MS-2001
Re: Curious Thing: php script returns other than it should
  • 2005/11/3 15:30

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


No idea?

Login

Who's Online

395 user(s) are online (304 user(s) are browsing Support Forums)


Members: 0


Guests: 395


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits