communication
databases
directories
htaccess
htaccess 2
human readable size
read dir and list
recursive directory delete
recursive directory listing
delete file
download counter
file exists
file informations
file upload
include secure
line by line
open file
read and select csv
read file
remote last modified
strip file extension
write to file
html and code
alternate row colors
convert html
extract vars
floating div
force PHP in HTML
get offsite code
html entities
html head
meta tags
prime numbers
simple bar chart
vars with reg.glob. off
view php source
colorizing
crop image
grayscale an image
image rotate
outlining
shadowing
textures
translucent text
information
date and time
date examples
detect user language
domaincheck
google position
loading time
phpinfo
referer info
server variables
visitor IP
visitors online
string handling
44 entries for "file" as partial match | search took 0.074 seconds
file handling | download counter | 18 matches
line 3: call like "thisscript.php?get=thefile_to_download"...
line 9: $download_dir = 'downloads'; // the folder where the files are stored ('.' if this script is in the same folder)...
line 10: $counter_dir = 'counters'; // the folder where your counter files are stored...
line 14: each file to download must have a .txt-file called like "filename.ext.txt" in the 'counters' folder -...
line 15: call the counter e.g. like this: <? include("counters/filename.pdf.txt"); ?>...
line 16: download the file [download.php?get=name_of_file]...
line 21: if(file_exists($path))...
line 23: $file = fopen($counter_dir.'/'.$HTTP_GET_VARS['get'].'.txt','r+');...
line 24: $count = fread($file,100);...
line 25: fclose($file); // closes file...
line 27: $file = fopen($counter_dir.'/'.$HTTP_GET_VARS['get'].'.txt','w'); // opens file again with 'w'-parameter...
line 28: fwrite($file, $count);...
line 29: fclose($file);...
line 31: $size = filesize($path);...
line 34: header('Content-Disposition: attachment; filename='.$HTTP_GET_VARS['get']);...
line 37: readfile($path);...
line 42: echo "<center><br><br>The file [<b>$get$extension</b>] is not available for download.<br>";...
file handling | file upload | 19 matches
line 2: specify the filetypes allowed, the max filesize and the directory to upload the files....
line 8: // specify the directory where the uploaded file should end up...
line 11: // specify the filetypes allowed...
line 14: // specify the max filesize in bytes...
line 17: if(isset($HTTP_POST_FILES['userfile']))...
line 19: if(is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']))...
line 21: if($HTTP_POST_FILES['userfile']['size'] < $max_size)...
line 23: if(in_array($HTTP_POST_FILES['userfile']['type'],$allowed))...
line 25: if(!file_exists($path . $HTTP_POST_FILES['userfile']['name']))...
line 27: if(@rename($HTTP_POST_FILES['userfile']['tmp_name'],$path.$HTTP_POST_FILES['userfile']['name']))...
line 30: $html_output .= 'File Name: '.$HTTP_POST_FILES['userfile']['name'].'<br>';...
line 31: $html_output .= 'File Size: '.$HTTP_POST_FILES['userfile']['size'].' bytes<br>';...
line 32: $html_output .= 'File Type: '.$HTTP_POST_FILES['userfile']['type'].'<br>';...
line 33: $image = $HTTP_POST_FILES['userfile']['name'] ;...
line 44: $html_output = 'The file already exists<br>';...
line 47: $html_output = 'Wrong file type<br>';...
line 50: $html_output = 'The file is too big<br>';...
line 55: $html_output .= '<input type="file" name="userfile">';...
file handling | line by line | 14 matches
line 7: // this is the right way of reading a file line by line into an array...
line 9: $line_array = file('path/to/file.txt');...
line 18: // Obtain the next line in a given file by reading each character until a \r or \n is reached....
line 20: // @param file a handle returned from fopen for our file....
line 21: // @return string the next line in the file....
line 23: function getLine($file)...
line 27: while (!feof($file))...
line 31: $character = fgetc($file);...
line 39: // the case of windows '\r\n' files, or not as in the case of...
line 40: // mac classic '\r', and unix/os x '\n' files....
line 41: $character = fgetc($file);...
line 50: // not part of line ending, roll back file pointer....
line 51: fseek($file, -1, SEEK_CUR);...
databases | mySQL to excel | 13 matches
line 23: //Optional: print out title to top of Excel or Word file with Timestamp...
line 24: //for when file was generated:...
line 29: //define title for .doc or .xls file: EDIT this if you want...
line 48: //if this parameter is included ($w=1), file returned will be in word format ('.doc')...
line 49: //if parameter is not included, file returned will be in excel format ('.xls')...
line 52: $file_type = "msword";...
line 53: $file_ending = "doc";...
line 55: $file_type = "vnd.ms-excel";...
line 56: $file_ending = "xls";...
line 58: //header info for browser: determines file type ('.doc' or '.xls')...
line 59: header("Content-Type: application/$file_type");...
line 60: header("Content-Disposition: attachment; filename=database_dump.$file_ending");...
html and code | view php source | 13 matches
line 8: // echo '<input type="text" name="selected_file">'; // disabled for demo...
line 10: echo '<input type="hidden" name="selected_file" value="index.php">'; // just for demo...
line 21: if(!$_POST['selected_file'] == '' && $real_adress == 1)...
line 23: $userfile = $_POST['selected_file'];...
line 24: echo '<b>full path:</b> ' . $userfile;...
line 26: $myArray = split('/', $userfile);...
line 27: $selected_file_name = end($myArray);...
line 28: echo '<br /><b>filename:</b> ' . $selected_file_name . '<hr>';...
line 29: $strFile = file($selected_file_name);...
line 30: $newStr = join(" ",$strFile);...
line 48: echo '<p><hr><i>End Of File</i></p>';...
line 50: echo 'Please select a file.';...
file handling | read and select csv | 10 matches
line 2: the first one returns the whole file, the second acts like a select statement...
line 4: perfect for file-based databases...
line 10: // reads a csv file and returns a two-dimensional array of lines/fields...
line 11: function read_csv($file,$delimiter)...
line 13: $data_array = file($file);...
line 21: // reads a csv file and returns an two-dimensional array of lines/fields...
line 22: function select_csv($file,$delimiter,$field,$query)...
line 24: $data_array = file($file);...
line 40: // this willl display all records in the csv file...
file handling | write to first line of file | 8 matches
line 2: it reads the contents and adds new data to the first line of the file....
line 3: after this it joins the lines and writes them back to the file again....
line 12: // the filepath...
line 13: $file = 'temp/file.txt';...
line 16: $old_lines = file($file);...
line 23: $fp = fopen($file,'w');...
line 25: // write string to file...
information | google position | 8 matches
line 29: "&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype="....
line 33: $file = fopen($filename, "r");...
line 34: if (!$file)...
line 36: echo '<p>Unable to open remote file '.$filename;...
line 38: while(!feof($file))...
line 40: $var = fgets($file, 1024);...
line 64: fclose($file);...
directories | recursive directory listing | 8 matches
line 12: while ($file = readdir ($dirlist))...
line 14: if ($file != '.' && $file != '..')...
line 16: $newpath = $dir.'/'.$file;...
line 25: 'mod_time'=>filemtime($newpath),...
line 33: 'kind'=>'file',...
line 34: 'mod_time'=>filemtime($newpath),...
line 35: 'size'=>filesize($newpath));...
image handling | image upload and resize | 11 matches
line 18: $maxfile = '2000000';...
line 21: $userfile_name = $_FILES['image']['name'];...
line 22: $userfile_tmp = $_FILES['image']['tmp_name'];...
line 23: $userfile_size = $_FILES['image']['size'];...
line 24: $userfile_type = $_FILES['image']['type'];...
line 26: if (isset($_FILES['image']['name']))...
line 28: $prod_img = $filedir.$userfile_name;...
line 30: $prod_img_thumb = $thumbdir.$prefix.$userfile_name;...
line 31: move_uploaded_file($userfile_tmp, $prod_img);...
line 73: <input type="file" name="image"><p>...
directories | directory list with exec | 8 matches
line 13: - = regular file...
line 15: b = special block file...
line 16: c = special character file...
line 18: p = named pipe special file...
line 25: using the above example of lrwxr-xr-x, you would have symbolic link file, where the user can read, write and execute (rwx), and the group and others can read and execute (r-x)...
line 30: foreach ( $output as $file )...
line 32: echo $file.'<br>';...
file handling | open file | 6 matches
line 6: function file_open($filename)...
line 8: if($fp = @fopen($filename, "r"))...
line 10: $fp = @fopen($filename, "r");...
line 11: $contents = fread($fp, filesize($filename));...
line 20: $text = file_open('data/file.txt');...
file handling | strip file extension | 6 matches
line 2: to remove the extension just call the function with the name of the file...
line 19: $filename = 'file_name.txt';...
line 21: echo strip_ext($filename)."\n";...
line 23: // to get the file extension, do...
line 24: echo end(explode('.',$filename))."\n";...
directories | read dir and list | 5 matches
line 13: if ( is_dir ($file_file ) && $file_file != '.' && $file_file != '..' && substr ($file_file ,0,strlen ($filter )) == $filter )...
line 15: $mtime = filemtime($file_file);...
line 17: $thefile =strtr ($file_file ,$array );...
line 19: <a href="'.$file_file .'" title="last modified on '.date("D d M Y g:i A", $mtime).'">'.$thefile .'</a>...
information | visitors online | 7 matches
line 10: function counter_write($filename, $filecontent, $mode='w')...
line 12: if($fp = @fopen($filename,$mode))...
line 14: fwrite($fp, stripslashes($filecontent));...
line 22: function counter_count($filename, $ip, $timeframe=1800)...
line 27: $counterdata = file($filename);...
line 39: counter_write($filename, $counterstr);...
string handling | insert at specific location | 5 matches
line 3: put a key into the file, where you want the new text appear...
line 18: $old_data = file('path/to/file');...
line 19: $new_data = 'text to write in to the file';...
line 31: // write $string to file...
file handling | remote last modified | 5 matches
line 2: very practical to check if a new version of a file is ready to download on another server....
line 50: $remote_file = 'http://fundisom.com/MakeNewFolderNamed.dmg'; // should be a static file like a .zip archive for example...
line 51: $array = get_header_array($remote_file);...
line 52: echo $remote_file.' was last modified on '.date('j F Y',strtotime($array['Last-Modified']));...
file handling | delete file | 4 matches
line 7: function file_delete($file)...
line 9: chmod($file, 0777);...
line 10: if(unlink($file))...
file handling | write to file | 4 matches
line 6: function file_write($filename, $filecontent)...
line 8: if($fp = @fopen($filename,"w "))...
line 10: $contents = fwrite($fp, $filecontent, 80000);...
file handling | include secure | 4 matches
line 3: because you didn't intend for anyone to execute this file on its own....
line 4: If it is included in some other PHP file,...
line 15: if (eregi("include_secure", $PHP_SELF)) echo "this file shouldn't be called like this";...
directories | human readable size | 6 matches
line 17: if (is_link($directory . '/' . $dirfile) || $dirfile == '.' || $dirfile == '..')...
line 19: if (is_file($directory . '/' . $dirfile))...
line 20: $size += filesize($directory . '/' . $dirfile);...
line 21: else if (is_dir($directory . '/' . $dirfile))...
line 23: $dirSize = dirsize($directory . '/' . $dirfile);...
image handling | list image folder | 6 matches
line 4: you get a list of all files which mach the criteria....
line 11: $allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show...
line 14: while($imgfile = readdir($dimg))...
line 16: if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))...
line 18: $a_img[] = $imgfile;...
file handling | file informations | 4 matches
line 20: // $fil_array = stat('path/to/file/');...
line 21: $fil_array = stat(__file__); // demo...
line 23: echo 'filesize: '.ConvertSize($fil_array[7]).'<br>';...
file handling | file exists | 3 matches
line 6: function file_exist($filename)...
line 8: if(file_exists($filename))...
html and code | simple php code highlight | 3 matches
line 14: $temp = file('index.php');...
line 26: highlight_file('index.php');...
string handling | string compare | 3 matches
line 8: // lets say you have a file where there's on each line something like...
line 11: $data = file('path/to/file.txt'); // read the file...
image editing | image rotate | 4 matches
line 9: $img_size = getImageSize($sourcefile);...
line 24: $src_img = ImageCreateFromJPEG($sourcefile);...
line 46: ImageJPEG($final_img, $targetfile);...
directories | htaccess | 4 matches
line 2: with this you can force any filename to be recognized as PHP...
line 6: <FilesMatch "^yourfilename$">...
file handling | read file | 2 matches
line 8: $lines = file('data/file.txt');...
information | timestamp to time passed | 2 matches
line 26: echo 'this file last updated '.time_passed(filectime(__file__)).' ago'; // this file - last update...
string handling | extract string from offsite | 2 matches
line 15: $fp = fopen ($off_site, 'r') or die('Unable to open file '.$off_site.' for reading');...
image editing | shadowing | 3 matches
line 11: $text1 = imagettftext ($im ,$size ,$angle ,$x +$offsetx ,$y +$offsety ,$shadowcolor ,$fontfile ,$text );...
line 13: $text2 = imagettftext ($im ,$size ,$angle ,$x ,$y ,$col ,$fontfile ,$text );...
image editing | outlining | 3 matches
line 17: $text1 = imagettftext ($im ,$size ,$angle ,$xc ,$yc ,$outlinecol ,$fontfile ,$text );...
line 21: $text2 = imagettftext ($im ,$size ,$angle ,$x ,$y ,$col ,$fontfile ,$text );...
directories | htaccess 2 | 2 matches
line 9: // http://yourserver.com/thephpfile/edit/12376...
html and code | force PHP in HTML | 2 matches
line 2: after doing this you don't need to rename your files to .php anymore...
image editing | translucent text | 2 matches
line 21: $text = imagettftext ($new ,$size ,$angle ,$x ,$y ,$color ,$fontfile ,$text ); // Draw the text...
image handling | base64 image encode | 2 matches
line 19: // if you want to save the string to a file...
image editing | textures | 2 matches
line 26: imagettftext ($im ,$size ,$angle ,$x ,$y ,- $pink ,$fontfile ,$text ); // Draw text over magic pink without aliasing...
string handling | string replace | 1 match
forms | google results | 1 match
html and code | get offsite code | 1 match
image editing | analog GD clock | 1 match
image handling | resize offsite image | 1 match
html and code | extract vars | 1 match
© 2008 phparadise | go to the top
57 hits by 13 users in the last 30 minutes.