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 : Encrypted Sessions
Categories : PHP, PHP Classes, Sessions Click here to Update Your Picture
Shashank Prabhakara
Date : Aug 31st 2008
Grade : 5 of 5 (graded 1 times)
Viewed : 3579
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Shashank Prabhakara
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

In order to keep the sessions' values safe it's quite important to encrypt them... So I wrote this to encrypt and decrypt the session keys... siple as it is just pass the values to the functions and get the encrypted or decrypted value back. This method uses base64 encryption

<?php

$ky
= '645735686'; // secret key for encrypt
class encode_session {
var
$enc_val;
var
$dec_val;
   
   
function
encode($set_ses,$ky)
{
    foreach(
$set_ses as $key=>$value){
   
$_SESSION[$key] = base64_encode(mcrypt_cbc(MCRYPT_BLOWFISH,$ky,$value,MCRYPT_ENCRYPT,'56546828'));
   
   
// set var to display or use
   
$this->$enc_val.=$key = $key.' = '.base64_encode($value).'<br>';
    }
}
       
function
decode($get_ses,$ky)
{
   
$dec_ses = base64_decode($_SESSION[$get_ses]);
       
   
// set var to display or use
   
$this->$dec_val= mcrypt_cbc(MCRYPT_BLOWFISH,$ky,$dec_ses,MCRYPT_DECRYPT,'56546828');
       
}
       
}

?>



Optimized Online users class
Categories : PHP, PHP Classes, Sessions
base64 with encryption - encode and decode sessions
Categories : PHP, PHP Classes, Encryption, Sessions
SPL and ITERATOR : examples
Categories : PHP, Object Oriented, PHP Classes, Sessions
A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
A very basic and fast XML parser
Categories : PHP, PHP Classes, XML
ECHO-PHP Class Real Time Transaction Processor v1.4.4 for Credit Cards and Checks / ACH
Categories : PHP Classes, Cybercash, Classes and Objects, Ecommerce, PHP
Expose - PHP template engine, supports server and client-sided caching,a plugin system, multiple languages, template script language is based on PHP itself.
Categories : PHP, PHP Classes, Templates, Complete Programs
Create and restore backup of MySQL databases
Categories : MySQL, Databases, PHP, PHP Classes, Complete Programs
XML Menu
Categories : PHP, PHP Classes, Navigation, XML, XSL
Class: Info on Users, Servers and the running script
Categories : PHP, Classes and Objects, User Interface, PHP Classes
Ajax PHP Tree (Left and Right) with MySQL
Categories : PHP, Databases, MySQL, AJAX, PHP Classes
YellowPages Content Grabber (PHP5 +)
Categories : PHP, PHP Classes, Regexps, Databases, MySQL
AutoCMS - This class can be used to generate a basic content site.
Categories : PHP, Content Management, PHP Classes
Create HTML forms dynamicly using Javascript & PHP
Categories : PHP, PHP Classes, Java Script
Simple Template Class/Example
Categories : PHP, Templates, PHP Classes