Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 8th, 2004, 06:48 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Buravik Send a message via Yahoo to Buravik
Default COOKIE problem

Hi !
I have problem with COOKIES !
This code worked perfectli in my computer... On my computer installed PHP 4.3.2 version.. But on Linux machine which installed PHP 4.2.2 browser can't remember cookies USERNAME and PASSWORD?
why?
Any comments.. thanks !

    $conn = mysql_connect("localhost", USER_BASE_CONNECT, CONNECT_PASSWORD);
    mysql_select_db(SYSTEM_BASE,$conn);
    $MyNewsql=("INSERT INTO ". STUDENTS_TABLE ." (StudentName, StudentLastName, StudentSurName, StudentGroup, StudentFaculty, StudentDirection) VaLues ('".$_POST['StudentName']."', '".$_POST['StudentLastName']."', '".$_POST['StudentSurName']."', ".$GroupId.", ".$FacultyId.", ".$DirectionId.")");

    if (mysql_query($MyNewsql, $conn))
    {
        $MySystemMessage = $lang['INSERT_SUCCESFULL'];
        $num = MY_REPLACE_WORD;
        $ReplaceTo = $DirectionName_uzb;
        $MySystemMessage1 = ereg_replace($num, $ReplaceTo, $MySystemMessage);
    }

        $MyQuery = "SELECT last_insert_id() as MyStudentId";
    if (!$sql->query($MyQuery))
    {
        die($sql->error());
    }
    while ($row = $sql->fetchObject())
    {
        setcookie ("USERNAME", $row -> MyStudentId);
        setcookie ("PASSWORD", "");

        $username = $row -> MyStudentId;
        $password = "";
    }

 
Old May 8th, 2004, 07:49 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Are you accessing the cookies with $_COOKIE? register_globals is off if you are trying to access it with a normal variable (i.e. $USERNAME).

HTH,

Snib

<><
 
Old May 9th, 2004, 08:47 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Buravik Send a message via Yahoo to Buravik
Default

Thanks Snib,
But i don't understand what you mean... Yes i am using $_COOKIE and register_globals is off...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cookie problem ps0208 Servlets 1 November 5th, 2007 05:55 AM
Cookie problem Raptor-X ASP.NET 2.0 Basics 0 November 16th, 2006 08:58 AM
Cookie Problem jobiweb ASP.NET 1.0 and 1.1 Basics 0 May 12th, 2005 06:10 AM
Session cookie problem rogierio Classic ASP Professional 0 October 15th, 2003 09:50 AM
cookie problem bluewater68 Classic ASP Professional 0 August 26th, 2003 06:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.