Jump to content

Ashoar

Members
  • Posts

    214
  • Joined

  • Last visited

    Never

Everything posted by Ashoar

  1. Just pushing this back to the first page. Once again, i think the error may be with the array, for statement: for($count = 1; $count <= $boards2; $count++)
  2. Yes, the exact same method could be used, have an update and delete button. Off course separate process for each. If you have any troubles just come back
  3. From what i am aware you can add UBBC without the use of PEAR. It is a simple matter of using regular expressions and arrays. e.g: search an array '\[img\](.*?)\[\/img\]\', $replace = array( '<img src="\\1">',
  4. You could always just make a certain page in the admin panel that lists all comments in an array from the database. Then have another page that has a form on it with blank text fields. Whatever comment name link they click on would take the admin to this new page based on the name and id of the comment, where the text fields could be populated with the info for that certain topic with a delete button at the bottom. When the delete button is clicked, remove all instances of that comment from the database.
  5. The code i presented does. " COUNT(p.post) AS threads," That gets the threads, which is post from the table. "LEFT JOIN post_reply" post_reply is the table with the posts/threads which is joined to the other table "forums" that way i can get the posts from certain boards. As said this worked perfectly on the older version of php.
  6. The original version of PHP was just 5.2.* according the host i had it on. That was a free host. I then did a fresh install of my forum software onto my paid hosting account which is 5.2.9. All the database tables were installed newly onto this host and all the php files were uploaded. So it was a fresh start. Here is a picture of the thread column for a certain board: That 9 should only be a 3, as their is only 3 threads within that board. I also have another board which has 8 threads displayed on the main page, but it only has 2 threads made within it. As said, this worked fine in the other version of php, so i would have to assume it is just a small thing that needs to be changed, but i cannot find the solution.
  7. Also try this if the above does not work $Password = md5(trim($_POST['password']));
  8. Oh, no that is not the problem, it is this one ".$board['threads']." The one you pointed out is from a different table, it does not effect the current problem.
  9. Another problem So this section of my code would count the amount of posts that were made within a certain board so i could then display them on the main page for each board. It worked properly in an older version of php, but since upgrading to 5.2.9 i have run into a few errors. What happens now, is the code is generating it's own amounts of posts. For example: I posted 3 threads in a board, just for testing. And own the main page it showed up as 9 threads, for that board. In another board i made 1 thread, on the main page it showed up ad 4 for that board. I know this is not a problem with the way my posts are being inserted into the database as i have a small information center which displays the correct amounts of posts for the whole board. I have the feeling it has something to do with my array after fetching the mysql information, but i cannot find a solution for it. This is the code for that particular section: $boards = mysql_query("SELECT f.forum_name, f.forum_desc, f.board, COUNT(p.post) AS threads, MAX(p.showtime) AS showtime, MAX(p.lastposter) AS lastposter FROM forums AS f LEFT JOIN post_reply AS p ON p.board=f.board AND p.parentid='0' GROUP BY f.forum_name, f.forum_desc, f.board ORDER BY f.forum_id asc") or die(mysql_error()); $boards2 = mysql_num_rows($boards); for($count = 1; $count <= $boards2; $count++) { $board = mysql_fetch_array($boards); print "<tr class='mainrow'><td><center>On</center></td><td><A href='board.php?board=".$board['board']."'>".$board['forum_name']."</a><p>".$board['forum_desc']."</p></td><td><center>".$board['threads']."</center></td><td><center>".$board0['posts']."</center</td><td>On ".$board['showtime']."<br><br>By <A href='member_profile.php?username=$board[lastposter]'>$board[lastposter]</a></td></tr>"; } Do you see anything within that snippet of code that could be causing this problem? Thanks
  10. A bit blinding Ghostrider Anyway, there are a lot of tutorials but i would say only read tutorials on doing certain functions instead of creating a whole forum off a tutorial, just more fun that way. I have just finished a beta version of my own forum system. If you need any help on your way just post your problems here after trying to solve them yourself.
  11. The main problem was as Rat said. When i had originally swapped them around they were not right with the session start info. I have gone through now and done that, also with this version of php it did require session start to be at the very top of any page. It is all fixed now. Thanks.
  12. No scripts will actually be written for you from here, but i would assume to do what you are trying you would need permission from the linkedin owners.
  13. The wrapper is just adding everything of the page inside of a centered alignment with a certain width. Well i do rat, as this entire code worked perfect until i upgraded to a higher version of php which is why it has confused me since it did work fine before. Anyway i have it working now, it seems to work just by adding the session start to the header.php page that is included at the top of each page.
  14. Ok, please do not link me to the sticky about this, i have already read it and tried what was said and nothing worked. This login form worked perfectly until i started running it on php 5.2.9. When i login i get this error message: Warning: Cannot modify header information - headers already sent by (output started at /home/asilentd/public_html/forum/login.php:5) in /home/asilentd/public_html/forum/login.php on line 33 As said, i tried what the sticky said about these header errors but nothing has worked, and it has only started doing this since i upgraded to php 5.2.9. I moved the session start right up the top of the page as that was causing another error, and it fixed after moving it there. Here is the code: <?php session_start(); ?> <div id="wrapper"> <?php include "header.php"; include 'config.php'; if(isset($_POST['login'])) { $username = trim(addslashes($_POST['username'])); $password = md5(trim($_POST['password'])); $query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($query); // now we check if they are activated if(mysql_num_rows($query) > 0) { if($row['Activated'] > 0) { $_SESSION['s_logged_n'] = 'true'; $_SESSION['s_username'] = $username; $_SESSION['s_name'] = $row['Name']; $insertuser="INSERT INTO online(username) values('$username')"; mysql_query($insertuser) or die("Could not login insert user"); header("Location: index.php"); } else { echo ' <html> <head> <title>Login</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="error"><p>Sorry, you must activate your account first. Please check your email for the email.</p> <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div> </body> </html> '; } } else { echo ' <html> <head> <title>Login</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="error"><p>There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p> <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> </div> </body> </html> '; } } else { ?> <html> <head> <title>Login</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <table class='maintable'> <tr class='headline'><td width=100%>Login</td></tr> <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>"> <tr class='mainrow'><td><p>Username:<br> <input name="username" type="text" class="textBox" id="username"> <tr class='mainrow'><td><p>Password:<br> <input name="password" type="password" class="textBox" id="password"> </p> <p> <input name="login" type="submit" class="textBox" id="login" value="Submit"> </p> </form> <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p> </div> </table> </div> </body> </html> <? } mysql_close($l); ?> <?php include "footer.php"; ?>
  15. Thank you for that. I noticed my error once you posted that. I have no such table as reply. I had re-named it when i cleaned up all of my coding and changed a few things around. Sorry for posting such a silly question, i should of checked to make sure i changed everything properly.
  16. I originally had no single quotes so i added them to see if it would work. Either way, those num_rows do not work with or without quotes although they did on an older version of php.
  17. Today i tested my forum software on a higher version of PHP, 5.2.9. I got a load of errors back everywhere i have used myql_num_rows, saying it is not a valid MySQL result resource. Here is an example of a line it says is incorrect: $lastreply=mysql_query("SELECT * FROM reply"); if(mysql_num_rows('$lastreply')==0) echo "none"; else for($i=0;$i<mysql_num_rows($lastreply);$i++) { $lreply=mysql_fetch_assoc($lastreply); } The num_rows there are incorrect according to php. Has the structure of it changed in this version? If so how am i meant to use mysql_num_rows.
  18. Well instead of slecting everything by using (*) add just the row names you need. COUNT rowname,rowname,rowname etc. Also you should change the way you are checking if they are empty. $query = "SELECT count(*) FROM pbs_users WHERE uEmail='".$userInfo[$TbUsers->col_uEmail]."'"); $result = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($result)==0) ; header("Location: info.php"); } }else{ header("Location: index.php"); }
  19. Ashoar

    Session

    Thanks. Yeah although i didn't want it to be time based, i preferred just to log them in and add them to the list, and once they logged out they would automatically remove, instead of having a "Online in the last 10 minutes" type thing. Either way i am changing it around now and will add a time section to it.
  20. Ok then, instead of selecting all info (*) add the table rows you would like to select from. SELECT rowname,rowname,rowname etc.
  21. If you have no data, that is your problem. if($result->num_rows > 0) { $temp = $result->fetch_assoc(); } else { echo "we have no data"; That message displays when it cannot find data from the table you are fetching from.
  22. Ashoar

    Session

    Ah ok, sorry didn't properly see that part. Well i think i will just do this based on time. In my original code, when you logged in your name was added to a new database table. All the names from that database would then be fetched and displayed in a users online list. When you logout your name is taken out of the database table. The problem was that if they got logged out due to being idle for too long or just closing the screen when they finished, their name was not taken of the list and next time they logged in their name would be on the list twice. But after they logged out properly all copies of their names were removed. I thought i could just add a section to the header of each page that said if the session = false, remove from the table. But that did not work. Thanks for the help. I guess i will try do it on a times basis.
  23. Well considering we can't see the code it is hard to help. But after you check the data you can add: header("Location: info.php"); You can add an else statement aftwards if you want it to do something else if their is information.
  24. Do you have any data in the database already? Also if the above does not work, try change your query results around a bit: $query=mysql_query("SELECT * FROM student WHERE accountID=$accountID"); if(mysql_num_rows($query)==0) echo "No Data"; else for($i=0;$i<mysql_num_rows($query);$i++) { $userInfo=mysql_fetch_assoc($query);
  25. Back to first page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.