Jump to content

PHP & MS Access login question


bCourtney07

Recommended Posts

I have login information stored in an access database. I have a form where they enter information to put into the database. Each time they enter in new information it puts a new record with their information along with their ID's. Now my question is, if I have a login page where they put in their id, how can i get that information to stay, like a session id or something? What can i use? Sessions or cookies? I'm lost here ??? ha go figure. Basically i guess just keeping their id to the next page where they enter in additional information so that the id goes into the same record as the additional information if that makes any sense?

 

I appologize if i confuse anyone. i'm pretty confused myself.

 

If someone could point me in the right direction i would greatly appreciate it. Maybe a  tutorial?

 

Thanks in advance!

Link to comment
Share on other sites

Thanks! I'll try that then.

 

My next question is..  how could i validate that the user exists? Here is my code so far

 

<?php
session_start();
require("config.php");
if($_GET['action'] == 'check')
{


   if(empty($_POST['Employee_ID']) || empty($_POST['Last_Name']))
    {
      //if everything is not filled in than prints out error message
  error("blank");
  exit;
      }

      $sql="SELECT * FROM $analyzer_query WHERE Employee_ID='$Employee_ID' and Last_Name='$Last_Name'";
$result=$db_conn->Execute($sql);

//counting table row
$count=$db_conn->$result->Fields->Count();
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("Employee_ID");
header("location:WellnessForm.php");
}
else {
echo "Wrong Employee ID or Password";
}
}
function error($error)
{
   //if error is equal to blank
   if($error == 'blank')
      {
      echo "Please fill in all the required fields before submitting";
      }
//if error is equal to blank
   if($error == 'user')
      {
      echo "Please fill in the correct Employee ID";
      }
}
?>

 

with this in the config.php file

 

<?php
$db_conn = new COM("ADODB.Connection");
$connstr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Wellness Program\Copy of HR Employee Wellness Program.mdb;";
$db_conn->open($connstr);
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.