SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems after moving to a new host

    Hello,

    We have just decided to switch to a new server and I have been trying to get everything working on the new host. I have been able to get our forums, blogs etc. working without too much hassle but surprisingly I haven't been able to get the little presentation script working. I have been reading through webpages and forums but because my knowledge of PHP is limited I don't know what could make the script work on our old host but not on the new on.

    My guess is that it has something to do with different PHP & MySQL versions.
    My old host was using following PHP and MySQL versions:
    PHP VERSION: 4.4.0, mySQL VERSION: 3.23.58

    New host is using the following versions:
    PHP VERSION: 4.3.10, mySQL VERSION: 4.0.25

    When trying to login to the presentation editing pages I get the same form back without any error message. Also the forgotten username/password form doesn't work anymore. The access control script looks like following.

    Code for the username and password retrieval.

    Code:
    <?
    
    $showform = "no";
    
    if (!isset($email))
    $showform = "yes"; 
    
    else {
    
    // validate email address
    
    if ( ( !ereg ("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $email ) ) || ( $email == "" ) ){
    echo "Sähköpostiosoite ei kelpaa. <br>";
    $showform = "yes";
    }
     
    } // end else
    
    if ($showform == "yes"){
    echo "<FORM name=\"thisform\" method=\"POST\" action=\"$PHP_SELF\">
    <input type=\"text\" class=\"forminput\" name=\"email\" style='width:65%' maxlength=50 value=\"$email\" >
    
    <INPUT type=\"hidden\" class=\"forminput\" name=\"showform\" value=\"no\"><br>";
    ?>	
    <INPUT class="forminput" TYPE="submit" NAME="submit" VALUE="Lähetä">
    <?
    echo "</form> ";
    }
    else {
    
    // retrieve login data from database
    
    dbConnect("database");
    
    $nimimerkitdat = @mysql_query("select nimimerkit from profiles where email='$email'");
    if(mysql_num_rows($nimimerkitdat) == 0) { echo "<BR><BR>Valitamme, antamaasi sähköpostiosoitetta ei löydy tietokannastamme.<BR><A HREF='http://www.kotichat.com/esittelyt/editprofile.php'>Palaa</A> takaisin ja yritä uudelleen."; die(); }
    $nimimerkitfound = @mysql_result($nimimerkitdat, 0, 0);
    
    $passworddat = @mysql_query("select password from profiles where email='$email'");
    $passwordfound = @mysql_result($passworddat, 0, 0);
    
    $message = "Hei,\nSait tämän sähköpostin, koska pyysit saada salasanasi KotiChat.com sivustolta löytyvään esittelyysi.\nPyytämäsi tiedot:\nNimimerkki:    $nimimerkitfound\nSalasana:      $passwordfound\n\n--\n  Terveisin,\n Ylläpito KotiChat.com\n palaute@kotichat.com\n http://www.kotichat.com\n
    ";
    
    
    mail( $email, "KotiChat esittelyyn kirjautuminen", $message, "From: asiakaspalvelu@kotichat.com" );
    echo "<BR><BR>Kiitos.<BR>Nimimerkkisi ja salasanasi on lähetetty antamaasi sähköpostiosoitteeseen.";
    }
    ?>
    Session register code looks like following which to my knowledge should let me edit my presentation.:

    Code:
    <?php
    exit;
    }
    
    session_register("nimimerkit");
    session_register("password");
    
    dbConnect("kotichat_db");
    
    $sql = "select * from profiles where nimimerkit = '$nimimerkit' and password = '$password'";
    $result = mysql_query($sql);
    if (!$result) {
      error("A database error occurred while checking your login details.");
    }
    
    if (mysql_num_rows($result) == 0) {
      session_unregister("nimimerkit");
      session_unregister("password");
    
    ?>
    Any help would be appreciated. I have only this week to verify that everything we need works on the new server.

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a problem with register_globals. You'll have to change things like $email to $_POST['email']
    Thank you for wearing pants

  3. #3
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent.

    Thank you very much. That seems to have solved all my problems.


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
  •