tag:blogger.com,1999:blog-44541436402889113542024-03-27T03:10:49.196-07:00Best PHP sources ! Free php Tutorials, Scripts, Codes ...Want to learn PHP, with us you will love PHP ! We will provide you with all tutorials and free script ready to use, everything you want: php file, php mail, php mysql and much moreILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.comBlogger48125tag:blogger.com,1999:blog-4454143640288911354.post-82653997225131705772012-11-27T10:08:00.003-08:002012-11-27T10:08:25.597-08:00Url Encoding - Use rawurlencode not urlencode !
The URL encoding is one the mysterious functions that PHP programmers does use but without knowing all the details behind it. When one wants to create a link dynamically he just use urlencode, and thi is so necessary because in an URl, there is some reserved characters that have sens for the browsers and the the server-side scripts. You should already know the meaning of ? , & and ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com18tag:blogger.com,1999:blog-4454143640288911354.post-72001803959680411972010-12-30T11:22:00.000-08:002010-12-30T11:22:53.485-08:00Memory problem in PHP simple HTML DOMI was using PHP Simple HTML dom, a great and free library for parsing html pages and retreiving info from it. I really liked it.. But when it comes to parsing many differents pages of some website in one php script, you will get an error:
Allowed memory size of 67108864 bytes exhausted,
and this is because simple HTML dom don't free up the memory in real time, so the solution is:
Each time youILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com19tag:blogger.com,1999:blog-4454143640288911354.post-55283244113084807332010-03-19T08:36:00.000-07:002010-03-19T08:48:12.688-07:00“Who Is Online” Widget With PHP, MySQL & jQueryDo you see in some website a nice list of online users ? Do you want to have one in your website ? That should be easy now thanks to this very helpful and easy-to-install widget: “Who Is Online” Widget With PHP, MySQL & jQuery I hope you will like it :)ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com11tag:blogger.com,1999:blog-4454143640288911354.post-74741565995848936722010-01-20T08:32:00.000-08:002010-01-20T11:48:20.114-08:00String Capitalization Functions: strtoupper-strtolower-ucwords.In php you can easily manipulate the capitalization of your PHP strings, there are ready to use functions that help you to convert yout text to upper case, lower case, or just the first letter of every word to upper case.<?php$originalString = "Testing string Capitalization AbCDe"; $upperCase = strtoupper($originalString); // Result: TESTING STRING CAPITALIZATION ABCDE$ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com34tag:blogger.com,1999:blog-4454143640288911354.post-55883708344427126482010-01-10T04:10:00.000-08:002010-01-10T04:30:45.531-08:00PHP For LoopWhen you need to do the same script many times, for exemple you want to send emails to all your users, you don't need to write a php code for each user, you just need to use for Loop which will do it for each one.This is how:<?phpfor ($userid=1;$userid<=10;$userid++){send_email($userid);}?>Where send_email() is your own function that send the email to the user ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com44tag:blogger.com,1999:blog-4454143640288911354.post-59167956878780050912010-01-05T05:18:00.000-08:002010-01-05T07:09:33.329-08:00PHP Validate Email Address: Email ValidatorWhen working with forms and interacting with your visitors, you may want to verify if your visitor entered an email address in the right field, and if it is valide or not.Most of people who are new to php world, just verify if the text box of the email address is filled or not, without verifying the syntax of the email address...Something like this they use:if (isset($_POST['email'&#ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com37tag:blogger.com,1999:blog-4454143640288911354.post-56166392992756224892010-01-04T07:41:00.000-08:002010-01-04T08:01:55.081-08:00PHP Random code GeneratorThis is a very simple-to-use php function that help you generate random codes in very easy way, you will need this function to generate random passwords, confirmation links,...So, this is it:<?phpfunction createRandomPassword() { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); &ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com8tag:blogger.com,1999:blog-4454143640288911354.post-375647876750851272010-01-03T03:42:00.000-08:002010-01-03T03:51:06.768-08:00PHP Get browser LanguageIn php you can get the language of your visitor, this is very helpful if you have many versions of your website for different languages.You can get the language of your visitor in this way:<?php$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);?>This will give you the 2letter language code, ie: en for english and fr for french .In fact $_SERVER['HTTP_ACCEPT_LANGUAGE'] ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com9tag:blogger.com,1999:blog-4454143640288911354.post-76237090144487403952010-01-02T10:01:00.000-08:002010-01-02T10:24:12.349-08:00PHP $_REQUESTYou probably already know that you can get variable from a html form in php using $_GET and $_POST, you use $_GET if the html form is like: <form name="name" action="form.php" method="get"> and use $_POST if it is <form name="name" action="form.php" method="post">.But what if you want your php to work for both post and get ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com13tag:blogger.com,1999:blog-4454143640288911354.post-60236339732968095172010-01-02T01:45:00.000-08:002010-01-02T02:23:33.041-08:00PHP send mail SMTP authentificationthis is a very complete php send mail script, with authentification ofcourse.You can choose the smtp server, use your username and password, and can send a html email.This script does not use php mail() function, it's all from scrach.<?php function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message){$smtpServer = "smtpout.europe.secureserver.net"; $port = "25"; $timeout = "30"; $ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com14tag:blogger.com,1999:blog-4454143640288911354.post-82907233413180937622010-01-01T08:29:00.000-08:002010-01-01T08:40:42.919-08:00ob_start - save php output to a string - The PHP output bufferingI want to share this great php utility: the output buffering, it is sometimes very usefull. So what it does ?The PHP output buffering will save all the server outputs ( html and php prints) to a string variable.So to start buffering, use ob_start(); this will keep saved any output.Then you use $variable = ob_get_clean(); to stop buffering, and copy the buffer content to the variable.Here are few ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com299tag:blogger.com,1999:blog-4454143640288911354.post-79346904625995722612010-01-01T07:04:00.000-08:002010-01-01T07:11:22.958-08:00PHP send HTML email, The complete php mail sending scriptThe last post by me was about a very easy way to send an email with php. But as it is simple, it will only send text email, not html.
If you want a complete mail sending script, that send in html, this is what you have to use:
<?php
//here the receiver of the email
$to = 'receiver@example.com';
//here the subject of the email
$subject = 'Test HTML email';
//create a boundary string. It must ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com41tag:blogger.com,1999:blog-4454143640288911354.post-75721912725161907842010-01-01T03:41:00.000-08:002010-01-01T03:41:47.304-08:00PHP mail() - send email with phpSending email with php is very simple, few lines of code and it works.
You need to send email using php when you have a comment or contact us form, where your visitors contact you via a web page form, and you get the message to your email address, or when you have a signup / registration form and you want to send automatically a confirmation link or a welcome message to your new users.
This is ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com3tag:blogger.com,1999:blog-4454143640288911354.post-148741909449642952009-12-31T13:38:00.000-08:002009-12-31T13:47:40.258-08:00PHP Post data to url with curlI know you will need sometimes to use a php code to send data (text) to an url using POST method, just like it was sent by a form.
So all you have to do now, is to copy this function and use it, you have to specify the url and the data to post and it goes !
<?php
function post_content($url,$nfields,$fields_string)
{
    $ch = curl_init();
    ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com5tag:blogger.com,1999:blog-4454143640288911354.post-6784959065653583752009-12-31T09:25:00.000-08:002009-12-31T09:35:35.567-08:00HTML code directly in IF ConditionsThis is the most amazing thing in php conditions, and exactly the if statement.
In a php condition, you can put directly a html code without the echo function :)
This is what I'm talking about, with echo function, then without.:
if ($condition == 'something') {
echo ' My Website...';
} else {
echo ' My Website...';
}
?>
With the new way I'm talking about, the script will be like this:
ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com2tag:blogger.com,1999:blog-4454143640288911354.post-48089083050394262722009-12-29T03:52:00.000-08:002009-12-29T03:54:05.367-08:00PHP formsUsing PHP With HTML FormsWe use forms to interact with the website visitor, we can get and save his name, email address, comments, and even his purchased item, color of the item, his street address.The form is made in two steps: creating a html form to be visible in the browser of the visitor, and creating a php script that will process the form, such as sending email, saving name and email in ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com1tag:blogger.com,1999:blog-4454143640288911354.post-82553204260945211372009-12-29T01:34:00.000-08:002009-12-29T01:39:28.592-08:00Tutorials-Planet.comI'm moving to Tutorials-planet.com, you can find there all php articles, tutorials and script you need to be a successfull php programmer.All php sources should be herePHP tutorials include strings, variables, functions, arrays and form tutorials, other tutorials are coming !ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com2tag:blogger.com,1999:blog-4454143640288911354.post-25301492768038487222009-05-03T05:57:00.000-07:002009-05-03T06:57:05.225-07:00Free web hosting servicesEvery one who want to start online business, need a very cheap or free web hosting to start with.Many companies online provide a good free web hosting services, and they may differ by their:Disk SpaceData Transfer / bandwidthdatabasesemail servicesusable languages: php/asp/perl ...All are free, but only the file hosting is free, and surely not the domain name. In every web hosting plan, you need ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com21tag:blogger.com,1999:blog-4454143640288911354.post-15812959071236656512009-04-10T05:56:00.000-07:002009-04-10T06:21:35.700-07:00Connect to Mysql DatabaseConnecting to the mysql database is done in two steps:Connecting to a mysql server, it's the most of time installed in the same server where php is, so we uselocalhost as address of mysql server.mysql_connect("localhost", "username", "password") or die(mysql_error());echo "Connected to MySQL Server";Some times, when you are running a server in your own computer and not a hosting service ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com1tag:blogger.com,1999:blog-4454143640288911354.post-23690439791833063122009-03-26T04:41:00.000-07:002009-04-10T06:01:33.177-07:00About Mysql DatabaseSo you want to know what is mysql ? Or already now it and want to learn how to use it with php ? In all cases we are here to help you !Mysql is useful when you want to store data, infos... Yes you can save your data in a text file, but will not be easy to read details, to search, or any other task...For example, let's say you want to store details of users of your website, every user will have anILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com5tag:blogger.com,1999:blog-4454143640288911354.post-39998358315056093192009-03-20T09:49:00.000-07:002009-03-20T10:18:14.722-07:00Do you need a php programmer ?The best solution to hire a programmer for a project you have, is to look for a freelancer.But where ?Ok, I know, there are many freelance websites and you are confused, or maybe you don't know any one, in all cases I advice you to take a look at scriptlance .Yes, I like it, and I'm already a programmer there, you can register and post your project for free, so nothing to lose to take a look at :ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com3tag:blogger.com,1999:blog-4454143640288911354.post-21186560152221964722009-03-20T08:59:00.000-07:002009-03-20T09:21:06.871-07:00php Loop statementsLoops are used in programming to do the same tasks many times, while a condition is true...That means, same script will be executed and repeated, until that condition becomes false.The loop statements used in php are:whiledo ... whileforforeachwhile and do ... while are similar, the only difference is that, the first one will execute the script if and as long as the condition is true, but the ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com2tag:blogger.com,1999:blog-4454143640288911354.post-80947966433573988242008-09-11T05:04:00.000-07:002009-03-20T10:38:17.864-07:00PHP eval - Execute php script in a stringDo you want to be able to run a php script in a string ?This could be very helpful, for example if you want to use a module or a template, you may have a php script in a string, just like that:Hello <?php echo $username; ?> . You are wellcome ! PR: wait... I: wait... L: wait... LD: wait... I: wait...wait... C: wait... SD: wait...What if you have this in a text file ? or in a database ? What ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com11tag:blogger.com,1999:blog-4454143640288911354.post-45046293725245966312008-09-06T05:08:00.000-07:002008-09-06T05:41:45.129-07:00PHP strings - substr() functionsubstr() is an usefull function to easily manipulate strings and use them, it returns a custom segment of a whole string.substr, from position $n to end:You can extract a small segment from a string from a position $n to the end:<?php$part = substr("I'm in Europe now", 7 ); // $part = "Europe now" ?> PR: wait... I: wait... L: wait... LD: wait... I: wait...wait... C: wait... SD: wait...Note: ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com1tag:blogger.com,1999:blog-4454143640288911354.post-14024795623724536652008-09-03T03:18:00.000-07:002008-09-03T09:28:22.568-07:00PHP some filesystem functionsPHP have many functions to acces and manipulate files, the most important filesystem functions are posted here...basename() : Returns the filename component from a path.<?php$path = "/directory1/index.html";echo basename($path); // display: index.htmlecho basename($path ,".html" ); // display: index?>file_exists() : Checks if a file or directory exists ot not.<?phpecho file_exists("test.txt")ILyeshttp://www.blogger.com/profile/16444029276413572899noreply@blogger.com1