Make a string’s first character uppercase

ucfirst — Make a string’s first character uppercase

example:

$coo= ‘clay desiccant!’;
$coo= ucfirst($desiccant); // Clay desiccant!

$bar = ‘CLAY DESICCANT!’;
$bar = ucfirst($bar); // CLAY DESICCANT!
$bar = ucfirst(strtolower($bar)); // Clay desiccant!

(more…)

Posted in Php Code, Php Functions. Comments Off on Make a string’s first character uppercase »

How to ad text on main page of phpld?

{if $category.ID == 0}
This is the description of my homepage. I can even include html.
{/if}

Note:the above code works, but the only problem is this added text also appears when using the search function from the home page. (more…)

Posted in Php Code, PHP Link Directory. Comments Off on How to ad text on main page of phpld? »

How to show all files under a document and rename the file names?

$dirname=”E:/zhanzhongjie/chengbiao-com/chengbiao-com”;
$dir_handle=opendir($dirname);
while($file=readdir($dir_handle))

{
echo $file.”
“;
rename(“E:/zhanzhongjie/chengbiao-com/chengbiao-com/”. $file, “E:/zhanzhongjie/chengbiao-com/chengbiao-new/insurance-“.$file);
}

closedir($dir_handle) (more…)

Posted in Php Code, Php Learning. Comments Off on How to show all files under a document and rename the file names? »

Php generate random severeal numbers one time

srand((double)microtime()*1000000);
$random_number1 = rand(1,60);
echo (”$random_number1
“);
$random_number2 = rand(1,60);
echo (”$random_number2
“); (more…)

Posted in Php Code. Comments Off on Php generate random severeal numbers one time »

Function to judge a character is upper case or lower case

function isLowerCase($char){
if(chr($char)>=97 AND chr($char)< =122) return true; else return false; } (more…)

Posted in Php Code. Comments Off on Function to judge a character is upper case or lower case »

Using php to control many domains withing one web host

can build many web sites, with one web host, one site with one different domain, just using php, it can make you very happy, save your money.

$arrays=array(
’www.money.com’=>’money/index.html’,
’www.insurance.com’=>’insurance/index.html’,
’www.car.com’=>’car/index.html’,
’www.travel.com’=>’travel/index.html’,
’127.0.0.1’=>’forum/index.php’,
);
$url = $arrays[$_SERVER[’HTTP_HOST’]];
Header(”Location: $url”);
?> (more…)

Posted in Php Code, Php Skills. Comments Off on Using php to control many domains withing one web host »

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 »

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() »

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 »
King Php Science Welcome, you are from: 23.20.157.174