Sunday, 24 April 2011

WWW-Authenticate: Basic Realm=name:




content_disposition:attachment-: By using this header we can display the download dialog box on the web page.
*Downloaded file should be located in root directory.
Dload.php
<?php
$fname=$_REQUEST['fname'];
header("content-disposition:attachment;filename=$fname");
readfile($fname);
?>
Danphp.php

<a href="dload.php?fname=1.jpg">Download</a>
<br>
<a href="dload.php?fname=2.jpg">Download</a>
<br>
<a href="dload.php?fname=3.jpg">Download</a>

WWW-Authenticate: Basic Realm=name:

*By using this header we can display the authentication dialog box on the web page. Authentication dialog 
box is providing two text boxes along with ok and cancel buttons.

*We can use the authenticate dialog box to validate username and password. The values will transform to HTTP head location that is why the performance very fast.

$_SERVER[‘PHP_AUTH_USER’] : By using this super global variable we can get the username text box.

$_SERVER[‘PHP_AUTH_PW’] : By using this super global variable we can get the password control's value.
<?php
header("www-Authenticate:Basic Realm=Mysite");
$uname=$_SERVER['PHP_AUTH_USER'];
$pwd=$_SERVER['PHP_AUTH_PW'];
echo $uname;
echo $pwd;
?>

string: String is a collection of characters providing number of function and properties.

ucfirst: By using this function we can convert the first character of a string into upper case.

ucwords: By using this function we can convert the first characters of all words in a string into upper case.
Dan php Sample Script

<?php
$str="welcome to php";
echo ucwords($str);
?>
ord: It returns the ascii value of the input character.

<?php
echo ord('a');
?>
chr: It converts the ascii value of a character to original character.
<?php
echo chr(‘98');
?>

hl2br: By using this function we can break the new lines of a string.
<?php
$str="Hi
Hello
Dan PHP";
echo $str
?>
add slashes: By using this function we can add the back slashes in front of the single and double quotations.
<?php
$str="welc'ome";
echo addslashes($str);
?>
stripslashes: By using this function we can remove the slashes of add slashes.
<?php
$str="welc'ome";
$str1=addslashes($str);
echo $str1;
echo stripslashes($str1);
?>
addcslashes: By using this function we can add the slashes in front of the specified character.
<?php
$str="welcome";
echo addslashes($str,'e');
?>
skipcslashes: To remove the slashes of addcslashes.

trim: This function removes the left hand side and right hand side spaces of a string.

ltrim: This function removes the left hand side spaces.

rtrim: This function removes the right hand side spaces.

chop: This function is similar to the rtrim.
<?php
$str="welcome";
$str1="DanPHP";
echo rtrim($str).$str1;
?>

chunk_split: split a string into small’s chunk.
<?php
$str="Welcome";
echo chunk_split($str,2);
?>


str_shuffle: By using this function we can change the order of a character in a string.
<?php
$str="welcome";
echo str_shuffle($str);
?>

count_chars: It returns the information about the character used in a string. If the mode is “0” it returns the array. The array keys are ascii values from 0 to 255. And array values are the number of accrued values of the characters.
*If the mode is “1” it returns the available character and the keys are ascii values of the character and the values are nothing but the total number of a occurrences.
*If the mode is “2” it returns the non occurred characters in a string.
similar_text: This function checks the similarities between two text contents and returns the total number of similarities.


<?php

$str="Dan PHP";
$str1="Dan HTML";
echo similar_text($str,$str1);
?>

1 comment:

  1. sir hw can i see static web page and dynamic web page? please give the a valuable response ASAP FOR ME

    ReplyDelete