Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add() {
- global $db,$ir,$h;
- if(array_key_exists('add',$_POST)) {
- $msg = isset($_POST['msg']) && is_string($_POST['msg']) ? stripslashes($_POST['msg']) : '';
- if(empty($msg))
- echo "Invalid Input.";
- else if(!preg_match('/^[a-z0-9 .\-]+$/i', $msg))
- echo "You can only allow spaces numbers and letters in your Message.";
- else if(strlen($msg) < 2 || strlen($msg) > 100)
- echo "Your message must be greater than 2 characters and less than 100 you used ".strlen($msg);
- else {
- $total = 100 * strlen($msg);
- if($ir['money'] < $total)
- echo "You don't have enough money you need ".money_formatter($total - $ir['money'])." more.";
- else {
- $db->query("UPDATE `users` SET `money` = `money` - {$total} WHERE `userid` = ".$ir['userid']);
- $db->query("INSERT INTO `ads` (`aPOSTER`,`aMSG`,`aTIME`)
- VALUES ({$ir['userid']},'".$db->escape($msg)."',".time().")");
- echo "You have paid ".money_formatter($total)." for your ad. It will last for 15 minutes.";
- }
- }
- }
- else {
- echo "
- <form method='post'>
- <table width='75%' style='text-align:center;' cellspacing='1'>
- <tr><th>Post A Advertisement</th></tr>
- <tr><td><strong>Posting a ad will cost you $100 per character including spaces</strong></td></tr>
- <tr><td>Message: <input id='adcost' type='text' name='msg' /> <span id='chars'>$0</span></td></tr>
- <tr><td><input type='submit' name='add' value='Add Message' /></td></tr>
- </table>
- </form>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement