runnerjp Posted June 6, 2008 Share Posted June 6, 2008 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"; } } ?> Quote Link to comment Share on other sites More sharing options...
amites Posted June 6, 2008 Share Posted June 6, 2008 please be more specific in your questioning, no reference for what data is sent, how users are handled etc... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.