SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry My host has just upgraded, and now my scripts don't work properly? Argh!

    Hey,

    Hosts just upgraded my server 2 PHP 4.1.2 or maybe 20 or something, anyway it's not the latest version!

    Now, my log in script doesn't work properly, I phoned them and they say, not our problem, debug it yourself. It's a problem with sessions I think. Anyway this is the code I use for creating a session:
    PHP Code:
    session_save_path('public_html/accessdata');
    session_start();
     
    session_register('access_id');
    session_register('access_userid');
    session_register('access_firstname');
    session_register('access_email');
     
    $access_id mysql_result ($res_access,0,"id" );
    $access_userid mysql_result ($res_access,0,"userid" );
    $access_name mysql_result ($res_access,0,"firstname" );
    $access_email mysql_result ($res_access,0,"email" );
    $access_firstname strtolower ($access_firstname);
    $access_firstname ucwords ($access_firstname); 
    That is used for the login.php page which authenticates the user. NOW, I have an image on my site that says if they are logged in or not. Once they log in it changes from "You are not logged in" to "You are logged in". This is the code for that:
    PHP Code:
    session_save_path('public_html/accessdata');
    session_start();
     
    if (
    $access_firstname=="" ) {
    $title '<img src="[url=http://www.ourincomesplus.net/images/menu-notloggedin.png]images/menu-notloggedin.png[/url]" width="135" height="18">';
    }else{ 
    $title '<img src="[url=http://www.ourincomesplus.net/images/menu-loggedin.png]images/menu-loggedin.png[/url]" width="135" height="18">';

    Now when I log in, it still says I am not logged in. What's going on? Is my PHP code not correct for the upgraded version?

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't know, phpinfo() is disabled for security reasons. Guess I'll have to phone them.

    Or is there a way of testing it?

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Create the file below and call it with www.yoursite.com/test.php?val=TESTING ... if the display is Value is TESTING then register_globals is On.
    PHP Code:
    // test.php
    echo "Value is $val"
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers, they are on as I received the val TESTING on the page. is this good or bad news with my problem?

  6. #6
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Depends on what errors you are getting. Need more info to be able to help ... I don't have time to review and debug your code without some pointers.
    Ian Anderson
    www.siteguru.co.uk

  7. #7
    SitePoint Addict
    Join Date
    Oct 2002
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well the only problem really is what I mentioned above about the wrong file showing even if they are logged in.

    ANother problem though, is that when the user presses the submit button on the "login.php" page it uses a file called "adv_access.php" to check the users details against the database, if they are there it then creates a session for them, if not it gives them errors. Now, if it's successful it should direct them to a file called "welcome.php" but it doesn't...it just says "adv_access.php" at the top of the address bar.

    Here is the code for the "adv_access.php" file:

    PHP Code:
    <?php
    include("access/data.inc.php");
    if (
    $variables!=""
     { 
     
    $variables base64_decode ($variables);
     
    $data explode ("||",$variables);
     
    $id $data[0];
     
    $password $data[1];
     }

    mysql_connect ($SQLhost$SQLuser$SQLpass);
     
    mysql_select_db ($SQLdb);
      
    $res_access mysql_query ("SELECT id, userid, registered, firstname, email FROM users where userid='$id' and password='$password' and registered='1'");
      
    $num_access mysql_num_rows ($res_access);

    /* user not found */
    if ($num_access == 0
     {
      
    header("Location: $VARredirect");
      exit; 
     }
    /* user found, opening session */
    session_save_path('public_html/accessdata'); 
    session_start(); 
    session_register('access_id');
    session_register('access_userid');
    session_register('access_firstname');
    session_register('access_email');
     
     
    $access_id mysql_result ($res_access,0,"id");
     
    $access_userid mysql_result ($res_access,0,"userid");
     
    $access_name mysql_result ($res_access,0,"firstname");
     
    $access_email mysql_result ($res_access,0,"email");
     
    $access_firstname strtolower ($access_firstname);
     
    $access_firstname ucwords ($access_firstname);
     
    header("Location: /members/welcome.php");
    exit;
    ?>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •