Jump to content

stping users adding themselfs


runnerjp

Recommended Posts

how could i stop a user adding themself ??

 

<link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css">
<?php
session_start();
require_once '../settings.php';
checkLogin ('1 2');

if ( !empty($_GET['user']) ) {
if ( ctype_alnum($_GET['user']) && strlen($_GET['user']) <= 10 ) {
  // further test and escape data
}

$user = $_GET['user'];
$get_username_value = get_username($id);
$query = "SELECT * FROM friends WHERE username ='$user' AND friendname='$get_username_value'";
echo $query;
$result = mysql_query($query);
$exist = mysql_num_rows($result);  // Does the row exists?
if($exist=='0')
{
$query = "INSERT INTO friend_requests (username ,by_user) VALUES('$user', '$get_username_value')";
  $result= mysql_query($query)
    or die("QUERY ERROR:<br />{$query}<br />" . mysql_error() );

  echo "$user has been sent a request you must now wait for it to be accepted";
  // useful in troubleshooting the SQL statement
  

} else {
  echo "you are allready friends with this user";
} 
}
?> 

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.