burn1337 Posted September 14, 2008 Share Posted September 14, 2008 Ok so just recently I noticed that on the public version of my forum (I have it laid out for a seperate administration CMS type of thing) My forum does not display, I just copied the function that gets and displays the threads from my administration script (without risking tmi) I have error_reporting set to E_ALL at this present time, although it doesn't show any errors, but it also doesn't show my threads either, I have gone through and double checked all my vars, and ; and syntax I can't seem to find anything wrong with it.. could this be a possible XSS problem? Any suggestions as to what to check and/or change next? Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/ Share on other sites More sharing options...
DarkWater Posted September 14, 2008 Share Posted September 14, 2008 So does a white, blank page just display? Also, why didn't you just rewrite the functions yourself....? Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641407 Share on other sites More sharing options...
Adam Posted September 14, 2008 Share Posted September 14, 2008 Have you tried adding.. or die(mysql_error()); to the end of your queries, for example: $threads = mysql_query("SELECT * FROM threads") or die(mysql_error()); that should output any MySQL errors... Adam Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641428 Share on other sites More sharing options...
burn1337 Posted September 14, 2008 Author Share Posted September 14, 2008 No not just a white blank page, the top and sides of my site layout displays, but not the middle where the content goes or the bottom. it is obvious that something is keeping it from executing any farther, but I have no control statements that are active that would stop it, I see no actual problem that it could be, I have double and triple checked my syntax for the entire forum, it shows no errors. I do use the or die(), I haven't tried die(mysql_error()) but I'm going to in a min Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641433 Share on other sites More sharing options...
DarkWater Posted September 14, 2008 Share Posted September 14, 2008 Why don't you show us your code so we can actually provide non-speculative advice? =/ Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641435 Share on other sites More sharing options...
burn1337 Posted September 14, 2008 Author Share Posted September 14, 2008 Cause the last time I did that I felt completely expoited cause no one could figure out the problem but me, and I felt exploited I know weird right? Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641457 Share on other sites More sharing options...
DarkWater Posted September 14, 2008 Share Posted September 14, 2008 Cause the last time I did that I felt completely expoited cause no one could figure out the problem but me, and I felt exploited I know weird right? Uhh, what? Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641463 Share on other sites More sharing options...
burn1337 Posted September 14, 2008 Author Share Posted September 14, 2008 ok lets put it this way, I am thinking that it is my layout, cause it works just fine under my Administration CMS, witch has no layout at all, so obviously it must be with my layout, hence why I am going to redo the entire layout structure. Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641466 Share on other sites More sharing options...
Adam Posted September 14, 2008 Share Posted September 14, 2008 But people are trying to help you now? Can't because we can't actually help you find the problem... Often when I've been trying to find a problem for a long time, a break or a fresh pair of eyes helps you find it much faster... Adam Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641468 Share on other sites More sharing options...
burn1337 Posted September 14, 2008 Author Share Posted September 14, 2008 The Forum thread code: function NTop($id) { $get = "select TopicId from Topics where ThreadId='$id'"; $do = mysql_query($get); $count = mysql_num_rows($do); echo $count; } function DThreads($Thread) { echo '<tr>'; echo '<td>'; $id = $Thread[0]; $page = "thread.php?threadid=$id"; echo "<a href=$page>"; echo $Thread[1]; echo '</a>'; echo '</td>'; echo '<td>'; echo $Thread[2]; echo '</td>'; echo '<td>'; //$this->NTop($id); echo '</td>'; echo '</tr>'; } function DisThread() { $text = 'select ThreadId from Threads'; $tt = mysql_query($text) or die('Could not get count query'); $count = mysql_num_rows($tt) or die('Could not get count'); $I = $count - 1; for ($N = $I; $N >= 0; $N--) { $Id = mysql_result($tt, $N, 0); $what = "select * from Threads where ThreadID='$Id'"; $get = mysql_query($what); $Thread = mysql_fetch_array($get); $this->DThreads($Thread); } } The Forum Thread page: include('indexobj.php'); $Index = new Index; $Index->Start(); $Index->Header(); $Index->Links(); //$login = new Login; //$login->Must(); include('forumobj.php'); $forum = new Forum; echo '<table border=1>'; $forum->DisThread(); echo '</table>'; $Index->Footer(); $Index->End(); Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641473 Share on other sites More sharing options...
Adam Posted September 14, 2008 Share Posted September 14, 2008 Sorry mate but that doesn't make much sense to me. From what I can understand, you're going a hell of a long way round to do simple things. I'd suggest rewriting them in a simpler, clearer form and then debugging any errors. An example of what I'm talking about is in the DisThread function; you're running a query to select all the thread IDs.. counting up the results.. then using a for loop to perform a query for each thread, to then pass the array onto the DTThreads function, when you could do all that in one function, with far less code and only one query! Adam Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641490 Share on other sites More sharing options...
burn1337 Posted September 14, 2008 Author Share Posted September 14, 2008 Well first I tried the die(mysql_error()) thing and it's still not showing any errors. MrAdam, I take it you propose a foreach loop? I was thinking that, and I have tried it with fewer lines of code, thats the code I use for my admin script that I just put in the public script (or course a little different though) cause it works just fine in my admin pages, but won't work on the public pages... Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641497 Share on other sites More sharing options...
burn1337 Posted September 14, 2008 Author Share Posted September 14, 2008 It has been Solved.. and once again I feel completely exploited cause my code is out in the open and yea... once again no one comes up with a solution... how ironic Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641519 Share on other sites More sharing options...
Adam Posted September 14, 2008 Share Posted September 14, 2008 Not sure why your so stressed out about it? And no, not a foreach loop.. not sure wether you require the DThreads function to be seperate? But that could easily be added to the DisThread function, which itself could be cut down to far less lines.. for example: function DisThread() { $tt = mysql_query("SELECT * FROM Threads") or die('SELECT Error: ' .mysql_error()); $count = mysql_num_rows($tt) or die('COUNT Error: ' .mysql_error()); while ($Thread = mysql_fetch_assoc($tt)) { $this->DThreads($Thread); } } Adam Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641545 Share on other sites More sharing options...
DarkWater Posted September 15, 2008 Share Posted September 15, 2008 It has been Solved.. and once again I feel completely exploited cause my code is out in the open and yea... once again no one comes up with a solution... how ironic Believe me, no one wants to steal code that runs like 100x slower than it should because of poor design. Honestly, no one here wants to steal your code, they just want to help. Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641593 Share on other sites More sharing options...
burn1337 Posted September 15, 2008 Author Share Posted September 15, 2008 I appologize if I come off rude or something. I don't necessarily think anyone is out to steal my code first off. I just feel weird about posting my code thats simply it. Actually, I have been trying to get whiles, and do whiles to work, maybe when I was trying them I was syntacticly incorrect, but for some reason I couldn't get any results with whiles, or do whiles, I even used the manual with php.net, and tried to go off that syntax but it wouldn't do anything it would just error out, or do absolutely nothing not even an error. I even tried basicly exactly what you suggested the only difference was the mysql_error(); and it wouldn't do anything. I could get them to work if I did nothing with querys, but as soon as I tried to do it with a query it wouldn't work for me. so I finally got everything to work with the for() loop. I know my code may not be exactly "professional" but I have also only been using php and mysql for less then 6 months, theoretically I am still a newb with php. Not to mention I am also farely new with OOP as well. So I guess you could say this is also a learning experiance for me. Quote Link to comment https://forums.phpfreaks.com/topic/124216-i-need-suggestions/#findComment-641602 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.