Jump to content

Comparing variables


Tandem

Recommended Posts

Hi,
I have a form on my site where users are supposed to input the name of another user. I want to make sure that people cannot enter their own username instead of somebody elses. It also has to be case insensitive, because with the previuos piece of code i had, people were just inputting their own username in different cases to get around it.

Here's something similar to what i had before:
[code]
<?php

$other_user = $_POST['otheruser'];

if ($other_user == $_SESSION[username]) {
echo "Invalid";
exit();
}

?>
[/code]

I also tried a something with eregi that somebody told me would work, but that didn't work too well, and detected similar usernames as well as matches, but i deleted it and forgot the exact setup of it.

Can someone suggest to me a solution?

Thanks in advance.
Link to comment
https://forums.phpfreaks.com/topic/23462-comparing-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.