FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PM Logout





DanielXP
My PM script keeps login me out heres the case

Code:
case "pm":
$id = (int)$_GET['id'];
$msg = mysql_fetch_array(mysql_query("SELECT * FROM `pms` WHERE `id` = '$id'"));
if($msg[to] == $logged[username])
{
if($msg[unread] == 'unread')
{
$time = time();
$update = mysql_query("UPDATE `users` set `lastviewedpm` = $time WHERE `username` = '$logged[username]'");
$update = mysql_query("UPDATE `pms` set `unread` = 'read' WHERE `id` = '$id'");
}
$message = $msg[message];
$message2 = stripslashes($message);
$message = stripslashes(nl2br(parseubb($message, red)));
$title = stripslashes($msg[title]);

echo "<table width='65%' style='border:1px solid #000000;' cellpadding='0' bgcolor='#FFFFFF' cellspacing='0'>
  <tr>
    <td background='images/bar.png' style='border-bottom:1px solid #000000;'><div align='center'><b><font size='3'>Private Message</font></b></div></td>
  </tr>
  <tr>
    <td bgcolor='#ADE393'><b>Subject:</b> $title - <b>From:</b> $msg[from]</td>
  </tr>
  <tr>
    <td>$message</td>
  </tr>
  <tr>
    <td bgcolor='#ADE393'><b>Reply</b></td>
  </tr>
<form action='pm.php?view=reply&id=$id' method='post' name='reply'>
  <tr>
    <td><textarea name='message' cols='65' rows='10'>


[b]$msg[from] Said:[/b]
$message2</textarea></td>
  </tr>
  <tr>
    <td><div align='center'><input type='submit' value='Send Reply'></center></td>
</table>";
}
else
{
echo "<table width='65%' style='border:1px solid #000000;' cellpadding='0' bgcolor='#FFFFFF' cellspacing='0'>
  <tr>
    <td><div align='center'>
This is not your PM!
    </div></td>
  </tr>
</table>";
}
break;


Its def in that case

these are my sessions

Code:
$_SESSION['id']
$_SESSION['password']


Thanks DanielXP
DanielXP
Still can't work it out
hexkid
DanielXP wrote:
Still can't work it out


I suggest you follow the suggestion in my sig Smile
DanielXP
I keep getting this lot

Quote:
Notice: Use of undefined constant username - assumed 'username' in /home/gm/public_html/www/config.php on line 19

Notice: Use of undefined constant rankpro - assumed 'rankpro' in /home/gm/public_html/www/config.php on line 50

Notice: Use of undefined constant rankpro - assumed 'rankpro' in /home/gm/public_html/www/config.php on line 50

Notice: Use of undefined constant rankpro - assumed 'rankpro' in /home/gm/public_html/www/config.php on line 51

Notice: Use of undefined constant loggedin - assumed 'loggedin' in /home/gm/public_html/www/config.php on line 62

Notice: Use of undefined constant alive - assumed 'alive' in /home/gm/public_html/www/config.php on line 66

Notice: Use of undefined constant nextct - assumed 'nextct' in /home/gm/public_html/www/config.php on line 80

Notice: Use of undefined constant nextch - assumed 'nextch' in /home/gm/public_html/www/config.php on line 89

Notice: Use of undefined constant username - assumed 'username' in /home/gm/public_html/www/config.php on line 103

Notice: Use of undefined constant userlevel - assumed 'userlevel' in /home/gm/public_html/www/pm.php on line 6





Notice: Use of undefined constant to - assumed 'to' in /home/gm/public_html/www/pm.php on line 117

Notice: Use of undefined constant username - assumed 'username' in /home/gm/public_html/www/pm.php on line 117

Notice: Use of undefined constant unread - assumed 'unread' in /home/gm/public_html/www/pm.php on line 119

Notice: Use of undefined constant message - assumed 'message' in /home/gm/public_html/www/pm.php on line 125

Notice: Use of undefined constant title - assumed 'title' in /home/gm/public_html/www/pm.php on line 128


