Php generate random numbers

/*random function
$length: length of needed number
*/
function random($length) {
$hash = ”;
$chars = ‘0123456789′;
$max = strlen($chars) – 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; } (more…)

Posted in Php Code, Php Functions. Comments Off on Php generate random numbers »

Remove hyperlinks ( A tag) from HTML

Sometimes we want to remove hyperlinks with anker text, sometimes only keep anker text, how to use php to achive this?

First, only remove hyperlink, and keep anker text part, the code is:

$text = ‘Test paragraph.’; (more…)

Posted in Php Learning. Comments Off on Remove hyperlinks ( A tag) from HTML »

rename()

— Renames a file or directory

Description
bool rename ( string $oldname , string $newname [, resource $context ] )
Attempts to rename oldname to newname . (more…)

Posted in Php Code, Php Functions. Comments Off on rename() »

Rename all .html to .htm using DOS command

If we need to rename all .html to .htm, we can use DOS command: ren

For example, we need to rename all the .html files under E:\dns\aagg, (more…)

Posted in Other. Comments Off on Rename all .html to .htm using DOS command »

fwrite() example

Description
int fwrite ( resource $handle , string $string [, int $length ] )
fwrite() writes the contents of string to the file stream pointed to by handle . (more…)

Posted in Php Functions, Php Study. Comments Off on fwrite() example »

chr — Return a specific character

Description
string chr ( int $ascii )
Returns a one-character string containing the character specified by ascii . (more…)

Posted in Php Functions, Php Study. Comments Off on chr — Return a specific character »

how to use php generate passwords

Here are 2 kind php code can generat strong passwords:

$password_length = 9;

function make_seed() {
list($usec, $sec) = explode(’ ‘, microtime());
return (float) $sec + ((float) $usec * 100000);
}

srand(make_seed());

$alfa = “1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM”;
$token = “”;
for($i = 0; $i < $password_length; $i ++) {
$token .= $alfa[rand(0, strlen($alfa))];
}
echo $token;

(more…)

Posted in Php Code. Comments Off on how to use php generate passwords »

Hide your Affiliate Links using PHP file

If you want to make more money and profit from your affiliate links, you need to display them in different way. Don’t use the default link generated by your affiliate program script. Instead, hide it by using PHP file.

(more…)

Posted in Php Code, Php Skills. Comments Off on Hide your Affiliate Links using PHP file »

The application failed to initialize properly( 0xc0150002).Click on OK to terminate application

Today when I install XAMPP (www.apachefriends.org), an error comes out “The application failed to initialize properly( 0xc0150002).Click on OK to terminate application”, I search the internet and found the method to resolve the problem, it is very easy, just download and install the Visual C redistributable: http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=200b2fd9-ae1a-4a14-984d-389c36f85647&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2fe%2f1%2fc%2fe1c773de-73ba-494a-a5ba-f24906ecf088%2fvcredist_x86.exe

(more…)

Posted in Apache. Comments Off on The application failed to initialize properly( 0xc0150002).Click on OK to terminate application »
King Php Science Designed by:KingPhp.com Welcome, you are from: 54.205.172.57