Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:52:43+00:00 2026-06-13T12:52:43+00:00

I’m having a problem with registering sessions on my websites login script: so the

  • 0

I’m having a problem with registering sessions on my websites login script:
so the thing is like this, I’m working on my site with webmatrix and I worked on the same files on two different computers, also I have the site uploaded to a server. in all three cases it works just fine!
recently I created the very same working environment on a laptop I have, webmatrix + xampp mysql db – only here I found out that sessions refuse to be created, the code:

(the login page is included in the index.php page.

<?php
session_start();
$no_mail_pass_error="";
$no_user_error="";
$wrong_pass_error="";

if ($_POST['submit_login']){

$log_email = $_POST ["log_email"]; //VAR $email = to what usename has entered
$log_password = $_POST ["log_password"]; //VAR $password = to what usename has entered
$remember_me = $_POST ["remember_me"];

$log_email = strip_tags($log_email);
$log_password = strip_tags($log_password);

$log_email = mysql_real_escape_string($log_email);
$log_password = mysql_real_escape_string($log_password);

if ($log_email==""||$log_password=="") {
$no_mail_pass_error='
    <div id="login_errors_div" style="display:none;">
    <table border="0">
    <tr>
    <td>
    <img src="ec_mark_25.png"/>   
    </td>
    <td>
    no mail    
    </td>    
    </tr>
    </table>
    <hr />
     </div>

     ';
}
else {

$login_connect = mysql_connect ("***", "***", "***")

or die ("couldnt connect");
mysql_select_db (***) or die ("not found"); //if db was not found die
mysql_query("SET NAMES 'utf8'");

$login_query = mysql_query("SELECT * FROM users WHERE email='$log_email'"); //search for specific username entered

$login_numrows = mysql_num_rows($login_query); //check that it appears AT LEAST in ONE row

if ($login_numrows!=0) // IF IT APPEARS IN NONE - NO USER EXISTS

    {

    while ($row = mysql_fetch_assoc($login_query)) //Takes the whole row of the specific user and extracts all the fields
    {
        $dbemail = $row['email'];
        $dbpassword = $row['password']; //Sets thoes fields into variables
        $id = $row['id'];
        $log_firstname = $row['firstname'];
        $log_lastname = $row['lastname'];
    }

    if ($log_email==$dbemail&&md5($log_password)==$dbpassword)

    {

    if ($remember_me=='on') {
    setcookie ("email",$email,time()+604800);

          session_register('email');
          $_SESSION['email']=$log_email;

          session_register('id');
          $_SESSION['id']=$id;

          session_register('firstname');
          $_SESSION['firstname']=$log_firstname;

          session_register('lastname');
          $_SESSION['lastname']=$log_lastname;

    header ("Location: homepage.php");
    }
    else if ($remember_me=='') {

          session_register('email');
          $_SESSION['email']=$log_email;


          session_register('id');
          $_SESSION['id']=$id;

          session_register('firstname');
          $_SESSION['firstname']=$log_firstname;

          session_register('lastname');
          $_SESSION['lastname']=$log_lastname;


          header ("Location: homepage.php");
          }

    }
    else {
    $wrong_pass_error='
    <div id="wrong_pass_error_div" style="display:none;">
    <table border="0">
    <tr>
    <td>
    <img src="ec_mark_25.png"/>   
    </td>
    <td>
   wrong pass   
    </td>    
    </tr>
    </table>
    <hr />
     </div>
     ';
    }


    }

    else {
    $no_user_error='
    <div id="no_user_error_div" style="display:none;">
    <table border="0">
    <tr>
    <td>
    <img src="ec_mark_25.png"/>   
    </td>
    <td>
    user not found
    </td>    
    </tr>
    </table>
    <hr />
     </div>
     ';
    }
}

}
?>
<form name="login_form" id="logn_form" method="post" action="index.php">
<table border="0" style="margin-left: 60px; margin-bottom: 3px;">

    <tr>    

    <td id="login_info">mail</td>
    <td id="login_info">pass</td>
    <td></td>
    </tr>

    <tr>
    <td><input id="login_input" name="log_email" type="text"/></td>
    <td><input id="login_input" name="log_password" type="password"/></td>
    <td><input id="login_submit" name="submit_login" type="submit" value="enter"/></td>
    </tr>

    <tr>
    <td valign="top">
    <!-- TABLE FOR REMEMBER ME -->  
    <table style="margin: 0px; padding:0px;"><tr>
    <td>  
    <input name="remember_me" type="checkbox"/>
    </td>
    <td>remember me</td>
    </tr></table>
    <!-- TABLE FOR REMEMBER ME - END -->    
        </td>
    <td valign="top"><div style="margin-top: 5px; margin-right: 5px;"><a id="forgot_password_a" href="#">forgot pass</a></div></td>
    </tr>
    </table>
    </form>

What could be preventing the sessions from registering?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:52:44+00:00Added an answer on June 13, 2026 at 12:52 pm

    Posting my comment as an answer 😉

    Check your PHP version (I believe they differ from both environments).

    session_register has been deprecated as of PHP 5.3 and in PHP >= 5.4 removed. Just remove session_register and use $_SESSION['key'] = "value"; instead.

    See session_register docs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.