Don't know what it means
hexkid
DanielXP wrote:
Don't know what it means

Let's see this line of your code
DanielXP wrote:
Code:
$message = stripslashes(nl2br(parseubb($message, red)));


What is "red" there?
It isn't a variable (no $);
It isn't a string (no "or ');
it isn't a number;

So, what is it? ??? Smile
Like me, PHP also doesn't know what it is.

Unlike me, PHP also looked at your defines for something like
Code:
define('red', 'something');

As it didn't find such a define it issued that Notice and assumed you meant
Code:
$message = stripslashes(nl2br(parseubb($message, 'red')));


So, get rid of those notices by delimiting all your strings with ' or ".
Also check the return value of mysql_query() calls
Code:
$x = mysql_query(...);
if ($x === false) {
  // There was an error in the query.
  // For simplicity sake, just print the error message and exit;
  echo 'Query error: ', mysql_error();
  exit;
}
DanielXP
I got rid of the red thing

it was for the BB codes for the quote colour

Still logs me out
hexkid
DanielXP wrote:
Still logs me out


Maybe you have an error in one of your MySQL statements?

Replace
DanielXP wrote:
Code:
$msg = mysql_fetch_array(mysql_query("SELECT * FROM `pms` WHERE `id` = '$id'"));


with
Code:
$msg = mysql_fetch_array(mysql_query("SELECT * FROM `pms` WHERE `id` = '$id'"));
if ($msg == false) {
  echo 'There was an error in the SQL statement.<br>';
  echo 'The error was:', mysql_error();
  exit;
}


And similarly for all other mysql_query() calls you have in your code.
DanielXP
This is what it display with that code

Quote:
Notice: Use of undefined constant username - assumed 'username' in /home/gm/public_html/www/config.php on line 19

Notice: Use of undefined constant rankpro - assumed 'rankpro' in /home/gm/public_html/www/config.php on line 50

Notice: Use of undefined constant rankpro - assumed 'rankpro' in /home/gm/public_html/www/config.php on line 50

Notice: Use of undefined constant rankpro - assumed 'rankpro' in /home/gm/public_html/www/config.php on line 51

Notice: Use of undefined constant loggedin - assumed 'loggedin' in /home/gm/public_html/www/config.php on line 62

Notice: Use of undefined constant alive - assumed 'alive' in /home/gm/public_html/www/config.php on line 66

Notice: Use of undefined constant nextct - assumed 'nextct' in /home/gm/public_html/www/config.php on line 80

Notice: Use of undefined constant nextch - assumed 'nextch' in /home/gm/public_html/www/config.php on line 89

Notice: Use of undefined constant username - assumed 'username' in /home/gm/public_html/www/config.php on line 103

Notice: Use of undefined constant userlevel - assumed 'userlevel' in /home/gm/public_html/www/pm.php on line 6





Notice: Use of undefined constant to - assumed 'to' in /home/gm/public_html/www/pm.php on line 123

Notice: Use of undefined constant username - assumed 'username' in /home/gm/public_html/www/pm.php on line 123

Notice: Use of undefined constant unread - assumed 'unread' in /home/gm/public_html/www/pm.php on line 125

Notice: Use of undefined constant message - assumed 'message' in /home/gm/public_html/www/pm.php on line 131

Notice: Use of undefined constant title - assumed 'title' in /home/gm/public_html/www/pm.php on line 134
Private Message
Subject: RE: ******** - From: ***********

Cash Bot Said:
********************.
Reply


****** Said:

*********** Said:
********************.
hexkid
If there are no SQL errors in your queries, your problem (the script logging you out) does not come from the case block.
Related topics
Account activation PM?
Install PHPBB-10$ SMF-5$ MediaWiki-10$ & other Scripts
PHP login/logout problem
Sig wanted, PM with your price!
PM Script
Mails from PM disappered!
Close this topic please
Need help making logout script
Members script with pm and admin area
Help!!!! posting a html im a novice!!!
Problem with phpbb forum
Tutorials / PM / Points
PM Limit
Nuke-Evolution
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.