Source codes, small scripts...

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wapkralj
    replied
    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.'
    '; 
    

    Leave a comment:


  • wapkralj
    replied
    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 (99, 46) //change the image size here
    or die ("Kann keinen neuen GD-Bild-Stream erzeugen");
    $background_color = ImageColorAllocate ($im, 255, 255, 255);
    $text_color = ImageColorAllocate ($im, 255, 0, 0);
    ImageString ($im, 2, 1, 1, "$aufruf", $text_color2); 
    header('Content-Type: image/GIF');
    ImageGIF ($im);
    ?>

    Leave a comment:


  • wapkralj
    replied
    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 > 1 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."
    "; 
    

    Leave a comment:


  • wapkralj
    replied
    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;}
    ?>

    Leave a comment:


  • GumSlone
    started a topic Source codes, small scripts...

    Source codes, small scripts...

    Post here source codes of small scripts.....
Working...
X