1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

$_SESSION problems on godaddy..

Discussion in 'PHP' started by Fracisc, Sep 23, 2009.

  1. #1
    Hey folks!

    I have this:
    session_start();
    var_dump($_SESSION);
    Code (markup):
    The result is:
    array(2) { ["myusername"]=>  NULL ["mypassword"]=>  NULL } 
    Code (markup):
    On my other hosting it was working just fine. I moved to godaddy and it is not working here...

    Is there anything I can do to fix this? I have php5.
     
    Fracisc, Sep 23, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Can you show where you do $_SESSION['myusername'] = .. ; ?

    I suspect your script probably used register globals which is not enabled by default any more in recent PHP versions (for security reasons)
     
    premiumscripts, Sep 23, 2009 IP
  3. TheOnly92

    TheOnly92 Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It's wise to see if other scripts work too. Do a simple test like

    session_start();
    if (!isset($_SESSION['test'])) {
    $_SESSION['test'] = "If this appears it's success!";
    echo('Session set, refresh the page.');
    } else {
    var_dump($_SESSION);
    }
    Code (markup):
    Will it work?
     
    TheOnly92, Sep 23, 2009 IP
  4. Fracisc

    Fracisc Well-Known Member

    Messages:
    3,670
    Likes Received:
    10
    Best Answers:
    1
    Trophy Points:
    195
    #4
    @TheOnly92: It is working if I am doing it your way. Right now I have a login form with POST..

    The strange thing is that
    $_SESSION['myusername'] = $_POST['myusername'];
    Code (markup):
    also does not work...
     
    Fracisc, Sep 23, 2009 IP
  5. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #5
    do

    echo "<pre>";print_r($_POST);echo "</pre>"; and see if it's empty or not..
     
    premiumscripts, Sep 23, 2009 IP
  6. TheOnly92

    TheOnly92 Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I guess maybe there's something wrong with your form? Check your name and etc, and try to add premiumscripts's line in.
     
    TheOnly92, Sep 23, 2009 IP