Php Sessions and cookie problems

Discussion in 'PHP' started by igotdreams, Feb 27, 2006.

  1. #1
    Hey guys, I am putting up a test site for another one of my sites that is written completely in php. My problem is, my login fields are coming out blank after I try to login.

    I only have an IP address for my new host (my testing environment) and the other site is on a domain name. Now this site works fine, but on the new one (where I only have an ip address) it does not.

    Here is my set cookie code with an ip address instead of a domain.

    setcookie ("username", $check, time() + 2419200, "/", "64.8.116.246");

    Is there another way to use an IP address. The site that is working is like this;

    setcookie ("username", $check[email], time() + 2419200, "/", ".domainname");

    I am really trying to figure this problem out, it is wasting a lot of my time.
     
    igotdreams, Feb 27, 2006 IP
  2. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Why do you necessarily need to specify the domain?
     
    neroux, Feb 28, 2006 IP
  3. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #3
    You realize, in some cases, two domains can have the same IP?

    This is not the way to code cookies maybe?

    http://us3.php.net/manual/en/function.setcookie.php
     
    noppid, Feb 28, 2006 IP
  4. vishwaa

    vishwaa Well-Known Member

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #4
     
    vishwaa, Feb 28, 2006 IP
  5. igotdreams

    igotdreams Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you all for your help, but I am aware of setting up with a domain and I am aware of shared IP's. I have a dedicated IP and I MUST use the IP. This is my test site. I do not have a domain name pointed to it.

    So please help me to figure it out using an ip of we can. My IP and not their Ip.

    Thanks

    setcookie ("username", $check, time() + 2419200, "/", "64.8.116.246");
     
    igotdreams, Mar 1, 2006 IP
  6. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Well, I am repeating my question.

    Why do you necessarily need to specify the domain?

    Why wouldnt
    setcookie ('username', $check['email'], time() + 2419200);
    PHP:
    work?
     
    neroux, Mar 1, 2006 IP
  7. vishwaa

    vishwaa Well-Known Member

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #7
     
    vishwaa, Mar 1, 2006 IP
  8. tccoder

    tccoder Peon

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    setcookie ("username", $check, time() + 2419200, "/");
     
    tccoder, Mar 7, 2006 IP