Jump to content

Kindly check it out


nitation

Recommended Posts

This is the form.php

 

<?php

session_start();

if (!isset ($_SESSION["afso_userid"]))

{
  header ("Location:main.php?login=missing");
}

include("connect.php");

if($log){

$sqllog=mysql_query(" SELECT  * FROM  register_account WHERE account_number='$account_number'  AND  account_key='$account_key' AND status='1' ");
$sqllog=mysql_query("UPDATE register_account  SET  lastlogin= '$lastlogin' where id='$id'");

if($sqllog){
$row=mysql_fetch_array($sqllog);
$rowid=$row["id"];
} 

$num=mysql_num_rows($sqllog);
if($num > 0){

$_SESSION["afso_userid"]=$row["id"];
   header ("Location: index.php");
}
else
{
  header ("Location: main.php?login=wrong");
}

}
?>

Link to comment
Share on other sites

Form variables don't just automagically apear by id name in your code, they are all wrapped inside the $_POST array, which you have referenced nowhere, that's why all your variables are empty.

 

Also you are still inmediatly overwritting your SELECT statement with your UPDATE statement, effectively making the SELECT by account and password completely useless.

Link to comment
Share on other sites

Cool. In a situation like this, how do i update the last login of a specific user? I have also noted that overwriting a select statement will do  my program no good. How do i solve my problem. Can someone give me a sample code???

Link to comment
Share on other sites

Cool. In a situation like this, how do i update the last login of a specific user? I have also noted that overwriting a select statement will do  my program no good. How do i solve my problem. Can someone give me a sample code???

 

 

In my page, to update the user's last login I do this:

 

<?php
// once the login has been verified and mysql_fetch_array has been executed
$id = $row['user_id'];
$now = strtotime("now");
$result = mysql_query("UPDATE User SET user_last_login='$now' WHERE user_id='$id' ") or die(mysql_error());

 

that's all you really need

Link to comment
Share on other sites

Did you even try the code I gave you? Don't see why you were complaining about getting no sample code from anyone...

 

I suffer the same epidemic. People ask for code and when its given, they say "why doesnt anyone help me?" or they try one suggestion of the 5 given and say that it doesnt work and that nobody here knows what theyre talking about.

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.