Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Faults in this code?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="vaulient2" data-source="post: 214205" data-attributes="member: 29433"><p>[code]<?PHP</p><p> </p><p>$p1 = 5;</p><p> </p><p>$pages = mysql_query("SELECT COUNT(id) FROM cms_comments");</p><p>$p2 = ceil(mysql_result($pages, 0) / $p1);</p><p> </p><p>$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;</p><p>$start = ($page - 1) * $p1;</p><p> </p><p> </p><p>$uids = $_SESSION['user']['id'];</p><p>$id = preg_replace('/\D/', '', $_GET['id']);</p><p> </p><p>function getPost($uid) {</p><p>$sql = "SELECT * FROM cms_comments WHERE author = '$uid' LIMIT $start, $p1";</p><p>$query = mysql_query($sql) or die(mysql_error());</p><p>$nummy = mysql_query("SELECT * FROM cms_comments");</p><p>$numrows = mysql_num_rows($nummy);</p><p>if(mysql_num_rows($query) > 0 && $_SESSION['user']['rank'] < 0) {</p><p>return true;</p><p>}</p><p>else { return false; }</p><p>}</p><p>if(getPost($uids) == true) { echo 'You may only post once!'; }</p><p>function post($data, $story, $uid) {</p><p>$clean = htmlentities(mysql_real_escape_string($data));</p><p>$sql = "INSERT INTO cms_comments (story, comment, date, author) VALUES ('$story', '$clean', '". time() ."', '$uid')";</p><p>$query = mysql_query($sql) or die(mysql_error());</p><p>}</p><p>$posts = getPost($uids);</p><p>if(isset($_POST['comment']) && strlen($_POST['comment']) > 0 && strlen($_POST['comment']) < 500 && $posts == false) {</p><p>post($_POST['comment'], $id, $uids);</p><p>echo '<head><meta http-equiv="refresh" content="0"></head>';</p><p>}</p><p> </p><p> </p><p> </p><p> $sql = "SELECT * FROM cms_comments WHERE story = '{$id}' ORDER BY id DESC";</p><p>$query = mysql_query($sql) or die(mysql_error());</p><p> </p><p>while($ua = mysql_fetch_array($query)) {</p><p>$uiq = mysql_query("SELECT * FROM users WHERE id = ". $ua['author']) or die(mysql_error());</p><p>$ui = mysql_fetch_array($uiq) or die(mysql_error());</p><p> </p><p>if($ui['rank'] >= 10) { $username = '<span style="font-family:Arial,Helvetica,sans-serif; color: #7D0A79;text-shadow: 0px 0px 5px #343434;background:url(/app/tpl/skins/Custom-Habbo/images/glitter.gif);">'. $ui['username'] .'</span>';}</p><p>else { $username = '<span style="font-family:Arial,Helvetica,sans-serif;">'. $ui['username'] .'</span>'; }</p><p> </p><p>if($ui['rank'] >= 6) { $username = '<span style="font-family:Arial,Helvetica,sans-serif; color: #7D0A79;text-shadow: 0px 0px 5px #343434;background:url(/app/tpl/skins/Custom-Habbo/images/glitter.gif);">'. $ui['username'] .'</span>';}</p><p>else { $username = '<span style="font-family:Arial,Helvetica,sans-serif;">'. $ui['username'] .'</span>'; }</p><p>}</p><p>echo "Pages: ";</p><p>if($p2 >= 1 && $page <= $p2){</p><p>for($x=1; $x<=$p2; $x++) {</p><p> </p><p>echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a> ';</p><p>}</p><p>}</p><p> </p><p>?>[/code]</p><p>Well I've been working on this fo sometime now , and I'm stuck with a syntax error. I can't find it anywhere , could any of you help me out?</p></blockquote><p></p>
[QUOTE="vaulient2, post: 214205, member: 29433"] [code]<?PHP $p1 = 5; $pages = mysql_query("SELECT COUNT(id) FROM cms_comments"); $p2 = ceil(mysql_result($pages, 0) / $p1); $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; $start = ($page - 1) * $p1; $uids = $_SESSION['user']['id']; $id = preg_replace('/\D/', '', $_GET['id']); function getPost($uid) { $sql = "SELECT * FROM cms_comments WHERE author = '$uid' LIMIT $start, $p1"; $query = mysql_query($sql) or die(mysql_error()); $nummy = mysql_query("SELECT * FROM cms_comments"); $numrows = mysql_num_rows($nummy); if(mysql_num_rows($query) > 0 && $_SESSION['user']['rank'] < 0) { return true; } else { return false; } } if(getPost($uids) == true) { echo 'You may only post once!'; } function post($data, $story, $uid) { $clean = htmlentities(mysql_real_escape_string($data)); $sql = "INSERT INTO cms_comments (story, comment, date, author) VALUES ('$story', '$clean', '". time() ."', '$uid')"; $query = mysql_query($sql) or die(mysql_error()); } $posts = getPost($uids); if(isset($_POST['comment']) && strlen($_POST['comment']) > 0 && strlen($_POST['comment']) < 500 && $posts == false) { post($_POST['comment'], $id, $uids); echo '<head><meta http-equiv="refresh" content="0"></head>'; } $sql = "SELECT * FROM cms_comments WHERE story = '{$id}' ORDER BY id DESC"; $query = mysql_query($sql) or die(mysql_error()); while($ua = mysql_fetch_array($query)) { $uiq = mysql_query("SELECT * FROM users WHERE id = ". $ua['author']) or die(mysql_error()); $ui = mysql_fetch_array($uiq) or die(mysql_error()); if($ui['rank'] >= 10) { $username = '<span style="font-family:Arial,Helvetica,sans-serif; color: #7D0A79;text-shadow: 0px 0px 5px #343434;background:url(/app/tpl/skins/Custom-Habbo/images/glitter.gif);">'. $ui['username'] .'</span>';} else { $username = '<span style="font-family:Arial,Helvetica,sans-serif;">'. $ui['username'] .'</span>'; } if($ui['rank'] >= 6) { $username = '<span style="font-family:Arial,Helvetica,sans-serif; color: #7D0A79;text-shadow: 0px 0px 5px #343434;background:url(/app/tpl/skins/Custom-Habbo/images/glitter.gif);">'. $ui['username'] .'</span>';} else { $username = '<span style="font-family:Arial,Helvetica,sans-serif;">'. $ui['username'] .'</span>'; } } echo "Pages: "; if($p2 >= 1 && $page <= $p2){ for($x=1; $x<=$p2; $x++) { echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a> '; } } ?>[/code] Well I've been working on this fo sometime now , and I'm stuck with a syntax error. I can't find it anywhere , could any of you help me out? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Faults in this code?
Top