Session Handling

Its a simple session handling tutorial, bottom of this tutorial has a link to download the zip file.
Its a continuation of user registration process. 

Zip File includes.

  1. user_validation.php 
  2. failure.php
  3. success.php
  4. login.html

Download

File Handling

Its a simple file uploading tutorial, bottom of this tutorial has a link to download the zip file.

Zip File includes.

  1. file_upload.php – file has internal comments in it for better understanding
  2. file_upload.html
  3. uploaded – its a directory for holding uploaded files

//Like $_REQUEST, $_GET, $_POST array there is a $_FILES array to hold file information submitted in previuos form
//these are all server generated super global variables.

//$_ENV, $_GET, $_POST, $_COOKIE, $_SESSION —————– commonly called EGPCS varaibles

//$_REQUEST, $_FILES, $_SERVER – $_REQUEST contains both GET and POST values

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//watch the relative path ./ this means that where ever the script runs system will be checking the existence of directory or file in its current directory
// relative path ../ implies that the system will be checking the existence of the file or directory in its parent directory
 
$destinationDIR="./uploaded/".$_FILES['filename']['name'];
 
// read the difference between move_uploaded_file function and copy function in PHP manual
 
if(move_uploaded_file($_FILES['filename']['tmp_name'],$destinationDIR)){
	echo "File has been uploaded succefully<br><br><br>";
	echo "File you uploaded is : <img src='".$destinationDIR."' alt='testme'>";
	echo "<br><br><a href='file_upload.html'>click here</a> to upload another file";
}else{
	echo "Sorry, This file cannot be uploaded!!  <a href='file_upload.html'>click here</a>to try again";
}

Download

Next Page →