News:

Join the Facebook Fan Page.

Main Menu

Another Cookie problem

Started by horus, August 16, 2003, 04:17:21 PM

Previous topic - Next topic

horus

I put together this little script which suppose to read the cookie created by yabbse and query the db, so it can display the username on the front page, everything worked fine till I realised that if someone leaves the "wwww" out and types domain.com [nofollow] nothing happens, and since I'm a bigenner I have no idea how to solve the problem so as usual I seek your help once more ;D




<?php
$cookiename 
YaBBSECookie151;

   if (isset(
$HTTP_COOKIE_VARS[$cookiename]))
   {
      list(
$uid$password) = @unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename]));
      
$uid = (int) $uid;
      if (
$uid <= 0)
         
$uid 0;
   }
$memberID $uid;
echo 
$memberID_rs_cookie;   
$memberID_rs_cookie "$memberID";
if (isset(
$memberID) || $memberID 0) {
  
$memberID_rs_cookie = (get_magic_quotes_gpc()) ? $memberID addslashes($memberID);
}
mysql_select_db($database_forums$forums);
$query_rs_cookie sprintf("SELECT * FROM Forum_members WHERE ID_MEMBER = %s"$memberID_rs_cookie);
$rs_cookie mysql_query($query_rs_cookie$forums) or die(mysql_error());
$row_rs_cookie mysql_fetch_assoc($rs_cookie);
$totalRows_rs_cookie mysql_num_rows($rs_cookie);
?>

<?php if ($totalRows_rs_cookie 0) { // Show if recordset not empty ?>
<strong><font size="2" color="#CC6600" face="Verdana, Arial, Helvetica, sans-serif"> Welcome back
<?php echo $row_rs_cookie['memberName']; ?></font></strong>
<?php
mysql_free_result
($rs_cookie);
?>

<?php 
else{ 
?>
<strong><font size="2" color="#CC6600" face="Verdana, Arial, Helvetica, sans-serif"> Welcome to this site
<? } // Show if recordset not empty ?>



Spaceman-Spiff

check how its done in SSI.php
btw, why not use SSI.php?

horus

After living of people like yourself for years I decided to get off my behind and at least try to understand PHP so I can easily modify scripts or write them myself from scratch, and since practice makes it perfect I'm tweaking the site using mostly my own scripts.

I have a similar problem with the forum and if one is logged and doesn't use the full domain (with "WWW") it doesn't seem to pick up the cookie and keeps asking the user to login, and after login as soon as the user goes to different page then it asks for login again.

horus

#3
Yes! But I have the same problem with SSI, unless the user types the full domain (with wwww) the user shows up as Guest, from what I can understand Yabbse writes the domain in the cookie as a full domain obviously depending on what admin puts in the "Board URL" which in my case is the full URL, if I remove the "WWW" from "Board URL" users that type the full domain would have the same problem

horus

Version/Current Version: YaBB SE 1.5.3/YaBBSe 1.5.4

[Unknown]

Please try my Global Cookies mod.  You'll need to log out and log back in.  (everyone will; you might want to change the cookiename.)

-[Unknown]

horus

After installing "the global cookie mod" I still seem to have the same problem, everything is OK as long as I don't leave out the "www"

I logged out and logged back in, I renamed the cookie still no joy

horus


[Unknown]

After you installed it... did you *ACTIVATE* the global cookies mod?

-[Unknown]

horus

After deleting all my cached cookies and disabling my firewall and so on, I can see that the global cookie mod works fine, but I seem to have quirky problem where if create a file in the same folder as the yabbse and include SSI I can call <username> and it shows my username, but if you take the same file copy it to another directory it returns Guessed.


Thanks for your help guys, it's appreciated more than you can imagine

Advertisement: