runnerjp Posted May 27, 2008 Share Posted May 27, 2008 this is my forum script <?php session_start(); include ("../settings.php"); include ("bbcode.php"); echo ("<link rel='stylesheet' href='style.css'>"); checkLogin ('1 2'); { switch($_GET ) { default: echo ("<table width='100%' cellpadding='0'>"); $fetch1 = mysql_query("SELECT * FROM `forum_category`"); while ($category = mysql_fetch_array($fetch1)) { echo ("<tr> <td id='mains'><b>$category[name]<b><br></td> </tr> "); $fetch2 = mysql_query("SELECT * FROM `forum_topic` WHERE `cat_id` = '$category[id]'"); while ($topic = mysql_fetch_array($fetch2)) { echo ("<tr> <td id='fields'><a href='?page=forum&id=$topic[id]'>$topic[name]</a><br><i>$topic[description]</i></td> </tr> "); } } echo ("</table>"); $rows = mysql_num_rows($fetch1); if ($rows == 0) { echo ("<center><b>Forum is Empty<b></center>"); } break; case 'forum': echo ("<table width='100%' cellpadding='0'>"); $fetch1 = mysql_query("SELECT * FROM `forum_topic` WHERE `id` = '$_GET[id]'"); $topic = mysql_fetch_array($fetch1); echo ("<tr><td id='mains'><b>$topic[name]</b> - <a href='?page=newthread&id=$_GET[id]'>New Thread</a></td><td id='mains'><b>Thread starter</b></td></tr>"); $fetch2 = mysql_query("SELECT * FROM `forum_thread` WHERE `thr_id` = '$_GET[id]' ORDER BY `sticky` DESC"); while ($thread = mysql_fetch_array($fetch2)) { $threadtitle = "$thread[title]"; $bbctt1 = BBCODE($threadtitle); if($thread[sticky] == Yes) { echo ("<tr><td id='fields'><a href='?page=forumdisplay&id=$thread[id]'><b>Sticky:</b> $bbctt1</a></td><td id='fields'>$thread[poster]</td></tr>"); } else { echo ("<tr><td id='fields'><a href='?page=forumdisplay&id=$thread[id]'>$bbctt1</a></td><td id='fields'>$thread[poster]</td></tr>"); } } echo ("</table>"); break; case 'forumdisplay': echo ("<table width='100%' cellpadding='0'>"); $fetch1 = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$_GET[id]'"); $thread = mysql_fetch_array($fetch1); $fetch3 = mysql_query("SELECT * FROM `members` WHERE `username` = '$thread[poster]'"); $threadavatar = mysql_fetch_array($fetch3); $threadtitle = "$thread[title]"; $bbctt2 = BBCODE($threadtitle); $threadmessage = "$thread[message]"; $bbctm = BBCODE($threadmessage); echo ("<tr> <td id='mains'> </td>"); if($thread[sticky] == Yes) { echo ("<td id='mains'><b>Sticky:</b> $bbctt2</td></tr>"); } else { echo ("<td id='mains'><b>$bbctt2</b></td></tr>"); } echo ("<tr> <td id='mains' align='center' width='120'><a href=javascript:void(window.open('members.php?user=$thread[poster]','client','status=1,width=400,height=250,top=60,left=60'))>$thread[poster]</a><br> <img src='$threadavatar[avatar]'> "); checkLogin ('1 2'); { echo ("<br><a href='forum_mod.php?page=lock&id=$thread[id]'>Lock</a> - <a href='?page=editthread&id=$thread[id]'>Edit</a> - <a href='forum_mod.php?page=sticky&id=$thread[id]'>Sticky</a>"); } if ($thread[poster] == $_SESSION['user_id']) { echo ("<br><a href='?page=editthread&id=$thread[id]'>Edit Post</a>"); } echo (" </td><td id='mains' align='left' valign='top'>$bbctm</td></tr>"); $fetch2 = mysql_query("SELECT * FROM `forum_posts` WHERE `thr_id` = '$_GET[id]'"); while ($posts = mysql_fetch_array($fetch2)) { $postsmessage = "$posts[message]"; $bbcpm = BBCODE($postsmessage); $fetch4 = mysql_query("SELECT * FROM `members` WHERE `username` = '$posts[poster]'"); $postsavatar = mysql_fetch_array($fetch4); echo ("<tr> <td id='fields' align='center'>$posts[poster] <br> <img src='$postsavatar[avatar]'> "); if (checkLogin ('1 2')) { echo ("<br><a href='forum_mod.php?page=delete&id=$posts[id]'>Delete</a> - <a href='?page=editpost&id=$posts[id]'>Edit</a>"); } if ($_SESSION['user_id'] == $posts[poster]) { echo ("<br><a href='?page=editpost&id=$posts[id]'>Edit Post</a>"); } echo (" </td> <td id='fields' align='left' valign='top'>$bbcpm</td> </tr>"); } if ($thread[locked] == 'Yes') { echo ("<tr><td id='fields'> </td><td id='fields' valign='top'><b>This Thread is locked.</b></td></tr>"); } else { echo (" <tr> <td id='fields'><center>Quick Reply</center></td> <form method='POST' action='?page=addreply'> <td id='fields'><textarea name='message' rows='8' cols='30'></textarea><br> <input type='submit' name='submit' value='Post'> <input type='hidden' name='id' value='$_GET[id]'></td> </tr> </form> "); } break; case 'addreply': $id = htmlspecialchars($_POST[id]); $message = htmlspecialchars($_POST[message]); $user_id = $_SESSION['user_id']; $insert = mysql_query("INSERT INTO `forum_posts` (`message`, `poster`, `thr_id`) VALUES ('$message', '$user_id', '$id')"); echo ("Thanks for your reply. <br><a href='javascript: history.go(-1)'>Go back.</a>"); break; case 'newthread': echo ("<form method='POST' action='?page=addthread'> <table width='100%'> <tr> <td>Title</td> <td><input type='text' name='title'></td> </tr> <tr> <td>Message</td> <td><textarea name='message' rows='10' cols='40'></textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submit' value='Post'> <input type='hidden' name='id' value='$_GET[id]'></td> </tr> </table> </form> "); break; case 'addthread': $id = htmlspecialchars($_POST[id]); $query = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$id'"); $array = mysql_fetch_array($query); if ($array[locked] == Yes) { echo ("You can't post that in here."); } else { $title = htmlspecialchars($_POST[title]); $message = htmlspecialchars($_POST[message]); $insert = mysql_query("INSERT INTO `forum_thread` (`title`, `message`, `poster`, `thr_id`) VALUES ('$title', '$message', '$user_id', '$id')"); echo ("Your thread has been added.<br><a href='javascript: history.go(-2)'>Go back.</a>"); } break; case 'editthread': $fetch = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$_GET[id]'"); $thread = mysql_fetch_array($fetch); if (checkLogin ('1 2')) { echo (" <form method='POST' action='?page=updatethread'> <table width='100%'> <tr> <td>Title</td> <td><input type='text' name='title' value='$thread[title]'></td> </tr> <tr> <td>Message</td> <td><textarea name='message' rows='10' cols='40'>$thread[message]</textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submit' value='Post'> <input type='hidden' name='id' value='$_GET[id]'></td> </tr> </table> </form> "); } else { echo ("You can't edit this thread."); } break; case 'updatethread': $id = htmlspecialchars($_POST[id]); $query = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$id'"); $array = mysql_fetch_array($query); if ($array[poster] == $logged[username] || checkLogin ('2')) { $title = htmlspecialchars($_POST[title]); $message = htmlspecialchars($_POST[message]); $query = mysql_query("UPDATE `forum_thread` SET `title` = '$title', `message` = '$message' WHERE `id` = '$id'"); echo ("Thread has been updated.<br><a href='javascript: history.go(-2)'>Go back.</a>"); } else { echo ("You can't edit this thread."); } break; case 'editpost': $fetch = mysql_query("SELECT * FROM `forum_posts` WHERE `id` = '$_GET[id]'"); $post = mysql_fetch_array($fetch); if ($logged[username] == $post[poster] || checkLogin ('2')) { echo (" <form method='POST' action='?page=updatepost'> <table width='100%'> <tr> <td>Message</td> <td><textarea name='message' rows='10' cols='40'>$post[message]</textarea></td> </tr> <tr> <td></td> <td><input type='submit' name='submit' value='Post'> <input type='hidden' name='id' value='$_GET[id]'> </td> </tr> </table> </form> "); } else { echo ("You can't edit this post."); } break; case 'updatepost': $id = htmlspecialchars($_POST[id]); $query = mysql_query("SELECT * FROM `forum_thread` WHERE `id` = '$id'"); $array = mysql_fetch_array($query); if ($array[poster] == $logged[username] || checkLogin ('2')) { $message = htmlspecialchars($_POST[message]); $update = mysql_query("UPDATE `forum_posts` SET `message` = '$message' WHERE `id` = '$id'"); echo ("Thread updated.<br><a href='javascript: history.go(-2)'>Go back.</a>"); } else { echo ("You can't edit this thread."); } break; } } ?> if i go to the code direct it works fine.... BUT if i go to my code via my include link <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?> i just get a blank page...very starte as all the pages i usually do work :S Link to comment https://forums.phpfreaks.com/topic/107439-blank-screen-for-showin-profile/ Share on other sites More sharing options...
runnerjp Posted May 27, 2008 Author Share Posted May 27, 2008 ok i have tried to include my forum script into my include file so i can do this Code: <?php $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?> i just get a blank page.. and there are lots of errors... is there away that i can edit the above code is it also includes /members/forum/forum.php Link to comment https://forums.phpfreaks.com/topic/107439-blank-screen-for-showin-profile/#findComment-550721 Share on other sites More sharing options...
runnerjp Posted May 27, 2008 Author Share Posted May 27, 2008 ok i have come across a problem lol ok soooo members/index.php?page=forum this is how i go to sected urls from my include file due tho this code on my index.php <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?> but i need to use a url like this <A href='index.php?page=message?id=$getthreads3[postid]'>$getthreads3[title]</a></td><td>$getthreads3[author]</td><td>$getthreads3[numreplies]</td><td>$getthreads3[showtime]<br>Last post by <b>$getthreads3[lastposter]</b></td></tr>"; but it just sends me back to index.php and i belive its due to the use of 2 ? index.php?page=message?id how couldi fix this?? Link to comment https://forums.phpfreaks.com/topic/107439-blank-screen-for-showin-profile/#findComment-550745 Share on other sites More sharing options...
revraz Posted May 27, 2008 Share Posted May 27, 2008 You can't use two ?, use & Link to comment https://forums.phpfreaks.com/topic/107439-blank-screen-for-showin-profile/#findComment-550749 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.