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