<?php
print("<html>");
print("<p>Please click the links below to submit comments about FYICenter.com:</p>");
$comment = 'I want to say: "It\'s a good site! :->"';
$comment = urlencode($comment);
print("<p>"
."<a href=\"processing_forms.php?name=Guest&comment=$comment\">"
."It's an excellent site!</a></p>");
$comment = 'This visitor said: "It\'s an average site!
"';
$comment = urlencode($comment);
print("<p>"
.'<a href="processing_forms.php?'.$comment.'">'
."It's an average site.</a></p>");
print("</html>");
?>
]]>Unset() is a function for variable management. It deletes/unset a given variable.
]]>
<?php
$file = file_get_contents("/windows/system32/drivers/etc/services");
print("Size of the file: ".strlen($file)."\n");
?>
This script will be printed:
Size of the file: 7116
]]>I would say a scripter is – by comparison – someone who completes his task with PHP without concerning about application structure and business model – just to finish things off, and PHP is a dangerous tool for that due to its relative simplicity and great popularity. Scripter forced to use programming language other than PHP would almost surely be confused and have to rethink his whole approach to the problem.
So I’d say this is what separates those two kinds of IT workers.
]]>Sessions are commonly used to store temporary data to allow multiple PHP pagesto offer a complete functional transaction for the same visitor.
]]>
<SCRIPT LANGUAGE="JavaScript">
function CheckAll(chk)
{
for (i = 0; i < chk.length; i++)
chk[i].checked = true ;
}
function UnCheckAll(chk)
{
for (i = 0; i < chk.length; i++)
chk[i].checked = false ;
}
</script>
HTML Code:
<form name="myform" action="checkboxes.asp" method="post"> <b>Scripts for Web design and programming</b><br> <input type="checkbox" name="check_list" value="1">ASP<br> <input type="checkbox" name="check_list" value="2">PHP<br> <input type="checkbox" name="check_list" value="3">JavaScript<br> <input type="checkbox" name="check_list" value="4">HTML<br> <input type="checkbox" name="check_list" value="5">MySQL<br> <input type="button" name="Check_All" value="Check All" onClick="CheckAll(document.myform.check_list)"> <input type="button" name="Un_CheckAll" value="Uncheck All" onClick="UnCheckAll(document.myform.check_list)">]]>
// index.php <a href="index2.php">Go to index2</a> // index2.php echo $_SERVER['HTTP_REFERER']; // Display index.php]]>
HTTP_ACCEPT_LANGUAGE
What type of languages the browser expects.
These are human languages, such as en-us, to represent, English, United States.
HTTP_CONNECTION
The type of connection established between the client and the Web server.
HTTP_HOST
The hostname of the client computer.
HTTP_USER_AGENT
The browser type and version, and operating system information of the client.
HTTP_REFERER
The full URL of the Web page containing the hyperlink used to reach the currently executing ASP page.
HTTP_COOKIE
The cookies sent from the browser.
<form enctype="application/x-www-form-urlencoded" action="script.php" method="post"> <input type="file" name="myfile" /> <input type="submit" name="submit" value="Upload" /> </form>
PHP Code :
<?php/* File name is null */
if($_FILES[’file’][’name’]==’’){
/* the path to the directory for upload*/
$target_path =’null’;die();
}
else{
$target_path = "FileDirectory/";
/* wrong file type - not a doc type file*/
if (substr($_FILES[’myfile’][’name’],strlen($_FILES[’myfile’][’name’])-4,4)!=’.doc’){
echo "Failed upload!";}
/* the path where file will be put */
$target_path = 'path_here' ;
if (!move_uploaded_file($_FILES[’myfile’][’tmp_name’], $target_path)){
/* error during upload */
echo "Error!";die ();
}
}
?>
]]>