Pluses In Every Action
Started on the old forum in January 2008 · view the original in the archive · old links redirect here
Use somethng like this in every action
$uipa = $uipa+1;
$uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
$uip = $uipa + $uip[0];
mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'");
where must i put that code?
else if($action=="newtopic") { $fid = $_GET["fid"]; if(!canaccess(getuid_sid($sid), $fid)) <------here? { echo "<card id="main" title="$sitename">"; <------here? echo " "; echo "You Don't Have A Permission To View The Contents Of This Forum
"; echo "<a href="index.php?action=main&sid=$sid">Home</a>"; echo " "; echo "</card>"; echo "</wml>"; exit(); } addonline(getuid_sid($sid),"Creating new topic","index.php?action=online"); echo "<card id="main" title="New Topic">"; echo " "; echo "Title:<input name="ntitle" maxlength="30"/> "; echo "Text:<input name="tpctxt" maxlength="500"/> "; echo "<anchor>Create"; echo " <go href="genproc.php?action=newtopic&sid=$sid" method="post"> <postfield name="fid" value="$fid"/> <postfield name="ntitle" value="$(ntitle)"/> <postfield name="tpctxt" value="$(tpctxt)"/> </go> "; echo "</anchor>"; echo "
<a href="index.php?action=viewfrm&sid=$sid&fid=$fid">"; $fname = getfname($fid); echo "$fname</a> "; echo "<a href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt="*"/>"; echo "Home</a>";
echo "
"; echo "</card>"; }
where?
addonline(getuid_sid($sid),"Creating new topic","index.php?action=online");
echo "<card id=\"main\" title=\"New Topic\">";
echo "<p align=\"center\">";
if(getplusses(getuid_sid($sid))<20)
{
echo "
You need at least 20 plusses to create a topic!
";
}
else{
echo "Title:<input name=\"ntitle\" maxlength=\"30\"/>
";
echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/>
";
echo "<anchor>Create";
echo "
<go href=\"genproc.php?action=newtopic&sid=$sid\" method=\"post\">
<postfield name=\"fid\" value=\"$fid\"/>
<postfield name=\"ntitle\" value=\"$(ntitle)\"/>
<postfield name=\"tpctxt\" value=\"$(tpctxt)\"/>
</go>
";
echo "</anchor>";
}
that help me nothing rukia..ur reply r not related to my post..im asking how to give user pluses in every action..white warrior have give me the code but i dont know where to place the code n i use create new topic action as example..but i want to know where i must put the code that white warrior give to me??
check in genproc.php not in index.php
ok this is the sample from my genproc.php.where must i put the code?
else if($action=="post") { $tid = $_POST["tid"]; $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'")); <------here?------> if(!canaccess(getuid_sid($sid), $tfid[0])) { echo "<head>"; echo "<title>$sitename</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>"; echo " "; echo "You Don't Have A Permission To View The Contents Of This Forum
"; echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>"; echo "</html>"; exit(); } <------here?------> $reptxt = $_POST["reptxt"]; $qut = $_POST["qut"]; addonline(getuid_sid($sid),"Posted A reply",""); echo "<head>"; echo "<title>$sitename</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>"; echo " "; $crdate = time(); $fid = getfid($tid); //$uid = getuid_sid($sid); $res = false; $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));
if(($closed[0]!='1')||(ismod($uid)))
{
$lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1"));
global $post_af;
$antiflood = time()-$lpost[0];
if($antiflood>$post_af)
{ if(trim($reptxt)!="") { if(!isblocked($reptxt,$uid)) { $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'"); }else{ $bantime = time() + (302460*60); echo "<img src="../images/notok.gif" alt="X"/>"; echo "Can't Post Reply
"; echo "You just tried posting a reply with a link to one of the crapiest sites on earth The members of these sites spam here a lot, so go to that site and stay there if you don't like it here as a result of your stupid action:
- you have lost your sheild
- you have lost all your plusses
- You are BANNED!"; $user = getnick_sid($sid); mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='Wap Desire auto banned $user for spamming forums', actdt='".time()."'"); mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'"); mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$uid."'"); echo "</body>"; echo "</html>"; exit(); } } if($res) { $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'")); $res2 = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id='".$tid."'")); $usr = getnick_uid($uid); $tname = htmlspecialchars($res2[0]); if(($res2[1]!=$uid)&&(automsgs($res2[1]))){ $msg = "Your Topic $tname"." has been Replied to by $usr [br/][small]p.s: this is an automated pm[/small]"; autopm($msg, $res2[1]); } $ups = $usts[0]+1; $upl = $usts[1]+1; mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'"); mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'"); echo "<img src="../images/ok.gif" alt="O"/>Message Posted Successfully"; echo "
8<a accesskey="8" href="index.php?action=viewtpc&sid=$sid&tid=$tid&go=last">View Topic</a>"; }else{ echo "<img src="../images/notok.gif" alt="X"/>Error Posting Message"; } }else{ $af = $post_af -$antiflood; echo "<img src="../images/notok.gif" alt="X"/>Antiflood Control: $af"; } }else{ echo "<img src="../images/notok.gif" alt="X"/>Topic is closed for posting"; }
$fname = getfname($fid);
echo "
9<a accesskey="9" href="index.php?action=viewfrm&sid=$sid&fid=$fid">$fname</a> "; echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>";
}
where?
ok this is the sample from my genproc.php.where must i put the code?
else if($action=="post") { $tid = $_POST["tid"]; $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'")); <------here?------> if(!canaccess(getuid_sid($sid), $tfid[0])) { echo "<head>"; echo "<title>$sitename</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>"; echo " "; echo "You Don't Have A Permission To View The Contents Of This Forum
"; echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>"; echo "</html>"; exit(); } <------here?------> $reptxt = $_POST["reptxt"]; $qut = $_POST["qut"]; addonline(getuid_sid($sid),"Posted A reply",""); echo "<head>"; echo "<title>$sitename</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>"; echo " "; $crdate = time(); $fid = getfid($tid); //$uid = getuid_sid($sid); $res = false; $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));
if(($closed[0]!='1')||(ismod($uid))) {
$lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1")); global $post_af; $antiflood = time()-$lpost[0]; if($antiflood>$post_af) { if(trim($reptxt)!="") { if(!isblocked($reptxt,$uid)) { $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'"); }else{ $bantime = time() + (302460*60); echo "<img src="../images/notok.gif" alt="X"/>"; echo "Can't Post Reply
"; echo "You just tried posting a reply with a link to one of the crapiest sites on earth The members of these sites spam here a lot, so go to that site and stay there if you don't like it here as a result of your stupid action:
- you have lost your sheild
- you have lost all your plusses
- You are BANNED!"; $user = getnick_sid($sid); mysql_query("INSERT INTO ibwf_mlog SET action='autoban', details='Wap Desire auto banned $user for spamming forums', actdt='".time()."'"); mysql_query("INSERT INTO ibwf_penalties SET uid='".$uid."', penalty='1', exid='2', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'"); mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$uid."'"); echo "</body>"; echo "</html>"; exit(); } } if($res) { $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'")); $res2 = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id='".$tid."'")); $usr = getnick_uid($uid); $tname = htmlspecialchars($res2[0]); if(($res2[1]!=$uid)&&(automsgs($res2[1]))){ $msg = "Your Topic $tname"." has been Replied to by $usr [br/][small]p.s: this is an automated pm[/small]"; autopm($msg, $res2[1]); }
$ups = $usts[0]+1;
$upl = $usts[1]+1;
mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'");
echo "<img src="../images/ok.gif" alt="O"/>Message Posted Successfully"; echo "
8<a accesskey="8" href="index.php?action=viewtpc&sid=$sid&tid=$tid&go=last">View Topic</a>"; }else{ echo "<img src="../images/notok.gif" alt="X"/>Error Posting Message"; } }else{ $af = $post_af -$antiflood; echo "<img src="../images/notok.gif" alt="X"/>Antiflood Control: $af"; } }else{ echo "<img src="../images/notok.gif" alt="X"/>Topic is closed for posting"; }
$fname = getfname($fid); echo "
9<a accesskey="9" href="index.php?action=viewfrm&sid=$sid&fid=$fid">$fname</a> "; echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>";
}
ok i give a new example of sign guestbook coding..where must i put that code??
else if($action=="signgb") { $who = $_POST["who"];
if(!cansigngb(getuid_sid($sid), $who)) { echo "<head>"; echo "<title>$sitename</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>"; echo " "; echo "You cant Sign this user guestbook
"; echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>"; echo "</html>"; exit(); } $msgtxt = $_POST["msgtxt"]; //$qut = $_POST["qut"]; addonline(getuid_sid($sid),"Signing a guestbook",""); echo "<head>"; echo "<title>$sitename</title>"; echo "<link rel="stylesheet" type="text/css" href="../themes/$theme[0]">"; echo "</head>"; echo "<body>"; echo " "; $crdate = time(); //$uid = getuid_sid($sid); $res = false;
if(trim($msgtxt)!="")
{
$res = mysql_query("INSERT INTO ibwf_gbook SET gbowner='".$who."', gbsigner='".$uid."', dtime='".$crdate."', gbmsg='".$msgtxt."'");
}
if($res)
{
echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
}else{
echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
}
echo "
"; echo "0<a accesskey="0" href="index.php?action=main&sid=$sid"><img src="../images/home.gif" alt=""/>Home</a>"; echo " "; echo "</body>";
}
where?
else if($action=="signgb")
{
$who = $_POST["who"];
if(!cansigngb(getuid_sid($sid), $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 Sign this user guestbook
";
echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
$msgtxt = $_POST["msgtxt"];
//$qut = $_POST["qut"];
addonline(getuid_sid($sid),"Signing a guestbook","");
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\">";
$crdate = time();
//$uid = getuid_sid($sid);
$res = false;
if(trim($msgtxt)!="")
{
$res = mysql_query("INSERT INTO ibwf_gbook SET gbowner='".$who."', gbsigner='".$uid."', dtime='".$crdate."', gbmsg='".$msgtxt."'");
}
if($res)
{
$uipa = $uipa+1;
$uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
$uip = $uipa + $uip[0];
mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'");
echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
}else{
echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
}
echo "
";
echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
}
where you see the
if($res) { $uipa = $uipa+1; $uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'")); $uip = $uipa + $uip[0]; mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'"); echo "<img src="../images/ok.gif" alt="O"/>Message Posted Successfully"; }
add the code under that and it will update plusses on Success of posting new roply if you know what i mean?
try this
$uid = getuid_sid($sid);
$info = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE uid='".$uid."'"));
if($info[0]>5)
{
$uipa = $uipa+1;
$uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
$uip = $uipa + $uip[0];
mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'");
}
R.M.C
PHP Adovocate B)
$uid = getuid_sid($sid);
$info = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE uid='".$uid."'"));
if($info[0]>5)
{
$uipa = $uipa+1;
$uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
$uip = $uipa + $uip[0];
mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'");
}
that will work but only give 1 plusses change it to this
$uid = getuid_sid($sid);
$info = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE uid='".$uid."'"));
if($info[0]>5)
{
$uipa = $uipa+5;
$uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
$uip = $uipa + $uip[0];
mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'");
}
ok i thought he said if a user type 5 messages they get 1 pluses ..External image (may be gone)
R.M.C
PHP Adovocate B)
ok i thought he said if a user type 5 messages they get 1 pluses .. External image (may be gone)
yes sorry mate, i got that one wrong External image (may be gone)