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 6045745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:09:33+00:00 2026-05-23T07:09:33+00:00

I have now changed my login system from session_register() to this: UPDATE : <?php

  • 0

I have now changed my login system from session_register() to this:

UPDATE:

<?php
error_reporting(E_ALL);
$host="localhost"; // Host name 
$username="david_bpd"; // Mysql username 
$password="documents123456"; // Mysql password 
$db_name="david_bpd"; // Database name 
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die(mysql_error()); 
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form 
$myusername=$_POST['myusername']; 
$mypassword=$_POST['mypassword'];

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql) or die(mysql_error());

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
if($count==1){
$_SESSION['myusername'] = $myusername;
echo '<meta http-equiv="refresh" content="0;url=/?module=admin&n=Login_success">';
}
elseif($count==0) {
echo '<meta http-equiv="refresh" content="0;url=/?module=admin&n=Login_Unsuccessful">';
}

and I am now using session_start() to make sure the user is logged in:

<?php
session_start();
if (isset($_SESSION['myusername'])) {
if ($_SESSION['myusername'] == $myusername) {
//User should be allowed to be on page
} else {
   echo '<meta http-equiv="refresh" content="0;url=/?module=admin&n=index">';
} 

} else {
echo '<meta http-equiv="refresh" content="0;url=/?module=admin&n=index">';
}
?>

But even when i log in using the right credentials and register my username it still redirects me as if i was not logged in?

Code for submitting form

<table width="300" border="0" align="center" cellpadding="0" cellspacing="1"     bgcolor="#CCCCCC">
<tr>
<form action="/?module=admin&n=checklogin" method="post" enctype="multipart/form-data"     name="form1" id="form1">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Administrator Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input type="text" name="myusername" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td> <button type="submit" name="Submit">Login</button>
<img src="../images/ajax-loader.gif" width="16" height="16" style="display: none"/>
<script>
$("button").click(function () {
$("img").show("slow");
});
</script>
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>

Any ideas,

Thanks

  • 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-05-23T07:09:33+00:00Added an answer on May 23, 2026 at 7:09 am

    You forgot to session_start(); in first file

    <?php
    session_start();
    error_reporting(E_ALL);
    $host="localhost"; // Host name 
    $username="david_bpd"; // Mysql username 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem in fairly simple. I have a login system constructed using php, mysql
What I have now (which successfully loads the plug-in) is this: Assembly myDLL =
We're currently running with php 5.2.5. We have now encountered a bug that creates
I have been using the CodeIgniter system for a while now - but it
I have a facebook login system that seems to work fine, but I want
I have a base page called let's say Login.aspx with Login.aspx.cs code behind. Now...I
I have a few questions about sessions and login/logout systems. In my system, first
I have this html: <div id=signbtn> <a id=login-link class=btnsignin title=Login>Sign in</a> </div> Upon successful
I have now 1gb ram at work(i hope that will change soon) and jboss
I have now worked on two different teams that use the Agile/Scrum approach in

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.