WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Encrypt/Decrypt string with a given key by using mcrypt module of PHP (suitable to store encrypted data into any type of databases).
Categories : PHP, Encryption Click here to Update Your Picture
NUR-E-ALAM KHAN
Date : Dec 10th 2005
Grade : 3 of 5 (graded 4 times)
Viewed : 23847
File : 4278.php
Images : No Images for this code example.
Search : More code by NUR-E-ALAM KHAN
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?php
// Script created by Nur-E-Alam Khan
// Email: porosh@msn.com (Dhaka, Bangladesh)
// Requirment : You need mcrypt module installed and enabled in your server.

function porosh_encrypt($data_input){     

   
$key = "key1";
   
$td = mcrypt_module_open('cast-256', '', 'ecb', '');
   
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
   
mcrypt_generic_init($td, $key, $iv);
   
$encrypted_data = mcrypt_generic($td, $data_input);
   
mcrypt_generic_deinit($td);
   
mcrypt_module_close($td);
   
$encoded_64=base64_encode($encrypted_data);
    return
$encoded_64;
}   


function
porosh_decrypt($encoded_64){
   
$decoded_64=base64_decode($encoded_64);
   
$key = "key1";// same as you used to encrypt
   
$td = mcrypt_module_open('cast-256', '', 'ecb', '');
   
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
   
mcrypt_generic_init($td, $key, $iv);
   
$decrypted_data = mdecrypt_generic($td, $decoded_64);
   
mcrypt_generic_deinit($td);
   
mcrypt_module_close($td);
    return
$decrypted_data;
}

// use:
//$value = porosh_encrypt($data_input);/// For encrypt
//$value = porosh_decrypt($encoded_64);// For Decrypt
// just include those functions with your script

//$input_data is a variable which can be use for the data you need to encrypt.
//$encoded_64 is also a variable which  will be used to store the data after 
//it's encrypted and then encoded with the base64_encode() function.
?>



MD5 based block cypher in 128 bit CFB
Categories : PHP, Encryption, MD5
A PHP function to encrypt and decrypt a number or string or a combination of the two.
Categories : PHP, Encryption, Security
PHP Cookies - Simple cookie write/read methods that allow basic encryption
Categories : PHP, Cookies, Security, Encryption
Encrypt/Decrypt
Categories : PHP, Encryption
base64 with encryption - encode and decode sessions
Categories : PHP, PHP Classes, Encryption, Sessions
PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character.
Categories : PHP, Algorithms, Security, Authentication, Encryption
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Scramble Eggs - php class to scramble/encode
Categories : PHP, PHP Classes, Security, Encryption
This simple function will take a few arguments and easily set a associative array for each column in a result from a MySQL query
Categories : Databases, PHP, MySQL, Arrays
Create images on fly using GD-Image Lib
Categories : PHP, Graphics
using global variables
Categories : Global Variables, PHP
WebServerSpy checks which kind of Webserver is running, Apache, Netscape, Fasttrack, IIS, HTTP-Header, HTTP 1.0, GET, spy, WWW
Categories : HTTP, Network, Apache, PHP, Web Servers
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
tinySendMail and tinySockMail functions for generating SMTP mail within PHP
Categories : PHP, Mail, SMTP
Dynamic Organization chart
Categories : PHP, MySQL