PHP login/register problems

Thanks man!

I’ll test it as fast as I can (I don’t have the computer with the other files on until 8pm)

I really appreciate what you’re doing for me :slight_smile:

Thanks! :smiley: Everything works great

That was all I needed and I appreciate what you have done for me really much :slight_smile:

Now my problem is solved thanks to you :slight_smile:

You are welcome, If you need anything else let me know :stuck_out_tongue:

Okay :slight_smile:

Do you want me to email you to the email you wrote in the files when I’m done so you can see the final result?

Not necessary, I was just checking how the mail would go to the users. Therefore I used my own details.

If want to share your work just share it this thread. May be someone else with more experience give a better suggestion. :slight_smile:

Okay :slight_smile:

Fatal error: Cannot redeclare evalLoggedUser() (previously declared in C:\xampp\htdocs\Web_intersect\php_includes\check_login_status.php:12) in C:\xampp\htdocs\Web_intersect\php_includes\check_login_status.php on line 19

What does this mean?

Here’s the code:

[php]

<?php session_start(); include_once("db_conx.php"); // Files that inculde this file at the very top would NOT require // connection to database or session_start(), be careful. // Initialize some vars $user_ok = false; $log_id = ""; $log_username = ""; $log_password = ""; // User Verify function function evalLoggedUser($conx,$id,$u,$p){ $sql = "SELECT ip FROM users WHERE id='$id' AND username='$u' AND password='$p' AND activated='1' LIMIT 1"; $query = mysqli_query($conx, $sql); $numrows = mysqli_num_rows($query); if($numrows > 0){ return true; } } if(isset($_SESSION["userid"]) && isset($_SESSION["username"]) && isset($_SESSION["password"])) { $log_id = preg_replace('#[^0-9]#', '', $_SESSION['userid']); $log_username = preg_replace('#[^a-z0-9]#i', '', $_SESSION['username']); $log_password = preg_replace('#[^a-z0-9]#i', '', $_SESSION['password']); // Verify the user $user_ok = evalLoggedUser($db_conx,$log_id,$log_username,$log_password); } else if(isset($_COOKIE["id"]) && isset($_COOKIE["user"]) && isset($_COOKIE["pass"])){ $_SESSION['userid'] = preg_replace('#[^0-9]#', '', $_COOKIE['id']); $_SESSION['username'] = preg_replace('#[^a-z0-9]#i', '', $_COOKIE['user']); $_SESSION['password'] = preg_replace('#[^a-z0-9]#i', '', $_COOKIE['pass']); $log_id = $_SESSION['userid']; $log_username = $_SESSION['username']; $log_password = $_SESSION['password']; // Verify the user $user_ok = evalLoggedUser($db_conx,$log_id,$log_username,$log_password); if($user_ok == true){ // Update their lastlogin datetime field $sql = "UPDATE users SET lastlogin=now() WHERE id='$log_id' LIMIT 1"; $query = mysqli_query($db_conx, $sql); } } ?>

[/php]

Thanks in advance!

You have declared two functions with the same name at line 12 and line 19 on check_login_status.php file. Your function names should be unique.

How do I fix it?

line 12 create the new function and line 19 close it…

[php]
function evalLoggedUser($conx,$id,$u,$p){
$sql = “SELECT ip FROM users WHERE id=’$id’ AND username=’$u’ AND password=’$p’ AND activated=‘1’ LIMIT 1”;
$query = mysqli_query($conx, $sql);
$numrows = mysqli_num_rows($query);
if($numrows > 0){
return true;
}
}
[/php]

Thanks in advance

it’s fixed now :slight_smile:

Oh… I’m sorry I totally forgot about it. :’(

So what was the problem?

I used the include script but I had to include_once :slight_smile:

You used include_once earlier in the script too???

Sponsor our Newsletter | Privacy Policy | Terms of Service