simple thanking code

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

3 replies · 504 views · started 17 years ago · 1 min read

2 participants
nclemale36 Lead · 537 posts #1
////////////////////
else if($action=="thank")
{
  $thank= mysql_real_escape_string( $_REQUEST["thank"] );
  
  $who = mysql_real_escape_string( $_REQUEST["who"] );

   addonline(getuid_sid($sid),"thanking a member","");

if ($uid==$who)
{
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "You Cant thank yourself silly <br/>";
      echo "</p></body></html>";
      exit();
}

  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
       echo "<p align=\"center\">";

    $tha = mysql_fetch_array(mysql_query("SELECT thank FROM dave_users WHERE id='".$uid."'"));
    $tha = $tha[0]+1;
    mysql_query("UPDATE dave_users SET thank='".$tha."' WHERE id='".$uid."'");

  if($res)
   {
        echo "<img src=\"../images/ok.gif\" alt=\"o\"/> thanked successfully<br/>";
   }else {
        echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have thanked this user before<br/>";
   }

  echo "<br/><br/>";
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";
  }

error i get is that it dont update it goes to you have thanked this user before without updating it .

prob something simple but am shattered .

crazybrumi Super moderator Principal · 1,064 posts #2

try this

////////////////////
else if($action=="thank")
{
  $thank= mysql_real_escape_string( $_REQUEST["thank"] );
  
  $who = mysql_real_escape_string( $_REQUEST["who"] );

   addonline(getuid_sid($sid),"thanking a member","");

if ($uid==$who)
{
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "You Cant thank yourself silly <br/>";
      echo "</p></body></html>";
      exit();
}

  
      echo "<head>";
      echo "<title>$sitename</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo "</head>";
      echo "<body>";
       echo "<p align=\"center\">";

  

$tha = mysql_fetch_array(mysql_query("SELECT thank FROM dave_users WHERE id='".$who."'"));
     $res=mysql_query("UPDATE dave_users SET thank='".($tha[0]+1)."' WHERE id='".$who."'");

  if($res){
  echo "<img src=\"../images/ok.gif\" alt=\"o\"/> thanked successfully<br/>";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"x\"/>You have thanked this user before<br/>";
  }

  echo "<br/><br/>";
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p></body>";

}

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

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