Jump to content

runnerjp

Members
  • Posts

    2,214
  • Joined

  • Last visited

Posts posted by runnerjp

  1. At the moment i have added some code to add a number to the post so looks liek this

     

    1#

    2#

    3#

    4#

    ect

     

    The problem is now i have added pagination to it when i go to page 2 it starts form 2# again... any way i can make it carry on from where it left off??

    $counter2 = 1;
    $counter2++;
    echo $counter2;

  2. ok i have tried this...

     

    $counter2 = 0;
    $counter2++;
        $getreplies
                    =
            "Select * from forumtutorial_posts where parentid='$forumpostid' ORDER BY showtime $max"; //getting replies
    
        $getreplies2=mysql_query($getreplies) or die(mysql_error() . "Could not get replies");
    
        while ($getreplies3=mysql_fetch_array($getreplies2))
            {
        ?><br />
    
            <table width = "90%" align="center" cellpadding = "0" cellspacing = "0" >
                <tr>
                    <td>
                        <table width = "100%" align = "center" cellpadding = "0" cellspacing = "0" class="loggedin">
                           <tr>
                        <td colspan="3" align="right" class = 'border'>  <table width="100%">
                          <tr>
                            <td width="15%" align="left"><font size="2" color="white">   
    
    <?php
    
    echo $counter2; ?>
    

     

     

    put it just has 1 on them all

     

     

     

  3. No i just get:

     

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/runningp/public_html/members/include/message.php on line 271

     

    Warning: Invalid argument supplied for foreach() in /home/runningp/public_html/members/include/message.php on line 271

  4. Hey i have my forum set up and i want to have a number next to the post.. e.g #2 #3# ect

     

    Below is my array and the page displayed for each array

    $getreplies
                    =
            "Select * from forumtutorial_posts where parentid='$forumpostid' ORDER BY showtime $max"; //getting replies
    
        $getreplies2=mysql_query($getreplies) or die(mysql_error() . "Could not get replies");
    
        while ($getreplies3=mysql_fetch_array($getreplies2))
            {
        ?><br />
    
            <table width = "90%" align="center" cellpadding = "0" cellspacing = "0" >
                <tr>
                    <td>
                        <table width = "100%" align = "center" cellpadding = "0" cellspacing = "0" class="loggedin">
                           <tr>
                        <td colspan="3" align="right" class = 'border'>  <table width="100%">
                          <tr>
                            <td width="15%" align="left"><font size="2" color="white">   
    
    
    <?php foreach(array_keys($getreplies2) as $key){ 
    echo $key ." ". $getreplies2[$key]."<br>"; 
    } ?>
    
    <a name="<?php echo $getreplies3['postid'] ?>"> </a><a href ='http://www.runningprofiles.com/members/index.php?page=message&forum=<?php echo $forum ?>&id=<?php echo $forumpostid ?>#<?php echo $getreplies3['postid'] ?>'><strong>RE: <? echo $gettopic3[title] ?></strong></a></span></font></td>
                            <td width="32%" align="left"> </td>
                            <td width="33%" align="right"><font size="2" color="white">» Replied
    

     

    obv more below but you only need to see code above really.

     

    Where it says :

    <?php foreach(array_keys($getreplies2) as $key){ 
    echo $key ." ". $getreplies2[$key]."<br>"; 
    } ?>
    
    

     

    i wanted it to display the array number but also i need it to start from #2. 

     

    Is any 1 able to help?

  5. Im trying to set up a script so users can see if any new posts have been in the forum since their last visit to that forum.  The code is below but it always seems to show no new posts even if there is :S

     

    General has 1266143084  and last post has 1266143616 ...

     

     

    Where am i going wrong>>>

     

    $getthreads_result = mysql_query("Select * from forumtutorial_posts where parentid='0' and forum = 'general' ORDER BY lastrepliedto DESC ") or
                                                          die("Could not get threads");
    
                          $getthreads = mysql_fetch_array($getthreads_result);
    
                          $getlastpost = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE Username = '$username' "));
                           
    
                          echo "<img src=\"http://www.runningprofiles.com/images/postforum.", (($getlastpost['General'] <= $getthreads['lastrepliedto']) ? "gif" : "jpg"), "\" alt=\"My\" />";

  6. Hey guys,

     

    Im setting up my get to check if it comes with 5 diff outcomes.  ( for this purpose i will use 1 to test it)

     

    If ($_GET['forum']== 'General')
    {$forum=$_GET['forum'];}
    else
    {$forum='null';}

     

    how could i add this rule to

     

    $data = mysql_query("Select * from forumtutorial_posts where parentid='0' AND forum = '$forum' ORDER BY important, lastrepliedto")or die("Could not get users");
    $rows = mysql_num_rows($data);
    

     

    so that if forum = null i can throw up an error page saying this forum doesnot exsist or something of that lines.

     

    If there is an easyer way to do this im open to suggestions but this is the only way i can think of atm

     

    $_get

  7. Sorry about this but on this page can any 1 tell me what i need to chnage to prevent the erro message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Admin',`user_id`='1'' at line 1' appearing?  as i cant seem to find the area involved/

     

    cut down code as much as possible

    <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"> 
    <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/members/include/style.css"> 
    
    
    <?php
    //look to see if the forum is currently locked
    $sQry = "SELECT `locked` FROM forum_lock LIMIT 1";
    $obQry = mysql_query($sQry) or die(sprintf("Could not query forums (%d): %s",mysql_errno(),mysql_error()));
    $record = mysql_fetch_array($obQry);
    
    
    if (isset($record['locked']) && $record['locked'])
    	{
    	die("Sorry, the forums are currently locked."); //error message
    	}
    else
    {
    
    
    //Here we count the number of results
    $data = mysql_query("Select * from forumtutorial_posts where parentid='0' AND forum = '$forum' ORDER BY important, lastrepliedto")or die("Could not get users");
    $rows = mysql_num_rows($data);
    $page_rows = 25; //This is the number of results displayed per page
    $pagenum = $_GET['pagenum']; //This sets the range to display in our query
    
    	if ($pagenum === "last")
    	{
    		$query = "Select COUNT(*) as C from forumtutorial_posts where parentid='$id'";
    		$result = mysql_query($query);
    		$data = mysql_fetch_array($result);
    		$pagenum = ceil($data['C'] / $page_rows);
    			}
    			$pagenum = (is_numeric($pagenum) && $pagenum >= 1) ? (int)$pagenum : 1;
    			$max = 'limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows;
    
    
    
    
    			{
    /* gets users online */
    			$getusersonline = "SELECT user_id,user FROM useronline    WHERE  file = 'http://www.runningprofiles.com/members/index.php?page=forum&forum=$forum' AND
    			timestamp > " . (time() - 900); //grab from sql users on in last 15 minutes
    			$getusersonline2 = mysql_query($getusersonline) or die("Could not get users");
    			$num = mysql_num_rows($getusersonline2);
    
    
    $getthreads = "Select * from forumtutorial_posts where parentid='0' and forum = '$forum' ORDER BY important ASC, lastrepliedto DESC $max";
    
    $getthreads2 = mysql_query($getthreads) or die("Could not get threads");
    while ($getthreads3 = mysql_fetch_array($getthreads2))
    {
    
    										$important = $getthreads3['important'];
    
    											$query1 = mysql_query("SELECT COUNT(postid) FROM forumtutorial_posts WHERE( postid= '$getthreads3[postid]' OR parentid = '$getthreads3[postid]' ) AND author='$username'");
    $count = mysql_result($query1, 0, 0);
    echo ($count != 0)  ? '<img src="/images/posted.jpg" />' : '<img src="/images/posted2.jpg" />'; 
      ?>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

  8. Right so all data input i need to mysql_real_escape_string and that should sort the problem. Would there be any way of avoiding the You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'name',`user_id`='number'' at line 1.

     

    Coming up or would mysql_real_escape_string stop this from coming up anyway?

     

    @Mchl - sorry for supplying no code , but didnt know if it would help or just bulk up the post

     

  9. Hey guys.

     

    My site got hacked at the weekend, thankfully all they did was delete my test posts and post a message on the forum. Been trying to find how they did it with my login script ect but seems to me they have not cracked the login screen as it seems tight.

     

    Then i think i found out how.  i use page= withing my script so thought i would try the adding of ' at the end of the script. This then comes up with the error message:

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'name',`user_id`='number'' at line 1.

     

    Im right in saying they can change anything in my sql database with this loop hole cant they!

     

     

    What im asking is how can i fix this??

     

     

    Regards

     

    Jarratt

  10. Ok a user has been able to access my site and delete all forum posts/ and post under my admin name this

     

    "--------------------------------------------------------------------------------

     

      Charlie Chaplin once said something to the effect of:

     

    'Humour is an act of defiance; that we must laugh at our helplessness against the forces of nature, or go insane.'

     

    And where is he now? Dead. 

     

    "

     

    I have set up a test account to see whats happening.

     

    username: demo

    password: demo

     

    its only happening on the forum area.  www.runningprofiles.com  ( i added phpfreaks login so you can see its my site)

  11. Ok so far so good. Im now onto recording the time a user looks at a specific forum...

     

    So i have 5 to choose from

     

    General

    races

    Training

    Injuries

    Q and A

     

    How would i run a script to do if on general page update this coulume but if on this one update this colume.

     

    I have to add all this is run off one php page.

  12. I have just installed phpMyAdmin 2.11.10 but when i go to the login page all i get is

     

    Error

    MySQL said: 

     

    #1045 - Access denied for user 'root'@'localhost' (using password: NO)

     

    Below is my config.inc.php

     

    <?php
    /*
    * Generated configuration file
    * Generated by: phpMyAdmin 2.11.10 setup script by Michal ÄŒihaÅ™ <michal@cihar.com>
    * Version: $Id: setup.php 13149 2009-12-07 13:09:09Z nijel $
    * Date: Thu, 04 Feb 2010 22:15:31 GMT
    */
    
    /* Servers configuration */
    $i = 0;
    
    /* Server localhost (config:root) [1] */
    $i++;
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['extension'] = 'mysql';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['auth_type'] = 'http';
    
    $cfg['Servers'][$i]['AllowDeny']['order'] = '';
    
    $cfg['Servers'][$i]['AllowDeny']['rules'] = array();
    
    
    
    /* End of servers configuration */
    

     

    Should it just come up with a login sceen asking for my details and i can then login??

     

    Am i supposed to do something with Configure server??

  13. Hey guys,

     

    Im trying to implament a  New Posts or No New Posts on forums. Now i would like to make it so its like on here where iif i look at 'php hep page' it shows new posts since the last time i accessed the 'php help page'.

     

    Now would i have to record each time  i view the php help page with the time/date, then check it against last post time, or would there be a better way of doing this?? 

×
×
  • 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.