Jump to content

doddsey_65

Members
  • Posts

    902
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by doddsey_65

  1. Sounds to me like you want someone to code this for you. Have a go yourself. Look into javascript ( you will need that ).

     

     

    When you say "auto update" i take it you mean with no page refresh. This can be accomplished with xhr polling (not reccomended) or sockets. Either way I think those are out of reach and you should focus on the javascript side.

  2. Well the simplest way would be to store the last activity of a user in the database. Then you would check to see if they were active within the last 5 minutes. If they were then you count them as actively online. This is how scripts like phpbb do it. You're never going to be able to check in realtime without the help of something like mongodb or nodejs, but the 5 minute rule is usually effective.

  3. view source shows nothing after the include.

     

    included file contents

    <?php
    $recentTopics = AsfApi::call('topics/get', array('order' => 't_time_posted,desc', 'limit' => 5)); 
    
    foreach($recentTopics as $k => $v)
    {
        $poster[$k] = AsfApi::call('user/info', array('fields' => array('u_username'), 'u_uid' => $v['t_poster']));
                        
        $recentTopics[$k]['t_poster_id'] = $v['t_poster'];
        $recentTopics[$k]['t_poster'] = $poster[$k]['u_username'];
    }
    
    ?>
    
    <div class="sidebar">
        <div class="header">
            <h2>Recent Topics</h2>
        </div>
        <?php foreach($recentTopics as $recent) { ?>
        <dl>
            <dt>
                <img src="/uploads/avatars/doddsey_65.png" alt="" title="doddsey_65's avatar" class="avatar_small">
            </dt>
            
            <dd>
                <p class="list_title">
                    <a href="/topic/<?php echo createUrl($recent['t_name']); ?>|<?php echo $recent['t_tid']; ?>/">
                        <?php echo truncate($recent['t_name']); ?>
                    </a>
                </p>
                <p class="info">
                    <?php echo profileLink($recent['t_poster_id']); ?> <span class="date"><?php echo formatDate($recent['t_time_posted']); ?></span>
                </p>
            </dd>
        </dl>
        <? } ?>
    </div>
    

     

  4. dumping of the include returns nothing, not even null or false, just doesnt display. I have tried:

     

    $include=  include $file;
    if(!$include)
    die(1)
    

     

    nothing displays

     

    dump(include($file));
    

     

    nothing displays

     

    if(include $file)
    echo 'yes'
    else
    echo 'no';
    

     

    still get nothing

     

    And i am using absolute paths for everything given the nature of the project. The included file has no filepath references either.

  5. I am simple using include to include a file within the webpage.

     

    include $file;

     

    $file does exist and is a string. This works fine locally but when testing on my live server it isnt included and nothing below the include is executed, not even plain html.

     

    The error log shows nothing, and there are no errors on screen even when using E_ALL. So i decided to make $file point to the file on the server to see if it was picking it up and it does. So why doesnt the live server want to include this file?

     

    The file consists of php and html but there arent any errors. It wouldnt work locally if there were.

     

    Any ideas?

     

  6. you could send post data with CURL and grab the content of the page that way.

    Eg:

     

            $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, 'http://the-website-here');
    curl_setopt($ch,CURLOPT_POSTFIELDS,'age-post-options);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5");
    
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    
    curl_close($ch);
    

     

    The post options would be something like dob_day=11&dob_month=11&dob_year=1986

     

    This will return the content of the page into the $result variable.

     

    You need to have the CURL module installed and active for this to work.

  7. i too have read that it takes barely anytime to parse and skip white space and tabs so theres no real concern. But my friend is adamant that his way is better. While it will make file size smaller, execution time would be about the same, and even if there was a difference in execution time it would be very small and meager.

  8. Me and my friend are both php coders, but have different ways of coding. He leaves no whitespace where possible for example:

     

    for($i=0;$i<$count;$i++){
    if($i<10)
    echo $i;}
    

     

    whereas I like to keep it looking better with whitespace such as:

     

    for($i=0; $i<$count; $i++)
    {
    if($i<10)
    {
    echo $i;
    }
    }
    

     

    imagine 7000 people making a request to a script with 1000 lines. Would his script run faster? He says yes and I agree but he thinks it will be much faster and efficient, whereas I think there wouldnt be much difference.

     

    What's your opinion?

     

  9. even when using fetch_assoc it still brings up the same case.

     

    while($fields = $sth->fetch(PDO::FETCH_ASSOC))
        {    
            $names[] = unserialize($fields['f_names']);
        }
    

     

    a dump of $fields in the loop shows

    Array (2)
    (
    |    ['f_fid'] = String(1) "1"
    |    ['f_names'] = String(99) "a:4:{i:0;s:18:"register_user_name";i:1;s:5:"r_u_n";i:2;s:10:"user_alias";i:3;s:12:"nickusername";} "
    )
    Array (2)
    (
    |    ['f_fid'] = String(1) "2"
    |    ['f_names'] = String(104) "a:4:{i:0;s:18:"register_password";i:1;s:5:"r_pass_word";i:2;s:10:"user_pass";i:3;s:12:"reg-pass-word";} "
    )
    

     

    but when i dump $names all i get is

     

    Array (2)
    (
    |    ['0'] => Array (4)
    |    (
    |    |    ['0'] = String(18) "register_user_name"
    |    |    ['1'] = String(5) "r_u_n"
    |    |    ['2'] = String(10) "user_alias"
    |    |    ['3'] = String(12) "nickusername"
    |    )
    |    ['1'] = Boolean(0) FALSE
    )
    
    

     

  10. heres the var_export dump

     

    array ( 0 => array ( 'f_fid' => '1', 0 => '1', 'f_names' => 'a:4:{i:0;s:18:"register_user_name";i:1;s:5:"r_u_n";i:2;s:10:"user_alias";i:3;s:12:"nickusername";} ', 1 => 'a:4:{i:0;s:18:"register_user_name";i:1;s:5:"r_u_n";i:2;s:10:"user_alias";i:3;s:12:"nickusername";} ', ), 1 => array ( 'f_fid' => '2', 0 => '2', 'f_names' => 'a:4:{i:0;s:18:"register_password";i:1;s:5:"r_pass_word";i:2;s:10:"user_pass";i:3;s:12:"reg-pass-word";} ', 1 => 'a:4:{i:0;s:18:"register_password";i:1;s:5:"r_pass_word";i:2;s:10:"user_pass";i:3;s:12:"reg-pass-word";} ', ), )
    

    Im using PDO's fetch_results. I used to use fetch_assoc within a while loop but thought that a foreach loop would work better. PDO's fetch_assoc only brings back one row if not used within a while loop.

     

  11. I have an array from the database like so

     

    Array (2)
    (
    |    ['0'] => Array (4)
    |    (
    |    |    ['f_fid'] = String(1) "1"
    |    |    ['0'] = String(1) "1"
    |    |    ['f_names'] = String(99) "a:4:{i:0;s:18:"register_user_name";i:1;s:5:"r_u_n";i:2;s:10:"user_alias";i:3;s:12:"nickusername";} "
    |    |    ['1'] = String(99) "a:4:{i:0;s:18:"register_user_name";i:1;s:5:"r_u_n";i:2;s:10:"user_alias";i:3;s:12:"nickusername";} "
    |    )
    |    ['1'] => Array (4)
    |    (
    |    |    ['f_fid'] = String(1) "2"
    |    |    ['0'] = String(1) "2"
    |    |    ['f_names'] = String(104) "a:4:{i:0;s:18:"register_password";i:1;s:5:"r_pass_word";i:2;s:10:"user_pass";i:3;s:12:"reg-pass-word";} "
    |    |    ['1'] = String(104) "a:4:{i:0;s:18:"register_password";i:1;s:5:"r_pass_word";i:2;s:10:"user_pass";i:3;s:12:"reg-pass-word";} "
    |    )
    )
    

     

    So i use a foreach loop to turn the serialized value into an array

     

    foreach($fields as $key => $val)
        {
            $fields[$key]['f_names'] = unserialize($val['f_names']);
        }
    

     

    But for some reason the last f_names is false

     

    Array (2)
    (
    |    ['0'] => Array (4)
    |    (
    |    |    ['f_fid'] = String(1) "1"
    |    |    ['0'] = String(1) "1"
    |    |    ['f_names'] => Array (4)
    |    |    (
    |    |    |    ['0'] = String(18) "register_user_name"
    |    |    |    ['1'] = String(5) "r_u_n"
    |    |    |    ['2'] = String(10) "user_alias"
    |    |    |    ['3'] = String(12) "nickusername"
    |    |    )
    |    |    ['1'] = String(99) "a:4:{i:0;s:18:"register_user_name";i:1;s:5:"r_u_n";i:2;s:10:"user_alias";i:3;s:12:"nickusername";} "
    |    )
    |    ['1'] => Array (4)
    |    (
    |    |    ['f_fid'] = String(1) "2"
    |    |    ['0'] = String(1) "2"
    |    |    ['f_names'] = Boolean(0) FALSE
    |    |    ['1'] = String(104) "a:4:{i:0;s:18:"register_password";i:1;s:5:"r_pass_word";i:2;s:10:"user_pass";i:3;s:12:"reg-pass-word";} "
    |    )
    )
    

     

    Anyone have any idea why?

     

    Thanks

     

  12. When you delete a thread it still shows up on the index and errors when you try to view it.

     

    Forgot to change the last post of the forum when the newest one is deleted. I will get round to it now.

     

    If you include <script> in the subject when editing a thread the page just hangs.

     

    should have used htmlentities.

     

    When I clicked the thread pagination the header, the shout box and thread tools were added twice. As seen here: http://i.imgur.com/EnAac.png.

     

    topic and post pagination used to be done via ajax, the new topics would be loaded into the wrapper div. I got rid of it but mustn't have made all the needed changes to remove it completely.

     

    Thanks

     

     

  13. I have a class which pulls settings from the database. These settings are needed for the application to be run. Currently it queries the database on each page load and adds the information to a static variable.

     

    What I'm after is a way to store this information in the variable so it can be accessed on each page without having to query the database. Memcache is an option but it can be disabled in my application so I am after another if possible.

     

    Thanks

     

  14. Since i need more indepth testing of the moderator features I will promote the first 10 users who login today. They will be promoted to the BETA testers group.

     

    This group will allow you to edit topics and posts. You will be able to test features such as inline editing of topics and posts as well as testing the deletion of posts and avatars. You will also be given the ability to bypass the flood control (only on posts) so you can fully test without having to wait 30 seconds between posts.

     

    Thanks

     

  15. i just entered this address and got this info. Just helping to check any security breached o.0

     

    Which address?

     

    Changing the page title with the url isnt a major flaw. The post is pulled using the id in the url, the name is just there for SEO purposes, so changing it doesnt really matter.

     

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