PHP Tips Tutorials

Php encrypt and decrypt

This article will give information about php “encryption” and “decryption”. When we send information from one page to another page via “URL”, Anyone can see what we are sending in url. To avoid that, We will send encrypted message or information. On destination page we will decrypt this text. So it will secure and anyone could not understand.For encryption and decryption, We have to use one keyword. So if anyone […]... Read More »

How to Enable .htaccess in WAMP Server

To Enable .htaccess in WAMP Server use the following stepsSTEP  1:  click on Wampserver and select apache->httpd.confSTEP  2: Find and replace the following textFind      #LoadModule rewrite_module modules/mod_rewrite.soReplace   LoadModule rewrite_module modules/mod_rewrite.soSTEP  3: Restart Wamp ServerNow .htaccess will work successfully... Read More »

Download File Using Php

I added the code to download the file using php. When we apply this concept, dont need to give the file dirctory to user. <?php function downloadfile($filepath){ if(file_exists($filepath)){ // Change it based on file extension or type $type="application/zip"; header("Pragma: public"); header("Content-Type: $type"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment;filename=\"".basename($filepath)); header('Content-Length: '.filesize($filepath)); header("Content-Transfer-Encoding: binary"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); ob_clean(); flush(); readfile($filepath); } }... Read More »

PHP RANDOM PASSWORD

<?php $length = 10; $chars = array_merge(range(0,9), range('a','z'), range('A','Z')); shuffle($chars); $password = implode(array_slice($chars, 0, $length)); echo $password; ?>... Read More »

Password Generator In PHP

Password Generator In PHP. We can generate dynamic password with numeric, alphanumer etc using php. I created dynamic_password function. It will generate and return the dynamic password. You should have to send password type, length like sha1, md5 for password type and numeric value for password length.<?php function dynamic_password($type='',$length=10){   // Dynamic password function   $chars = array_merge(range(0,9), range('a','z'), range('A','Z'));   shuffle($chars);   $password = implode(array_slice($chars, 0, $length));   if($type=='md5'){ […]... Read More »