Post here source codes of small scripts.....
Advertise your mobile site for FREE with AdTwirl
Started on the old forum in June 2006 · view the original in the archive · old links redirect here
Post here source codes of small scripts.....
Advertise your mobile site for FREE with AdTwirl
Redirect script webbrowser from wap to web and wapbrowser from web to wap.
<?
$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;}
?>
Easy listing the text file,you can add links ,images ,and so on
$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."
";
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
<?
// 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);
?>
easy total hits External image (may be gone) ,put it on page where want to count hits External image (may be gone)
$counter_array = file("counter.dat");
$all = $counter_array[0]+1;
$fp = @fopen("counter.dat","wb");
@fputs($fp,$all);
@fclose($fp);
echo '
Total hits: '.$all.'
';
Here is countdown script: External image (may be gone)k:
<?
$day = 1;
$month = 1;
$year = 2006;
$end = mktime(0,0,0,$month,$day,$year);
$today= mktime(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:)";}
?>
RANDOM IMAGE SCRIPT
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
$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( $extList[ strtolower( $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( $extList[ strtolower( $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 (100, 100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "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?! External image (may be gone)
WapBuddy File dir script.
<?
$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>
TIME MESSAGES
<?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!'; }
?>
FTP UPLOAD SCRIPT IT CAN ALSO BE USED FOR WAP
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_file, FTP_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);
?>
ONLINE USERS
Display who is online. Create a file called besucher.txt and chmod to 777. Now create a file called online.php or whatever and add this.
<?
header("Content-Type: text/vnd.wap.wml");
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card title="Online">
<do type="prev" label="Back"><prev/></do>';
print "
";
$xfile = @file("besucher.txt");
$xfile = array_reverse($xfile);
$p = 150;
if ($npage == ""){$npage = "1";}
$first = count($xfile) - ($p * ($npage - 1));
$second = count($xfile) - ($p * $npage) + 1;
if ($second < 1) {$second = 1;}
$npages = (int)(count($xfile) / $p);
if ($news_limiter>((int) ($npages*$p))) $npages = $npages+1;
if ($npage <= $npages and $npage>1) $gline_rew = "<a href=\"guest.php?npage=".($npage-1)."\">Prev</a>";
if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"guest.php?npage=".($npage+1)."\">Next</a>";
$line = "";
for ($p = 1; $p <= $npages; $p++) {
if ($p != $npage) { $line .= "<a href=\"guest.php?npage=$p\"> $p </a>|";}
if ($p == $npage) { $line .= "| $p |
"; }
}
print $line;
for ($i = $first-1; $i >= $second-1; $i--) {
$ii = $i;
$ii++;
$udata = explode("&&",$xfile[$i]);
print "$udata[1]
";
print "--------
";
}
print $gline_rew."".$gline_next."
<a href=\"/index.php\">LandOfwap.net</a></p>
</card>
</wml>";
?>
I think this is one of GumSlone's scripts.
hits and useronline in one
create folder counter
create besucher.txt
upload useronline.php and guest.php and edit them
add this cod to your main php page
$szamlalo_File = "counter/".date("Ymd").".txt";
if (file_exists($szamlalo_File)) {
$szamlalo_fp = fopen($szamlalo_File,"r");
$szamlalo_num = fread($szamlalo_fp, filesize($szamlalo_File));
fclose($szamlalo_fp);
}
$szamlalo_num=$szamlalo_num+1;
$szamlalo_fp = fopen($szamlalo_File,"w");
fwrite($szamlalo_fp, $szamlalo_num, 10);
fclose($szamlalo_fp);
$counter_array = file("counter.dat");
$all = $counter_array[0]+1;
$fp = @fopen("counter.dat","wb");
@fputs($fp,$all);
@fclose($fp);
echo "Visit number: $all
Visits today $szamlalo_num
Online <a href=\"guest.php\">$anzahl</a>";
guest.php
<? header("Content-Type: text/vnd.wap.wml"); header("Cache-control: no-cache, must-revalidate"); echo '<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <wml> <card title="UserOnline"> <do type="prev" label="Back"><prev/></do>'; print "
"; $xfile = @file("besucher.txt"); $xfile = array_reverse($xfile); $p = 150; if ($npage == ""){$npage = "1";} $first = count($xfile) - ($p * ($npage - 1)); $second = count($xfile) - ($p * $npage) + 1; if ($second < 1) {$second = 1;} $npages = (int)(count($xfile) / $p); if ($news_limiter>((int) ($npages*$p))) $npages = $npages+1; if ($npage <= $npages and $npage>1) $gline_rew = "<a href=\"guest.php?npage=".($npage-1)."\">prev</a>"; if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"guest.php?npage=".($npage+1)."\">next</a>"; $line = ""; for ($p = 1; $p <= $npages; $p++) { if ($p != $npage) { $line .= "<a href=\"guest.php?npage=$p\"> $p </a>|";} if ($p == $npage) { $line .= "| $p |
"; } } print $line; for ($i = $first-1; $i >= $second-1; $i--) { $ii = $i; $ii++; $udata = explode("&&",$xfile[$i]); print "$udata[1]
"; } print $gline_rew."".$gline_next." --------
<a href=\" index.php\">?Back</a>? wapkralj
</p> </card> </wml>"; ?>
useronline.php
<?
$daten="besucher.txt";
$time = time();
$brow=("$REMOTE_ADDR");
$user = explode ('/', $HTTP_USER_AGENT);
$ip = ("Browser: $user[0] IP: $brow");
$ablaufzeit = "$time"-"300"; //zdes mozhno nastroit wremja kak dolgo ip budet xranitsja w txt fajle
$pruefung = @file($daten);
while (list ($line_num, $line) = @each ($pruefung))
{$zeiten = explode("&&",$line);
if($zeiten[0] <= $ablaufzeit)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$ippruefung = @file($daten);
while (list ($line_num, $line) = @each ($ippruefung))
{$ips = explode("&&",$line);
if($ips[1] == $ip)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$fp = fopen("$daten", "a+");
flock($fp,2);
fputs ($fp, "$time&&$ip&&\n");
flock($fp,3);
fclose ($fp);
$anzahldaten = file($daten);
$anzahl = count($anzahldaten); //eto pokazivaet koli4estwo 4elowek na sajte,
nado sozdat eshe textfile besucher.txt**i ego chmod777,
u menja etot script wstawlen tolko w index.php kone4no mozhesh wstawit ego w kazhduju stranicu*/
?>
PHONE ENVIRONMENT
I got this code from a post that GumSlone made in the forums that got deleted.
<?
header("Content-type:text/vnd.wap.wml;charset=UTF-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n
<wml>\n
<head>\n
<meta name=\"vnd.up.markable\" content=\"true\" forua=\"true\"/> \n
<meta http-equiv=\"Cache-Control\" content=\"max-age=30\" forua=\"true\" /> \n
</head>\n
<card title=\"Enviroment\">\n";
print "<p align=\"center\">
<img src=\"phone_type.php\" alt=\"\"/>
User Agent:
$HTTP_USER_AGENT
IP-Adress:
$REMOTE_ADDR
Port:
$REMOTE_PORT
Accept Mime Types:
$HTTP_ACCEPT
Language:
$HTTP_ACCEPT_LANGUAGE
Accept Charset:
$HTTP_ACCEPT_CHARSET
--------
\n";
echo "<a href=\"http://landofwap.net/index.php\">LandOfWap.net</a>
</p></card></wml>\n";
?>
some of my posts are from that gumslones deleted posts,i will post others too take look little add on on that, only the host
<?
header("Content-type:text/vnd.wap.wml;charset=UTF-8");
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n
<wml>\n
<head>\n
<meta name=\"vnd.up.markable\" content=\"true\" forua=\"true\"/> \n
<meta name=\"Description\" content=\"wapkralj\" forua=\"true\"/> \n
<meta name=\"Keywords\" content=\"Free, ringtones, polyphones, mmf, midi, mp3, amr, jar, thm, sis, games, logo, wallpapers, 3gp, videos, pictures, erotic, display, themes, java, nokia, samsung, sonyericsson, se, siemens, wap, chat, forum, wap, exchanger, porn, adult,\" forua=\"true\"/> \n
<meta http-equiv=\"Cache-Control\" content=\"max-age=0\" forua=\"true\" /> \n
</head>\n
<card title=\"Information\">\n";
$hostsnames=gethostbyaddr($REMOTE_ADDR);
print "
<do type=\"prev\" label=\"Back\"><prev/></do>
<p align=\"center\">Informations about your phone or browser</p>
Browser:
$HTTP_USER_AGENT
IP address:
$REMOTE_ADDR
Port:
$REMOTE_PORT
Host:
$hostsnames
Mime types:
$HTTP_ACCEPT
Language:
$HTTP_ACCEPT_LANGUAGE
Accept Charset:
$HTTP_ACCEPT_CHARSET
</p>\n";
echo "
<a href=\"index.php/\">Home</a>
(c) wapkralj
</p></card></wml>\n";
?>
SCRIPT TIMER
<?php
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime(1);
for ($i=0; $i < 100000; $i++) {
}
$time_end = microtime(1);
$time = $time_end - $time_start;
echo "Script timer: "; echo "[b]$time [/b]"; echo " seconds\n";
?>
//dayly counter counts hits or hosts
$fpt = "daily.txt"; // path to counter log file - chmod it to 666
$lock_ip =0; // IP locking and logging 1=yes 0=no
$ip_lock_timeout =30; // in minutes
$fpt_ip = "ip.txt"; // IP log file - chmod it to 666
function checkIP($rem_addr) {
global $fpt_ip,$ip_lock_timeout;
$ip_array = @file($fpt_ip);
$reload_dat = fopen($fpt_ip,"w");
$this_time = time();
for ($i=0; $i<sizeof($ip_array); $i++) {
list($time_stamp,$ip_addr,$hostname) = split("\|",$ip_array[$i]);
if ($this_time < ($time_stamp+60*$ip_lock_timeout)) {
if ($ip_addr == $rem_addr) {
$found=1;
}
else {
fwrite($reload_dat,"$time_stamp|$ip_addr|$hostname");
}
}
}
$host = gethostbyaddr($rem_addr);
if (!$host) { $host = $rem_addr; }
fwrite($reload_dat,"$this_time|$rem_addr|$host\n");
fclose($reload_dat);
return ($found==1) ? 1 : 0;
}
$this_day=(date("D, j F Y"));
if (!file_exists($fpt)) {
$count_dat = fopen($fpt,"w+");
$count = 1;
fwrite($count_dat,$count);
fclose($count_dat);
}
else {
$row = file($fpt);
$test = chop($row[0]);
$count = $row[1];
if ($this_day == $test) {
if ($lock_ip==0 || ($lock_ip==1 && checkIP($REMOTE_ADDR)==0)) {
$count++;
}
}
else {
$count = 1;
}
$count_dat = fopen($fpt,"w+");
fwrite($count_dat,"$this_day\n");
fwrite($count_dat,$count);
fclose($count_dat);
}
echo "$count";
Wap ftp checker:
<?php
// 1 of 2 attempts to get the WAP browser to flush the cache
//
header("Content-type: text/vnd.wap.wml");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
echo "\n\n";
?>
<wml>
<head>
// 2 of 2 attempts to get the WAP browser to flush the cache
//
<meta http-equiv="Cache-Control" content="must-revalidate" forua="true"/>
<meta http-equiv="Cache-Control" content="max-age=0" forua="true"/>
</head>
<template>
<do type="prev" label="Previous">
<prev/>
</do>
</template>
<?php
$Uid = 'ftp_user';
$Upw = 'ftp_password';
$ftp_server = 'some_ftp_server';// this should be your ftp server
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $Uid, $Upw);
echo "<card id=\"card2\" title=\"$ftp_server\">"; // .. in case we needed reminding
echo "
";
//
if ((!$conn_id) || (!$login_result)) // need a successful connect and login
{
echo "FTP connection failed!";
echo "
";
echo $login_result;
exit;
}
else
{
$dir=ftp_pwd($conn_id);
$list=Array();// define an array
$list=ftp_rawlist($conn_id, "$dir");// run a raw directory listing and store in array
//
$i= 0;// initialise (element) counter variable
$files= 0;// initialise file counter variable
$dirs** = 0;// initialise directory counter variable
//
while ( $list[$i] )// .. loop round array..
{
if( substr($list[$i], 0, 1 ) == "-" ) { $files++; }// look for real files
elseif( substr($list[$i], 0, 1 ) == "d" ) { $dirs++;} // look for directories
$i++;// incr element counter
}
print htmlspecialchars($Uname);// and display the results !
print "
";
print "User=$Uid
$filesfile(s)
$dirsdir(s)";
ftp_close($conn_id);
}
?>
</p>
</card>
</wml>
LOAD TIME
<?php
// Insert at the very top of your page
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;
?>
<?php
// Place at the very bottom of your page
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
printf ("Page took %f seconds to load.", $totaltime);
// The above line can be changed but remember to keep %f
?>
= = = = = The more you laugh...the longer you live. Read more jokes at http://fun-files.co.cc
======================== Environment Variable Description
========================
Below a small Perl demo, donated to Hicon by Aniceto L?pez and Iv?n Font?n from http://www.latinia.com
#!/usr/bin/perl
##########################################
## WAP Environment
## Developed by Latinia ([url]www.latinia.com[/url])
##########################################
print "Content-type: text/vnd.wap.wml\n\n";
print "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
print "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n";
print "<wml>\n";
print "<card>\n";
print "
\n";
print "USER AGENT : $ENV{'HTTP_USER_AGENT'}\n";
print "REMOTE ADDRESS : $ENV{'REMOTE_ADDR'}\n";
print "USER ID : $ENV{'HTTP_X_UP_SUBNO'}\n";
print "GATEWAY NAME : $ENV{'HTTP_X_UP_UPLINK'}\n";
print "OPERADOR : $ENV{'REMOTE_ADDR'}\n";
print "</p>\n";
print "</card>\n";
print "</wml>\n";
Create count.txt and chmod 777
= = = = = The more you laugh...the longer you live. Read more jokes at http://fun-files.co.cc
allows of exchange the size of an image in php veiled Ca can be very useful for the site wap/i-mode since it changes as the weight of the file doncs Ca allows as the page would not be too heavy size.php : /// < img src="size.php?pic=(url of your image)&w_max=(largor maximum)&h_max=(hautor)">
<?php
$taille = getimagesize("$pic");
$h_i = $taille[1];
$w_i = $taille[0];
if($h_i >$h_max)
{
$convert=$h_max/$h_i;
$h_i=$h_max;
$w_i=ceil($w_i*$convert);
}
if($w_i >$w_max)
{
$convert=$w_max/$w_i;
$w_i=$w_max;
$h_i=ceil($h_i*$convert);
};
$largeur = "$w_i";
$hauteur ="$h_i";
header("Content-Type: image/jpeg");
list($width, $height, $type, $attr) = getimagesize("$pic");
if($type == "1")
{
$img_in = imagecreatefromgif($pic);
}
if($type == "2")
{
$img_in = imagecreatefromjpeg($pic);
}
if($type == "3")
{
$img_in = imagecreatefrompng($pic);
}
$img_out = imagecreatetruecolor($largeur, $hauteur);
imagecopyresampled($img_out, $img_in, 0, 0, 0, 0, imagesx($img_out), imagesy($img_out), imagesx($img_in), imagesy($img_in));
$t = imagejpeg($img_out);
echo $t;
?>