Page 1 of 13 12311 ... LastLast
Results 1 to 10 of 125
Like Tree5Likes

Thread: Source codes, small scripts...

  1. #1
    Administrator GumSlone's Avatar
    Join Date
    Mar 2005
    Location
    Mars, GumCity
    Posts
    1,495
    Thanks
    125
    Thanked 573 Times in 201 Posts
    Blog Entries
    2
    Rep Power
    10

    Default

    Post here source codes of small scripts.....
    Advertise your mobile site for FREE with [Only registered and activated users can see links. Click Here To Register...]

    [Only registered and activated users can see links. Click Here To Register...]


  2. #2
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    Redirect script webbrowser from wap to web and wapbrowser from web to wap.

    PHP Code:
    <?
    $htmlredirect 
    "http://kralj.frih.net";
    $wmlredirect "http://kralj.r8.org";
    if(
    strpos(strtoupper($HTTP_ACCEPT),"VND.WAP.WML") > 0){
    header("Location: ".$wmlredirect);}
    else{
    header("Location: ".$htmlredirect);
    exit;}
    ?>

  3. #3
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    Easy listing the text file,you can add links ,images ,and so on
    PHP Code:
    $p 5;
    $xfile=file('test.txt');
    $countfile=count($xfile);

    if(
    $npage=="")$npage="1";
    echo 
    "Tests:".$countfile."\n";
    $second=($p*$npage);
    $first=($p*($npage-1));
    $npages=(int) ceil($countfile/$p);
    if (
    $npage<=$npagesAND$npage>1)$gline_rew="<a href=\"$PHP_SELF?npage=".($npage-1)."\">Prev</a>";
    if (
    $npages AND $npage<$npages$gline_next "<a href=\"$PHP_SELF?npage=".($npage+1)."\">Next</a> ";
    for (
    $i $first$i <=*$second-1$i++)
      { 
    $a=explode("?",$xfile[$i]);
    $test rtrim($a[0]);
    echo 
    "$test";
    }
    print 
    " ".$gline_rew." ".$gline_next."
    "


  4. #4
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    Graphic counter.
    !!! Dont forget to create count.txt file and cmod 777
    if your server does not support Gif image create, use png image create.
    Replace
    header('Content-Type: image/GIF');
    ImageGIF ($im);

    with
    header('Content-Type: image/PNG');
    ImagePNG ($im);

    thats all
    PHP Code:
    <?
    // Image Counter Script
    if(!file_exists("count.txt"))
    {
    $counter=fopen("count.txt""a");}
    else
    {
    $counter=fopen("count.txt""r+");}
    $aufruf=fgets($counter,100);
    $aufruf=$aufruf+1;
    rewind($counter);
    fputs($counter,$aufruf);
    fclose($counter);
    $im = @ImageCreate (9946//change the image size here
    or die ("Kann keinen neuen GD-Bild-Stream erzeugen");
    $background_color ImageColorAllocate ($im255255255);
    $text_color ImageColorAllocate ($im25500);
    ImageString ($im211"$aufruf"$text_color2); 
    header('Content-Type: image/GIF');
    ImageGIF ($im);
    ?>

  5. #5
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    easy total hits ,put it on page where want to count hits
    PHP Code:
    $counter_array file("counter.dat");
    $all $counter_array[0]+1;
    $fp = @fopen("counter.dat","wb");
    @
    fputs($fp,$all);
    @
    fclose($fp); 
     
    echo 
    '
    Total hits: '
    .$all.'
    '


  6. #6
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    Here is countdown script: k:
    PHP Code:
    <?
    $day 
    1;
    $month 1;
    $year 2006;
    $end mktime(0,0,0,$month,$day,$year);
    $todaymktime(date("G"),date("i"),
    date("s"),date("m"),date("d"),date("Y"));
    $days=($end-$today)/86400;
    if (
    $days>0) {
    $r1 explode('.',$days);
    $hours=24*($days-$r1[0]);
    $r2 explode('.',$hours);
    $minutes=60*($hours-$r2[0]);
    $r3 explode('.',$minutes);
    $seconds=60*($minutes-$r3[0]);
    $r4 explode('.',$seconds);
    echo 
    'Days left: ' .$r1[0];
    echo 
    '
    Time left: ' 
    $r2[0] . ':' $r3[0] . ':' $r4[0];
    } else {
    echo 
    "Happy new year:)";}
    ?>

  7. #7
    CLINT
    Guest

    Default

    <div align="center">RANDOM IMAGE SCRIPT</div>

    First create a folder called image.gif and upload your images to it.
    When you have done that, make a file in that folder called index.php and add this code
    PHP Code:
    <?php

                    $folder 
    '.';

        
    $extList = array();
        
    $extList['gif'] = 'image/gif';
        
    $extList['jpg'] = 'image/jpeg';
        
    $extList['jpeg'] = 'image/jpeg';
        
    $extList['png'] = 'image/png';
        
    $img null;

    if (
    substr($folder,-1) != '/') {
        
    $folder $folder.'/';
    }

    if (isset(
    $_GET['img'])) {
        
    $imageInfo pathinfo($_GET['img']);
        if (
            isset( 
    $extListstrtolower$imageInfo['extension'] ) ] ) &&
            
    file_exists$folder.$imageInfo['basename'] )
        ) {
            
    $img $folder.$imageInfo['basename'];
        }
    } else {
        
    $fileList = array();
        
    $handle opendir($folder);
        while ( 
    false !== ( $file readdir($handle) ) ) {
            
    $file_info pathinfo($file);
            if (
                isset( 
    $extListstrtolower$file_info['extension'] ) ] )
            ) {
                
    $fileList[] = $file;
            }
        }
        
    closedir($handle);

        if (
    count($fileList) > 0) {
            
    $imageNumber time() % count($fileList);
            
    $img $folder.$fileList[$imageNumber];
        }
    }

    if (
    $img!=null) {
        
    $imageInfo pathinfo($img);
        
    $contentType 'Content-type: '.$extList$imageInfo['extension'] ];
        
    header ($contentType);
        
    readfile($img);
    } else {
        if ( 
    function_exists('imagecreate') ) {
            
    header ("Content-type: image/png");
            
    $im = @imagecreate (100100)
                or die (
    "Cannot initialize new GD image stream");
            
    $background_color imagecolorallocate ($im255255255);
            
    $text_color imagecolorallocate ($im0,0,0);
            
    imagestring ($im255,  "IMAGE ERROR"$text_color);
            
    imagepng ($im);
            
    imagedestroy($im);
        }
    }

    ?>
    Now by linking to yoursite.com/image.gif (image.gif being the folder) the index file will automatically run and random images will be displayed. That means you can display random images in forums like these.

    Cool eh?!

  8. #8
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    WapBuddy File dir script.
    PHP Code:
    <?
    $conf
    ["items_per_page"] = 20;
    header("Content-type: text/vnd.wap.wml");
    echo 
    "<?xml version=\"1.0\"?>";
    echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
    if (!isset(
    $page)) {$page 0;}
    $total 0;
    if(!(
    $dp opendir("./"))) die ("Cannot open ./");
    $file_array = array();
    while (
    $file readdir ($dp))
    {
    if(
    substr($file,0,1) != '.' and $file != "index.php")
    {
    $file_array[] = $file;
    }
    }
    $file_count count ($file_array);
    sort ($file_array);
    ?>
    <wml>
    <card id="card1" title="">
    <p mode="nowrap">
    <do type="option" label="Home"><go href="/index.php"/></do>
    <? echo "<a href=\"/best.php\">*Best STUFF*</a>
    <a href=\"/index.php\">•Home•</a>

    "
    ?>
    <?
    if ($file_count 0)
    {
    $first_record $page $conf["items_per_page"];
    $last_record $first_record $conf["items_per_page"];
    while (list(
    $fileIndexValue$file_name) = each ($file_array))
    {
    if ((
    $fileIndexValue >= $first_record) AND ($fileIndexValue $last_record))
    {
    echo 
    "<a href=\"$file_name\">$file_name</a> ("round(filesize($file_name)/1024,1) . "kb)
    "
    ;
    $total $total filesize($file_name);
    }
    }
    if ((
    $file_count 0) AND ($page != 0))
    {
    // previous button
    $prev_page $page -1;
    echo 
    "
    <a href=\""
    .$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev</a>
    "
    ;
    }
    if ((
    $file_count 0) AND ($last_record $file_count))
    {
    // next button
    $next_page $page 1;
    echo 
    "
    <a href=\""
    .$_SERVER["PHP_SELF"]."?page=$next_page\">Next</a>
    "
    ;
    }
    echo 
    "
    Directory:
    $file_count ";
    if (
    $file_count == 1)
    {echo 
    "file";}
    else
    {echo 
    "files";}
    echo 
    " (" round($total/1024,1) . "kb)";
    echo 
    "
    <a href=\"/index.php\">•Home•</a>"
    ;
    echo 
    "
    <a href=\"/downloads.php\">?Downloads</a>"
    ;
    echo 
    "
    <a href=\"page.php\">Pages</a>"
    ;
    }
    closedir($dp);
    ?>

    </p>
    </card>
    </wml>

  9. #9
    CLINT
    Guest

    Default

    TIME MESSAGES

    PHP Code:
    <?php

    $TimeZone
    ="8"////Change the TimeZone accordingly!
    $New_Time time() + ($TimeZone 60 60);

    $show_date=date("D dS F, Y",$New_Time); 
    $show_time=date("H:i",$New_Time); 
    $Hour=date("G",$New_Time);

    echo 
    $show_date;
    echo
    "
    "
    ;
    echo 
    $show_time;
    echo
    "
    "
    ;


    ////////////////Here you can change the messages, add lines with different hours etc. You could even display a different message every hour.////////////////

    if ($Hour <= 4) { echo 'Hello night owl!'; } 

    else if (
    $Hour <= 11) { echo 'Good morning!'; } 

    else if (
    $Hour <= 12) { echo 'Enjoy your lunch!'; }

    else if (
    $Hour <= 17) { echo 'Good afternoon!'; } 

    else if (
    $Hour <= 23) { echo 'Good Evening!'; }

    ?>

  10. #10
    Senior Member
    Join Date
    Feb 2006
    Posts
    238
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Default

    FTP UPLOAD SCRIPT IT CAN ALSO BE USED FOR WAP

    CODE
    PHP Code:
    <?php

    $ftp_server 
    "...";
    $ftp_user "...";
    $ftp_pass "...";
    $remote_file "movie.mpg";
    $local_file "/tmp/movie.mpg";

    // set up a connection or die
    $conn_id ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");

    // try to login
    if (@ftp_login($conn_id$ftp_user$ftp_pass)) {
    echo 
    "Connected as $ftp_user@$ftp_server\n";
    // upload a file
    if (ftp_put($conn_id$remote_file$local_fileFTP_BINARY)) {
    echo 
    "successfully uploaded $file\n";
    } else {
    echo 
    "There was a problem while uploading $file\n";
    }


    } else {
    echo 
    "Couldn't connect as $ftp_user\n";
    }

    // close the connection
    ftp_close($conn_id); 
    ?>

Page 1 of 13 12311 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 75 Web Scripts
    By KillaKlan in forum Scripts Forum
    Replies: 4
    Last Post: 19-04-11, 18:36
  2. [web] 65 Most Needed Php Scripts
    By jayasanka in forum Scripts Forum
    Replies: 19
    Last Post: 09-11-10, 15:30
  3. Hide codes from Source Code Viewer
    By anderson in forum Coding Forum
    Replies: 12
    Last Post: 24-09-09, 11:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

SEO by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19