Hi! I am making a personal messaging system for my virtual pet site, but I am having problems. I think that the preuserID varialble isn't showing up for some reason, but I am not sure. I've been working on this script all day! Help much needed. Thanks!
PHP Code:
<?
session_start();
$session=session_id( );
include ("/secure/config.php");
$username=$_POST['to'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$preuserID=$_POST['preuserID'];
$username_check = "SELECT * FROM chibifriends WHERE preuserName = '$username'";
$check_result = mysql_query($username_check,$connection);
$username_data = mysql_fetch_array($check_result);
$check_rows = mysql_num_rows($check_result);
if ($check_rows < 1) {
echo "Sorry, there is no user by the name of $username";
}
else {
function cleanup($subject) {
$words = "form,noscript,meta,iframe,script,layer,style,filter,body,background,cursor,scrollbar,include,****,***,neopets,dick,***,homo,*****,lesbian,dike,pussy,****,sex,blowjob,suck,cwhome,cum,ecritters,aftermathzone,hump,******,gook,spic,*****";
$wordarray = explode(",", $words);
foreach ($wordarray as $word) {
$subject = eregi_replace($word, " ", $subject);
}
return $subject;
}
function cleanup1($message) {
$words = "form,noscript,meta,iframe,script,layer,style,filter,body,background,cursor,scrollbar,include,****,***,neopets,dick,***,homo,*****,lesbian,dike,pussy,****,sex,blowjob,suck,cwhome,cum,ecritters,aftermathzone,hump,******,gook,spic,*****";
$wordarray = explode(",", $words);
foreach ($wordarray as $word) {
$message = eregi_replace($word, " ", $message);
}
return $message;
}
$subject =cleanup($subject);
$message =cleanup1($message);
$toID = $username_data[preuserID];
echo "$message $subject $preuserID $toID";
$send = 'INSERT into starbits values (NULL, "$toID", "'.$preuserID.'", "'.$subject.'", "'.$message.'", "'.$unread.'",);';
$result_send = mysql_query($send)or die("Error 1a");
echo "Your message has been sent!";
}
?>
Comment