send pm to doesn't work

Started on the old forum in October 2011 · view the original in the archive · old links redirect here

#inbox #nick #uid

2 replies · 249 views · started 15 years ago · 1 min read

3 participants
dominik92r Junior · 38 posts #1

hello coderz, I have a problem in my inbox.php file. I would like to type in the recipient's nickname and not the number of the uid. This is piece of my code:

 

 
 if(isset($_POST["submit"])){
 
 if(valid(getuid_hits($hits)))
 {
    echo "<div class=\"error\">Error this account isn't active</div>";
 }else if(istrashed(getuid_hits($hits)))
 {
    echo " <b>You Has Been Mute!!</b>";
    }else{
  $whoid = $_POST["whoid"];
    if($whoid==0)
    {
      echo "<div class=\"error\">Error this user doesn't exist</div>";
    }else{
  $whonick = getnick_uid($whoid);
  
  $byuid = getuid_hits($hits);
  $tm = time();
  $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM mx_private WHERE byuid='".$byuid."'"));
  $pmfl = $lastpm[0]+27;
  if($pmfl<$tm)
  {
    if(!isblocked($pmtext,$byuid))
    {
    if((!isignored($byuid, $whoid))&&(!istrashed($byuid)))
    {
  $res = mysql_query("INSERT INTO mx_private SET text='".$pmtext."', sub='".$pmsub."', byuid='".$byuid."', touid='".$whoid."', timesent='".$tm."'");
  }else{
    $res = true;
  }
  if($res)
  {
    echo "<div class=\"ok\">Pm posted to $whonick . </div>";
  }else{
    echo "<div class=\"error\">Error pm doesn't posted to$whonick .</div>";
  }
  }else{
    echo "<div class=\"error\">Error pm doesn't posted to$whonick .</div>";
  }
  }else{
    $rema = $pmfl - $tm;
    echo "<div class=\"info\">Flood control: $rema seconds</div>";
 }
 }
 }

 }

  echo "<form action=\"inbox.php?show=wiaddo&hits=$hits\" method=\"post\">";
  echo "Nick:<br/><input name=\"whoid\" format=\"*N\" maxlength=\"5\"/><br/>";
  echo "Subject:<br/><input name=\"pmsub\" maxlength=\"20\"/><br/>";
  echo "text:<br/><input name=\"pmtext\" maxlength=\"500\"/><br/>";
    echo "<input type=\"submit\" name=\"submit\" value=\"send\"/></form></div></div>";

    echo "</body>";
i0nutzxp Developer · 150 posts #2

Instead $whoid = $_POST["whoid"];

$whoid = isset($_POST['whoid']) ? mysql_real_escape_string($_POST['whoid']) : ''; if ( ! is_int($whoid)) $whoid = getnick_uid($whoid);

<?php unlink('World/Europe/Romania.country'); ?>
something else Fellow · 2,296 posts #3

change: $whoid = $_POST["whoid"]; to: $whoid = getuid_nick($_POST["whoid"); and delete: format="*N" maxlength="5"

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close