1.
Code: Select all
їphp]$tomsg=$_POSTї'outmsg'];//get receive data;
$regї0]='';//check if msg contains nothing more than spaces
$pattern='^\s*$';
$regcheck=ereg($pattern,$tomsg,$reg);
if ($regcheck) {header("Location: index.php");
die();
}ї/php]2.
Code: Select all
їphp]
$query=mysql_query("select * from dk_insmsg where receiver='$userrowїusername]'") or die(mysql_error());
$from=$userrowї'charname'];//sender variable
$to=$to1ї'username'];//receiver variable
$date=time();//now
if (mysql_num_rows($query)>4) {//if too much msgs
$query2=mysql_query("select id from dk_insmsg where receiver='$userrowїusername]' ORDER BY timesent LIMIT 1") or die(mysql_query());
$query3=mysql_fetch_array($query2);//oldest msg
$q3id=$query3ї'id'];//get its id
$query4=mysql_query("replace into dk_insmsg (id,sender,receiver,msg,timesent) values ($q3id,'$from','$to','$tomsg',$date)") or die('cannot replace old msg');//replace old msg
header("Location: index.php");die();//exit
}
else {
$thequery=mysql_query("insert into dk_insmsg (sender,receiver,msg,timesent) values ('$from','$to','$tomsg',$date)") or die('cannot sent msg');//duh
header("Location: index.php");die();//exit
}Can anyone help me solve there 2 problems? Thanks