PHP
-
Variables
-
Indexed Array
$php_variable = array("value1", "value2", "value3");
Associated Array
$php_variable = array("key1"=>"value1", "key2"=>"value2", "key3"=>"value1");
-
You have a multidimensional array and you need to see it to understand the data structure and what information you have. Here is a helpful function.
function display_array ($i) { global $display_array_tab; if (!isset($display_array_tab)) { $display_array_tab = 0; } else { $display_array_tab++; } foreach ($i as $key => $value) { for ($n = 0; $n < $display_array_tab; $n++) { echo " "; } if (is_array($value)) { echo "[" . $key . "]<br>"; display_array($value); } else { echo "[" . $key . "] => " . $value . "<br>"; } } $display_array_tab--; }
How to call:
display_array(array variable);
Output will look like this
[key] [key] => value
-
Want to update, add, or remove one variable in a URL, this function can help. If new value is empty, var is removed from the url. If new value is included, var and new value are added to the end of the URL.
function update_url_var ($var, $new_value = "") { $url = $_SERVER['REQUEST_URI']; if (stripos($url, "#")) { $url = substr($url, 0, stripos($url, "#")); } // removing anchor info if (stripos($url, "?" . $var . "=")) { $s = stripos($url, "?" . $var . "="); $new_url = substr($url, 0, $s); if (stripos($url, "&", $s)) { $new_url .= "?" . substr($url, stripos($url, "&", $s) + 1); } $url = $new_url; } else if (stripos($url, "&" . $var . "=")) { $s = stripos($url, "&" . $var . "="); $new_url = substr($url, 0, $s); if (stripos($url, "&", $s + 1)) { $new_url .= substr($url, stripos($url, "&", $s + 1)); } $url = $new_url; } if ($new_value !== "") { if (stripos($url, "?")) { $url .= "&" . $var . "=" . $new_value; } else { $url .= "?" . $var . "=" . $new_value; } } return $url; }
How to call (add / update var):
update_url_var(var, new value);
How to call (remove var):
update_url_var(var);
Examples:
update_url_var("page", 2); update_url_var("page");
-
-
Useful Stuff
-
Set cookie info
function set_cookie ($cookie_name, $cookie_value, $duration_in_days) { setcookie($cookie_name, $cookie_value, time()+(60*60*24*$duration_in_days), '/'); }
The final '/', sets the cookie at the root of the website. This makes it easier to find the cookie information later on.
Found an issue when cookie_value had a . (period) or (space). Suggest to remove or replace them.
Get cookie info
if (isset($_COOKIE["cookie_identifier"])) { $php_variable = $_COOKIE["cookie_identifier"]; } else { $php_variable = ""; }
-
//Set these variables// $db_server = ""; $db_user = ""; $db_pword = ""; $db = "";
//General use DB function for query, insert, update, create, delete, etc.
function talk_to_db ($i) { global $db_server, $db_user, $db_pword, $db; $o = array(); $con = mysqli_connect($db_server,$db_user,$db_pword,$db); if (!$con) { die("Could not connect: " . mysqli_error()); } $result = mysqli_query($con, $i); while ($row = mysqli_fetch_array($result)) { array_push($o, $row); } mysqli_close($con); return $o; }
Example on how to use:
$o = talk_to_db("SELECT * FROM [table]"); foreach ($o as $key => $value) { echo "field " . $key . " = " . $value; }
or you could
foreach ($o as $i) { echo "field title = " . $i[`title`]; }
or if you are only updating, inserting, etc. where you don't need a db response, you can just
talk_to_db("INSERT INTO $db.[table] VALUES (NULL, `$title`, `$description`)");
If you need an auto_increment id from an insert, you can use this function
function db_insert_return_id ($i) { global $db_server, $db_user, $db_pword, $db; $con = mysqli_connect($db_server,$db_user,$db_pword,$db); if (!$con) { die('Could not connect: ' . mysqli_error()); } mysqli_query($con, $i); $o = mysqli_insert_id($con); mysqli_close($con); return $o; }
The response is the new id. Example on how to use:
$session_id = db_insert_return_id("INSERT INTO $db.[table] VALUES (NULL, '$username', '$password'");
-
function send_email( $from_name, $from_email, $from_org, $to_email, $subject, $message ) { $headers = "Reply-To: " . $from_name . " <" . $from_email . ">\r\n"; $headers .= "Return-Path: " . $from_name . " <" . $from_email . ">\r\n"; $headers .= "From: " . $from_name . " <" . $from_email . ">\r\n"; $headers .= "Organization: " . $from_org . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "X-Priority: 3\r\n"; $headers .= "X-Mailer: PHP" . phpversion() . "\r\n"; mail( $to_email, $subject, $message, $headers ); }
Example
$from_name = "Jane Doe"; $from_email = "jane@example.com"; $from_org = "Example.com"; $to_email = "youremail@yahoo.com"; $email_subject = "Testing the PHP HTML Email Example"; $email_message = '<!DOCTYPE html> <html lang="en-US"> <head> <title>Testing the PHP HTML Email Example</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body style="margin:0; padding:0;"> <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin:0 auto; max-width:600px; padding: 0"> <thead> <tr> <th style="background-color:#eee; color:#000; font-size:20px; font-weight:bold; padding:20px; text-align:center"> Testing the PHP HTML Email Example (header) </th> </tr> </thead> <tbody> <tr> <td colspan="2" style="font-size:16px; padding:20px"> <p style="margin:0; padding:0 0 15px 0">This is where the main email message would go.</p> <p style="margin:0; padding:0 0 15px 0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar nulla accumsan nulla vulputate, ut interdum augue sagittis. Nam interdum vitae ex vulputate venenatis. Integer sed porta diam. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec egestas at turpis sed consequat. Maecenas ac nisi mauris. Sed purus mauris, tincidunt quis feugiat id, porttitor eu mi. Fusce eros eros, hendrerit in magna nec, tempor commodo libero.</p> <p style="margin:0; padding:0 0 15px 0">Integer scelerisque, felis at finibus venenatis, tortor nisl fringilla tortor, ac aliquam neque nulla sit amet ante. Suspendisse aliquam nisl ut tincidunt pretium. Vivamus iaculis et mauris at maximus. Proin condimentum neque ut ante egestas ornare. Duis sed blandit leo, in fringilla eros. In hac habitasse platea dictumst. Suspendisse cursus, mauris non vestibulum aliquet, tellus dui interdum diam, in molestie ipsum felis ac libero. Nam dignissim lobortis nulla, sed luctus enim euismod ut. Nunc turpis magna, maximus sed venenatis sit amet, consectetur non quam. Cras a venenatis sapien. Mauris pulvinar erat quis justo fermentum sollicitudin. Praesent ac congue massa. Duis malesuada massa at condimentum egestas.</p> </td> </tr> </tbody> <tfoot> <tr> <td colspan="2" style="border-top:2px solid #999; font-size:12px; padding:20px; text-align:center"> This is the footer of the email. There should be text about where the email came from and possibly a way to unsubscribe from future emails. </td> </tr> </tfoot> </table> </body> </html>'; send_email( $from_name, $from_email, $from_org, $to_email, $email_subject, $email_message );
-
function get_xml_tag_value ($i, $tag, $s = 0) { $match = "false"; while ($match == "false" && stripos($i, "<" . $tag, $s)) { $s = stripos($i, "<" . $tag, $s) + 1 + strlen($tag); if (substr($i, $s, 1) == " " || substr($i, $s, 1) == ">") { $match = "true"; $s = stripos($i, ">", $s) + 1; $e = stripos($i, "</" . $tag, $s); $l = $e - $s; return substr($i, $s, $l); } $s += strlen($tag) + 1; } }
How to call:
get_xml_tag_value(xml, tag, optional start_location);
Example (to get information between <start></start>):
get_xml_tag_value($xml, "start");
-
class parse_xml_into_variable_array { private function tag ($i) { if ( ( stripos( $i, "<" ) > -1 ) && ( stripos( $i, ">" ) > -1 ) ) { $s = stripos( $i, "<" ) + 1; $e = stripos( $i, ">" ); $l = $e - $s; return substr( $i, $s, $l ); } else { return ""; } } private function tag_name ($i) { if ( stripos( $i, " " ) > -1 ) { $e = stripos( $i, " " ); return substr( $i, 0, $e ); } else { return $i; } } private function tag_type ( $i, $tag_name ) { if ( substr( $i, 0, 3 ) == "!--" ) { return "comment"; } else if ( $tag_name == "?xml" ) { return "xml tag"; } else if ( substr( $i, 0, 1 ) == "/" ) { die( "Malformed XML data. When looking for new tag, found closing tag '" . $tag_name . "'." ); } else if ( substr( $i, strlen( $i ) - 1 ) == "/" ) { return "self closing tag"; } else { return "opening tag"; } } private function remove_tag ( $i, $tag_name ) { if ( stripos( $i, "</" . $tag_name . ">" ) > -1 ) { $e = stripos( $i, "</" . $tag_name . ">" ) + strlen( $tag_name ) + 3; return substr( $i, $e ); } else { die( "Malformed XML data. No closing tag for '" . $tag_name . "'." ); } } private function tag_value ( $i, $tag_name ) { $s = stripos( $i, ">" ) + 1; if ( stripos( $i, "</" . $tag_name . ">", $s ) > -1 ) { $e = stripos( $i, "</" . $tag_name . ">", $s ); $l = $e - $s; return substr( $i, $s, $l ); } else { die( "Malformed XML data. No closing tag for '" . $tag_name . "'." ); } } private function subtag_name ( $i ) { if ( stripos( $i, "=" ) > -1 ) { $e = stripos( $i, "=" ); $s = 0; while ( substr( $i, $s, 1 ) == " " ) { $s++; } $l = $e - $s; return substr( $i, $s, $l ); } else { return ""; } } private function subtag_value ( $i, $subtag_name ) { $s = stripos( $i, $subtag_name . "=" ) + 2 + strlen( $subtag_name ); $c = substr( $i, $s - 1, 1 ); if ( $c !== "'" && $c !== '"' && $c !== "\\" ) { die( "Malformed XML data. Missing ' or \" after = for subtag '" . $subtag_name . "'." ); } if ( $c == "\\" ) { $c = substr( $i, $s - 1, 2 ); $s++; } if ( stripos( $i, $c, $s ) > -1 ) { $e = stripos( $i, $c, $s ); $l = $e - $s; return substr( $i, $s, $l ); } else { die( "Malformed XML data. No closing ' or \" to subtag '" . $subtag_name . "'." ); } } private function get_subtags ( $i ) { $o = ''; while ( $this -> subtag_name( $i ) !== "" ) { $subtag_name = $this->subtag_name( $i ); $subtag_value = $this->subtag_value( $i, $subtag_name ); $e = stripos( $i, $subtag_value ) + strlen( $subtag_value ) + 1; $i = substr( $i, $e ); $o[ $subtag_name ] = $subtag_value; } return $o; } private function get_tags ( $i ) { $o = array(); while ( $this-> tag( $i ) !== "" ) { $tag = $this->tag( $i ); $tag_name = $this->tag_name( $tag ); $tag_type = $this->tag_type( $tag, $tag_name ); if ( $tag_type == "comment" ) { $e = stripos( $i, "-->" ) + 3; $i = substr( $i, $e ); } else if ( $tag_type == "xml tag" || $tag_type == "self closing tag" ) { if ( $tag_type == "self closing tag" ) { $o[ $tag_name ][] = $this->get_subtags( $tag ); } else { $o[ $tag_name ] = $this->get_subtags( $tag ); } $e = stripos( $i, $tag ) + strlen( $tag ) + 1; $i = substr( $i, $e ); } else if ( $tag_type == "opening tag" ) { $tag_value = $this->tag_value( $i, $tag_name ); if ( stripos( $tag, "=" ) > -1 ) { $subtags = $this->get_subtags( substr( $tag, strlen( $tag_name ) ) ); } else { $subtags = ""; } $i = $this->remove_tag( $i, $tag_name ); if ( isset( $o[ $tag_name ] ) ) { $count = count( $o[ $tag_name ] ); } else { $count = 0; } if ( $this->tag( $tag_value ) == "" ) { if ( $subtags !== "" ) { $o[ $tag_name ][ $count ] = $subtags; $o[ $tag_name ][ $count ] += array( $tag_value ); } else { $o[ $tag_name ][ $count ] = $tag_value; } } else { if ( $subtags !== "" ) { $o[ $tag_name ][ $count ] = $subtags; $o[ $tag_name ][ $count ] += $this->get_tags( $tag_value ); } else { $o[ $tag_name ][ $count ] = $this->get_tags( $tag_value ); } } } } return $o; } public function init( $xml ) { $o = $this->get_tags( $xml ); return $o; } }
How to call:
$obj = new parse_xml_into_variable_array(); output = $obj->init(variable of xml);
Example:
$obj = new parse_xml_into_variable_array(); $o = $obj->init($xml);
If you need to put HTML code in your XML file, don't forget to protect the html data in <![CDATA[ html code ]]>
XML example
<?xml version='1.0' encoding='ISO-8859-1' ?> <guestbook type=\'friend's\'> <guest type='blank' /> <guest type='friend'> <fname type='strange'>Terje</fname> <lname>Beck</lname> </guest> <!-- <guest> <fname>Frank</fname> <lname>Babbis</lname> </guest> --> <guest> <fname>Jan</fname> <lname>Refsnes</lname> </guest> </guestbook>
Multidimensional array output
[?xml] [version] => 1.0 [encoding] => ISO-8859-1 [guestbook] [0] [guest] [0] [type] => blank [1] [fname] [0] => Terje [type] => strange [lname] [0] => Beck [type] => friend [2] [fname] [0] => Jan [lname] [0] => Refsnes [type] => friend's
-
function random_color () { return "#" . dechex(mt_rand(0,15)) . dechex(mt_rand(0,15)) . dechex(mt_rand(0,15)); }
-
function pick_random_image ($directory) { $img_file_extensions = array('.jpg','.jpeg','.gif'); $dir_images = array(); //Open the directory so we can read it $dir_reference = opendir($directory); //Go through the items (directories and files) in the directory while ($dir_item = readdir($dir_reference)) { $dir_item_extension = strtolower(strrchr($dir_item,'.')); if (in_array($dir_item_extension,$img_file_extensions)) { $dir_images[] = $dir_item; } } closedir($dir_reference); //close the directory connection if (count($dir_images) > 0) { return $dir_images[rand(0,count($dir_images)-1)]; } else { return ""; } }
-
function get_all_files ($directory) { $subdirs[] = ""; for ($i = 0; $i < count($subdirs); $i++) { $dir_location = $directory . $subdirs[$i]; $dir_reference = opendir($dir_location); while ($dir_item = readdir($dir_reference)) { $dir_items[] = $dir_item; if ((is_dir($dir_location.$dir_item)) && ($dir_item !== ".") && ($dir_item !== "..")) { $subdirs[] = $subdirs[$i] . $dir_item . "/"; } else if (($dir_item !== ".") && ($dir_item !== "..")) { $files[] = $subdirs[$i] . $dir_item; } } closedir($dir_reference); } return $files; }
-
function get_file_data ($filename) { if (file_exists($filename)) { $file_reference = fopen($filename, "r"); $file_data = fread($file_reference, filesize($filename)); fclose($file_reference); } else { $file_data = ""; } return $file_data; }
-
function write_file ($filename, $file_information) { $file_reference = fopen($filename, 'w+'); fwrite($file_reference, $file_information); fclose($file_reference); }
-
function check_and_create_directory ($directory) { if (!file_exists($directory)) { //if directory doesn't exist, we need to make it //next line is to clear default file permissions, //that way we make a directory with the permissions we want $old_umask = umask(0); mkdir($directory, 0777, TRUE); } }
-
Call the php file via <img src="">, it will respond with a resized image. Image filename must use a relative path based on where this php file is located.
Example img url: http://www.webserver.com/php/sized_image.php?image=filename&width=max_width&height=max_height
Example img url with example variables: http://www.webserver.com/php/sized_image.php?image=../images/test.jpg&width=150&height=150
Example use:
<img src='http://www.webserver.com/php/sized_image.php?image=../images/test.jpg&width=150&height=150' />
Save the following to a php file (named sized_image.php for example) to your web server.
<?php //PHP SCRIPT to create a resized image and send it back ready for display //HOW TO USE: call it like this <img src='resized_image.php?image=picture.jpg' /> //This script is set up to expect the image to be a jpg file. //Changes will need to be made if you are going to call a different kind of graphic file. if (isset($_GET['image']) && isset($_GET['width']) && isset($_GET['height']) && file_exists($_GET['image'])) { $image = $_GET["image"]; $max_width = $_GET["width"]; $max_height = $_GET["height"]; //Remove time limit, incase it takes a while to make the resized image set_time_limit(0); //Increase memory limit setting, incase the image file size is big ini_set("memory_limit", "50M"); //Set the file header header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); //Get size of image list ($img_width, $img_height) = getimagesize($directory . $image); //determine percent of difference between img and maximum on each axis $img_width_diff_percent = ($max_width/$img_width); $img_height_diff_percent = ($max_height/$img_height); //determine target size based on opposite axis percent of difference $img_resize_target_width = floor($img_width * $img_height_diff_percent); $img_resize_target_height = floor($img_height * $img_width_diff_percent); if ( ($img_width_diff_percent <= $img_height_diff_percent) && ($img_resize_target_height <= $max_height) ) { //If width diff percent is greater than height diff percent //and target height is not going to be bigger than max height $new_width = $max_width; $new_height = $img_resize_target_height; } else { $new_height = $max_height; $new_width = $img_resize_target_width; } header("Content-type: image/jpg"); $src_img = imagecreatefromjpeg($directory . $image); $dst_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height); imagejpeg($dst_img,"",100); imagedestroy($src_img); imagedestroy($dst_img); } ?>
-
function create_resized_image ($src_dir, $dst_dir, $img_file, $max_width, $max_height, $quality) { //increase memory limit to handle images with a large file size ini_set("memory_limit", "50M"); list($img_width, $img_height) = getimagesize($src_dir . $img_file); //Is image wider or taller than maximums if ( ($img_width > $max_width) || ($img_height > $max_height) ) { //determine difference between image and maxium on each axis $img_width_diff = ($max_width/$img_width); $img_height_diff = ($max_height/$img_height); //determine target size based on opposite axis difference $img_resize_target_width = $img_width * $img_height_diff; $img_resize_target_height = $img_height * $img_width_diff; if ( ($img_width_diff <= $img_height_diff) && ($img_resize_target_height <= $max_height) ) { //If width diff is greater than height diff //and target height is not going to be bigger than max height $new_width = $max_width; $new_height = $img_resize_target_height; } else { $new_height = $max_height; $new_width = $img_resize_target_width; } //if the image is a gif we have to run different php commands, checking extension $file_extension = strtolower(strrchr($img_file, ".")); if ($file_extension == ".gif") { $src_img = imagecreatefromgif($src_dir . $img_file); $dst_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height); imagegif($dst_img, $dst_dir . $img_file); } else if ( ($file_extension == ".jpg") || ($file_extension == ".jpeg") ) { $src_img = imagecreatefromjpeg($org_dir . $i); $dst_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height); imagejpeg($dst_img, $dst_dir . $img_file, $quality); } imagedestroy($src_img); imagedestroy($dst_img); } else { //image is smaller than maximum -- just copy it copy ($src_dir . $img_file, $dst_dir . $img_file); } }
-
-
Helpers
-
Variables in the url
if (isset($_GET['url_variable'])) { $php_variable = $_GET['url_variable']; } else { $php_variable = ''; }
Variables sent by the HTTP POST method
if (isset($_POST['post_variable'])) { $php_variable = $_POST['post_variable']; } else { $php_variable = ''; }
Cookie values
if (isset($_COOKIE['cookie_identifier'])) { $php_variable = $_COOKIE['cookie_identifier']; } else { $php_variable = ''; }
-
//START ERROR HANDLING function customError($error_level, $error_message, $error_file, $error_line, $error_context) { echo "<strong>!!ERROR!!</strong><br>"; echo "Level: " . $error_level . "<br>"; echo "Message: " . $error_message . "<br>"; echo "File: " . $error_file . "<br>"; echo "Line: " . $error_line . "<br>"; echo "Context: " . $error_context; die(); } set_error_handler("customError"); //END ERROR HANDLING
-
Call the php file via <a href="">. When the user clicks on that link, they will be asked if they want to open or save the file. File must use a relative path based on where this php file is located.
Example url: http://www.webserver.com/php/download_file.php?file=file
Example url with example variables: http://www.webserver.com/php/download_file.php?file=../images/test.jpg
Example use:
<a href='http://www.webserver.com/php/download_file.php?file=../images/test.jpg' >download file</a>
Save the following to a php file (named download_file.php for example) to your web server.
<?php if (isset($_GET['file'])) { $file = $_GET['file']; } else { $file = ''; } if (file_exists($file)) { $file_nospaces = str_replace(' ','_',$file); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file_nospaces)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); flush(); readfile($file); exit; } ?>
-
Want to make sure users go to www.yourwebsite.com not yourwebsite.com (no www)? Put this at the start of your webpages, either in the webpage php file or an included php file.
if (substr($_SERVER['HTTP_HOST'], 0, 4) !== "www.") { header("Location: http://www." . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); }
-
This works in conjunction with the 'Update URL Variable' function. This will not limit your output to the page, but it will easily give you a multipage navigation. I have found this very useful.
function display_multipage_nav ($page, $total) { if ($total > 1) { $start = $page - 2; if ($start < 1) { $start = 1; } $end = $start + 4; if ($end > $total) { $end = $total; } if ($end - $start < 4) { if ($end - 4 > 1) { $start = $end - 4; } } echo "<ul class='multipagenav'>"; if ($page < 2) { echo "<li class='off'>previous</li>"; } else { echo "<li><a href='" . update_url_var("page", ($page - 1)) . "'>previous</a></li>"; } for ($i=$start;$i<=$end;$i++) { if ($start > 1 && $i == $start) { echo "<li><a href='" . update_url_var("page", 1) . "'>1</a></li>"; echo "<li>...</li>"; } echo "<li"; if ($i == $page) { echo " class='curr'>" . $i; } else { echo "><a href='" . update_url_var("page", $i) . "'>" . $i . "</a>"; } echo "</li>"; if ($end < $total && $i == $end) { echo "<li>...</li>"; echo "<li><a href='" . update_url_var("page", $total) . "'>" . $total . "</a></li>"; } } if ($page == $total) { echo "<li class='off'>next</li>"; } else { echo "<li><a href='" . update_url_var("page", ($page + 1)) . "'>next</a></li>"; } echo "</ul>"; } }
CSS I use for this
ul.multipagenav { background-color:#eee;margin:10px 0px;list-style-type:none;text-align:center; } ul.multipagenav li { display:inline;color:#000;padding:1%; } ul.multipagenav li.off { color:#999;padding:2%; } ul.multipagenav li.curr { font-weight:bold;padding:2%; } ul.multipagenav li a { color:#000;padding:1%; }
-
Have some php code in a variable and you need to run it through the php engine...
if the php code is marked by <?php and ends with ?>
$i = 'string with php code in it'; ob_start(); ('?>' . $i); $i = ob_get_clean();
if php code is just mixed in without <?php
$i = 'string with php code in it'; eval("$i = '$i'");
-
Put this on a test webpage and see what $_SERVER can give you. Useful if you need URL, Server, Client, URL vars, etc.
<?php $info = $_SERVER; foreach ($info as $key => $value) { echo "key='" . $key . "', value='" . $value . "'<br>"; } ?>
-
set_time_limit(0);
-