Posts Tagged ‘PHP’

Print days from date 1 to date 2

This function created by me will show the days and dates between two dates. Enjoy!
<form method=”post” action=”date.php”>
Date 1 (ex 20090101 = Y = 2009 M = 01 D = 01):<br />
<input type=”text” name=”date1″ style=”width:300px;” /><br />
Date 2 (ex 20090101 = Y = 2009 M = 01 D = 01):<br />
<input type=”text” name=”date2″ style=”width:300px;” /><br />
<input [...]


Send mail via PHP

First of all you have to change in your php.ini file if you do not have any mail server installed on your server/computer. You can send through your ISP SMTP server. Change this line in php.ini:
SMTP = localhost
To any vaild SMTP server, in my case I use my ISP smtp-server:
SMTP = smtp.bredband.net
When this is done [...]


Apache2, PHP 5, MySQL 5, phpMyAdmin for Windows

Here comes a little howto install Apache2, PHP 5, MySQL 5 and phpMyAdmin for windows.
In this tutorial I will use easyPHP which is a packed for these applications.
First, go to www.easyphp.org for downloading easyphp 3.
After you have download it just install easyphp.
When it is installed run it and go to http://127.0.0.1/home/
Here is where you can [...]


Random letters with PHP

Since it was no already function for random letters in PHP i was google on it and found this one some where i do not remeber but works exemplary.
function randomletters() {
$chars = “abcdefghijkmnopqrstuvwxyz023456789″;
srand((double)microtime()*1000000);
$i = 0;
$pass = ” ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
If [...]


Print PHP version

Since alot of friends ask me how to print out which PHP version they are using I decide to write how to do it here on my blog. It is very simple and will just take a few seconds.
Start with creating a new PHP document, for example: phpinfo.php
In the document you simply write:
<?PHP
phpinfo();
?>
And save. Only [...]