eg0040.php Predefined Variables, $GLOBALS Array eg0040.txt ( 2nd edition book, P150)
eg0041.htm
=> eg0041action.php; A script to acquire user Input, eg0041.txt
handled by eg0041action.txt
(P184)
Default form submission method is Get
$_GET['user']
$_GET['address']
eg0042.htm
=> eg0042action.php; Form Input with User Defined Arrays (Select Element),
eg0042.txt handled by eg0042action.txt
(P187)
Form submission method is Post
$_POST['user']
$_POST['address']
$_POST['products'] => Select Element, Foreach
On some php enabled servers, we can
use global variables to access form fields. This is because...
In php.ini file (apache directory), register_globals directive is set to on.
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off
; this is the default for most newly installed servers
eg0043.php
(P188 to P192) eg0043.txt
HTML and PHP code on a single page
A PHP guessing script
Using Hidden Fields to Save Stage (also useful for passing value between pages)
eg0044.htm => eg0044action.php; redirecting user, extraction from P193, eg0044.txt handled by eg0044action.txt
Netscape 2 or better and IE 4 or
better support file uploads
HTML form to include ENCTYPE="multipart/form-data"
php.ini file, to set MAX_FILE_SIZE field, defaults to 2 MB
eg0045.htm => eg0045action.php;
file upload (P196 updated), eg0045.txt
handled by eg0045action.txt
eg0046.php
Starting or Resuming a Session (P406 minor changes), eg0046.txt
PHP 4 writes to a temporary file in /tmp (e.g. c:\tmp), unless we set in session_save_path()
eg0047.php
Registering Variables with a Session (P408 changes), eg0047.txt
eg0047retrieve.php
retrives the registered variables, eg0047retrieve.txt
p389: In php.ini, default register_globals = Off; we need to use $HTTP_SESSION_VARS
array or $_SESSION array
eg0048.php
Registering a Array Variable with a Session (P410 changes), eg0048.txt
it links to eg0048retrieve.php file which retrieve the registered array variable,
eg0048retrieve.txt
eg0049.php Destroying Sessions and Unsetting Variables (P412 changes), eg0049.txt
eg0050.php Passing Session IDs in
the Query String (P413 changes), eg0050.txt
eg0050retrieve.php retrieve the Session ID, eg0050retrieve.txt
To be explored
eg0051.php
Including files with include(P204) eg0051.txt
eg0051include.php was included. eg0051include.txt
eg0052.php
(P209 changes) eg0052.txt
Checking for Existence with file_exists()
A File or a Directory?
eg0053.php
(p210 changes) eg0053.txt
Checking the status of a file
Determining File Size with filesize
Getting Date Information About a file
p211 covers function that performs multiple file tests, for those who are interested.
eg0054.php
(P213 changes) Creating and Deleting files eg0054.txt
touch() => create file
unlink() => delete file
eg0055.php Opening and Reading a File (P213 changes) eg0055.txt
eg0056.php Writing or Appending to a File (P218 changes) eg0056.txt
There are useful functions... mkdir();
rmdir(); opendir(); readdir(); directory management (P221 to P223)