Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. so how did you achive this, i have done before via ajax but wbu ?

     

    Its ajax and javascript on roids :P

     

    Theyre proberly using ob, flush etc.. stuff as well........and maybe even smarty caching

     

    I'm not sure you have a clue what your talking about, but it is very amusing.

     

    True. I have no idea HOW it works, but it works.

     

    ob_end_flush();
    ob_flush();
    flush();
    ob_start();

     

    Most successful ppl know - you dont need to know everything to be successful, in fact here are some truths about being successful:

     

    *The key to success is laziness

    *Good thing im not intelligent - otherwise ill have a "good job" <-emphasis on good job HA!

    *The less you do the more you earn

    *Duplication is the key to success

     

    The moral of the story:

    You dont need to know everything about programming to be a successful at it  :D

     

  2. OK ive improved it:

     

    session_start();
    error_reporting( 0 );
    
    function redirect( $url ){
        if (! headers_sent( ) ){
        
            header( "Location: ".$url );
            exit( 0 );
        }
        echo "<script language=Javascript>document.location.href='".$url."';</script>";
        exit( 0 );
    }
    
    $_SESSION = array();
    
    if (isset($_COOKIE[session_name()])) {
        setcookie(session_name(), '', time()-42000, '/');
    }
    session_destroy();
    
    redirect('/');
    
    

  3. Thats not a particularly good logout script though.  The session_destroy function doesn't actually unset any of the global variables, it only destroys information about the session itself. If session_start is called again the values will still be set, this is undesirable behavior.

     

    But thats all logout.php will contain:

    session_start();
    session_destroy();

     

    ...and maybe a redirect to the main page.

     

    I tested it - I destroyed the session and went to another page on the same site and the session was gone..... Magic :o

  4. I can't seem to see a great deal of difference in speed. You do loose the functionality of the back button though... And of course you loose all the extra features that comes with Google. Is there an image search?

     

    Its not the site thats great, its the page loading speed thats the beauty. Other than that the site is pretty ordinary.

     

    If this is a Metasearcher they need to be given an award, most metasearchers take 2-6 seconds for a request

  5. preg stuff uses more resources and should be used sparingly, explode and str_replace are better alternatives for looping data

     

    Im assuming the dictionary has over 500 words in it so:

     

     for($i=0;$i<count($dictionary);$i++){
          
          $parts = preg_replace("/\b$dictionary[$i]\b/", $htmldictionary[$i], $parts);
          $parts = preg_replace("/\b" . strtoupper($dictionary[$i]) . "\b/", $htmldictionary_u[$i], $parts);
          $parts = preg_replace("/\b" . ucfirst($dictionary[$i]) . "\b/", $htmldictionary_u1[$i], $parts);
          $parts = preg_replace("/\b" . ucwords($dictionary[$i]) . "\b/", $htmldictionary_ucwords[$i], $parts);
       } 

     

    Is executing for each word. Change it all to str_replace

  6. If title is a variable and your calling it before you defined it, of course it wont display anything

     

    <?php
    echo "<title>{$title_name}</title>";
    $title_name = "Title here";
    ?>

     

    You will need functions.php above the title tag

     

    <?php
    
    include('functions.php'); //which has the $title_name variable in it
    echo "<title>{$title_name}</title>";
    
    ?>

  7. You can set the fields as UNIQUE, but that will crash your script if you try to add a duplicate, heres an easy way:

     

     if ( $_POST ['Submit']){
    
    $username = mysql_real_escape_string($_POST ['usernm']);
    $userpassword = mysql_real_escape_string($_POST ['userpw']);
    
    $result = mysql_query("SELECT usernm FROM users WHERE usernm='{$username}' and  userpw='{$userpassword}'  ");
    if($result){
    
    $num = mysql_num_rows( $result );
    
    if ($num == 0) { 
       $querypost = mysql_query ("INSERT INTO users (usernm, userpw) VALUES ('$username','$userpassword')");
    }
    }
    }

  8. I found this, it improves the image by up to 200%

     

    $im = new imagick( "test.png" );
    $im->contrastImage( 1 );
    $im->adaptiveBlurImage( 1, 1 );
    
    //output
    header( "Content-Type: image/png" );
    echo $im;
    

     

    But im still curious if there is something else i can add to this to get an even better image

  9. Where is curl located? IN the include script??

     

    You just need the url for curl to post to, then set the curl_setopt you want. In your form you only need what you are posting nothing more. Your form action should point to where curl is.

     

    curl is quite easy once you play with it a bit, then youll want to learn multi handle function curl_multi_add_handle, you can literally open 1000 pages within seconds and post to them all

  10. Ive revised this, this will give you title, player and thumb

     

    $src = file_get_contents("http://gdata.youtube.com/feeds/videos?vq=Gitano%20corazon&start-index=1&max-results=10");
    
    preg_match_all('~<media:player url\s?=\s?[\'"](.*?)</media:title>~is', $src, $match);
    
    foreach ($match[1] as $stuff) {
    
    $tmb = explode('watch?v=',$stuff);
    $tmb = explode('&feature',$tmb[1]);
    $tmb = $tmb[0];
    
    $title = explode("<media:title type='plain'>",$stuff);
    $title = $title[1];
    
    $play = explode("'/><media:thumbnail",$stuff);
    $play = $play[0];
    
    
    echo "<img src='http://i.ytimg.com/vi/{$tmb}/2.jpg'  height='90' width='120'><br>Title: {$title}<br>Player: {$play}<br>";
    }

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