function getTweets($num) { $num = mysql_real_escape_string($num); $res = mysql_query("SELECT `tweet`, `direct` FROM `Tweets` ORDER BY `date` DESC LIMIT 0 , {$num}") or die(mysql_error()); $ret = array(); require_once 'includes/cleantweet.php'; while ($row = mysql_fetch_array($res)) { if (isset($row['direct'])) { $ret[] = array(cleanTweet($row['tweet']), cleantweet($row['direct'])); } else { $ret[] = cleanTweet($row['tweet']); } } return $ret; }
<?php if (!isset($_POST['say'])) { die('Holy Jehosaphat!'); } require_once 'includes/cleantweet.php'; require_once 'includes/db.inc.php'; if (bannedIP($_SERVER['REMOTE_ADDR'])) { die; } $err = ''; $stat = cleantweet($_POST['say']); $last = getTweets(1); if (strlen($stat) > 140) { $err = 'That was longer than 140 characters!'; } elseif ($stat == 'Say something in 140 characters.' || $stat == '') { $err = 'Umm... You didn\'t exactly say anything...'; } elseif (!validTimestamp($_POST['submit'])) { $err = 'Whoa! Something weird just happened. Try again, I guess? (Debug ' . intval($_POST['submit']) . ')'; } elseif (bannedTweet($stat)) { $err = 'Sorry, I just can\'t post that.'; } if ($err == '') { require_once 'includes/twitter.inc.php'; $tw = new Twitter('ub3rk1ttencom', 'oopsiesthisgotleaksied'); $rets = false; $exc = false; try { $ret = $tw->updateStatus(stripslashes($stat)); $rets = $ret['id']; } catch (TwitterException $ex) {