Code:
<?php
//reply to a thread
class Reply {
var $user;
var $tid;
var $msg;
var $cat;
var $output;
function filter($str) {
$needle = array("badword1", "badword2");
$c = count($needle);
$flag = 0;
for($i=0; $i<$c; $i++) {
$pos = stripos($str, $needle[$i]);
if($pos !== false) {
$flag = 1;
}
}
if($flag == 1) {
return false;
} else {
return true;
}
}
function postIt($user, $tid, $msg, $cat) {
$sql2 = sprintf("INSERT INTO `t_reps`(`tid`, `user`, `msg`) VALUES ('%d', '%s', '%s');", mysql_real_escape_string($tid), mysql_real_escape_string($user), mysql_real_escape_string($msg));
$result2 = mysql_query($sql2);
$tid = mysql_real_escape_string($tid);
$time = time();
$sql3 = mysql_query("UPDATE `threads` SET `replies`=`replies`+'1' WHERE `tid`='$tid';");
$sqlu = mysql_query("UPDATE `threads` SET `last`='$time' WHERE `tid`='$tid';");
if($cat == "games") {
$inc = 0.1;
} else if($cat == "chatcat") {
$inc = 0.2;
} else if($cat != "help") {
$inc = 0.3;
} else {
$inc = 0.4;
}
$brownie = mysql_query("UPDATE usertable SET brownie=brownie+'$inc' WHERE username='$user'");
$this->output = "Replied successfully! <a href=\"?act=fboard&cat=$cat\">Back</a>";
}
function getOutput() {
return $this->output;
}
function Reply($user, $tid, $msg, $cat) {
$msg2 = strip_tags($msg, "<b><i><u><strike><em><strong><br>");
if(!($this->filter($msg2))) {
$this->output = "Sorry, swearing is not allowed.";
} else if(strlen($msg2)>300) {
$this->output = "Messages cannot exceed 300 characters.";
} else if($user == null) {
$this->output = "You must be logged in to post messages!";
} else {
$this->postIt($user, $tid, $msg, $cat);
}
}
}
?>
<?php
//bones.php
include("classes/index02.php");
$bone = strip_tags($_POST["bone"]);
$un = $ar[0];
$sql = mysql_query("SELECT * FROM `usertable` WHERE `username`='$un'");
if(mysql_num_rows($sql)<=0) {
echo "Not logged in... :(";
} else {
$a = mysql_fetch_array($sql);
$lst = time()-$a["bones"];
if($lst>21600) {
if($bone == null) {
?>
<form method="post" action="">
<table><tr><td><div align="left"><img src="images/bone.gif"/></div></td><td<div align="left"><img src="images/bone.gif"/></div></td></tr>
<tr><td><div align="left"><input type="radio" name="bone" value="1"/></div></td><td><div align="left"><input type="radio" name="bone" value="2"/></div></td></tr></table>
<br/><br/>
<button type="submit"><font face="Tahoma, Arial, Helvetica, sans-serif"><strong>Throw in the Fire</strong></font></button></form>
<?php
} else {
$bone2 = rand(1, 2);
if($bone == $bone2) {
$b = new Bone($ar[0], "money");
} else if($bone == 1 || $bone == 2) {
$b = new Bone($ar[0], "heal");
} else {
echo "That is definitely not a bone!";
}
$t = time();
mysql_query("UPDATE `usertable` SET `bones`='$t' WHERE `username`='$un'");
}
} else {
echo "Sorry, but you've played in the last six hours...";
}
}
?>
The code is partly, but not fully OOP.
As for the price, I really cannot say until I have an offer, although I can say i am looking for something in the mid-$xxx range.
Bookmarks