Noone ?
I tried to fix but cant find the solution.
Added a test comment from phpmyadmin and the user can delete the comment...
So, only "add comment" is problematic i guess..
The function is below ;
Code:
function addComment( $profileID )
{
global $record_maxlength;
global $period;
global $record_limit;
global $logged;
$ret = "";
$record_text = process_db_input(strmaxtextlen( $_POST['commenttext'], $record_maxlength ));
$record_sender = strlen($_COOKIE['memberID']) ? (int)$_COOKIE['memberID'] : "";
$record_recipient = (int)$profileID;
$ip = ( getenv('HTTP_CLIENT_IP') ? getenv('HTTP_CLIENT_IP') : getenv('REMOTE_ADDR') );
if($_POST['replyTO'] > 0 )
{
$replyTO = (int)$_POST['replyTO'];
}
else
{
$replyTO = 'NULL';
}
if ( !$record_recipient )
return $ret;
if( !$record_sender )
{
return $ret;
}
if( strlen($record_text) < 2 )
{
$ret .= _t_err("_enter_message_text");
return $ret;
}
// Test if IP is defined
if ( !$ip )
{
$ret .= _t_err("_sorry, i can not define you ip adress. IT'S TIME TO COME OUT !");
return $ret;
}
// Test if last message is old enough
$last_count = db_arr( "SELECT COUNT( * ) AS `last_count` FROM `ProfilesComments` WHERE `IP` = '{$ip}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(`Date`) < {$period}*60)" );
if ( $last_count['last_count'] != 0 )
{
$ret .= _t_err("_You have to wait for PERIOD minutes before you can write another message!", $period);
return $ret;
}
// Perform insertion
db_res( "INSERT INTO `ProfilesComments` SET `Date` = NOW(), `IP` = '{$ip}', `Sender` = '{$record_sender}', `Recipient` = '{$record_recipient}', `Text` = '{$record_text}', `New` = '1', `ReplyTO` = {$replyTO};" );
//echo "INSERT INTO `ProfilesComments` SET `Date` = NOW(), `IP` = '{$ip}', `Sender` = '{$record_sender}', `Recipient` = '{$record_recipient}', `Text` = '{$record_text}', `New` = '1', `ReplyTO` = {$replyTO};" . '<hr>';
return $ret;
}
Bookmarks