Menu

problem with cookie.inc.php

aexley
2005-01-26
2013-06-03
  • aexley

    aexley - 2005-01-26

    I just loaded phphelpdesk up on Apache 2.0.52/PHP v4.3.10/MySQL 4.1.8, and get this message whenever I go to "view tickets"
    Warning: setcookie() expects parameter 3 to be long, string given in C:\XAMPP\xampp\htdocs\phphelpdesk\includes\cookie.inc.php on line 8

    Warning: setcookie() expects parameter 3 to be long, string given in C:\XAMPP\xampp\htdocs\phphelpdesk\includes\cookie.inc.php on line 9

    Warning: setcookie() expects parameter 3 to be long, string given in C:\XAMPP\xampp\htdocs\phphelpdesk\includes\cookie.inc.php on line 10

    Warning: setcookie() expects parameter 3 to be long, string given in C:\XAMPP\xampp\htdocs\phphelpdesk\includes\cookie.inc.php on line 11

    Warning: setcookie() expects parameter 3 to be long, string given in C:\XAMPP\xampp\htdocs\phphelpdesk\includes\cookie.inc.php on line 12

    my config.inc.php looks like this:
    <?php

    // Modified by Andrew Walker (ajwalker@home.com)
    $time = mktime()+$g_cookietimeout;
    $date = date("l, d-M-y H:i:s", ($time));

    if (isset($authentication)) {
    setcookie("status", $status, $date);
    setcookie("user", $user, $date);
    setcookie("group", $group, $date);
    setcookie("authentication", $authentication, $date);
    setcookie("laston", $laston, $date);
    }
    else {
    setcookie("status", "Logged In", $date);
    setcookie("user", $txtUsername, $date);
    setcookie("group", $row[4], $date);
    setcookie("authentication", "YES", $date);
    setcookie("laston", $row[6], $date);
    }

    ?>

    if I ignore the errors, and attempt to ckick on a ticket to view, I get kiecked back out to the logon screen.

    HELP!!??

    aexley@coordinatedhealth.com

     
    • Wayland

      Wayland - 2005-05-03

      i got the exact same error. Seems that the setcookie command change in the new version of php.
      We will have to wait till the next release of php Helpdesk to see this corrected, i hope.

       
    • phd

      phd - 2005-05-08

      I don't know if you are still monitoring this forum but here is the fix I came up with.  I don't know the security impact of this fix so USE at your OWN RISK.  I know enough about PHP scripting to make changes I need, create network apps I need and be very dangerous in the process.  Change the IF section of cookie.inc.php to look like the following.  You DO NOT need to change the ELSE section.

      if (isset($authentication)) {
          setcookie("status", $status, 0);
          setcookie("user", $user, 0);
          setcookie("group", $group, 0);
          setcookie("authentication", $authentication, 0);
          setcookie("laston", $laston, 0);

      All you are doing is changing $date to 0.  Again, use this at your own risk.  I am running PHP 4.3.8, Apache 2.0.50 and MySQL 4.1.10 so I would guess the environment is close enough to yours to work.  It appears that setcookie() parameters were changed in 4.2.0.  The 0 represents the integer for expiration.  The variables for $date and $time are mal formed for current versions of PHP based on the changes to 4.2.0.  For more information and I recommend you check it out to ensure security is high enough for you, see http://us3.php.net/manual/en/function.setcookie.php

      Hope this helps you.  PHD

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.