Jump to content

[SOLVED] encoding cookies?


droopz17

Recommended Posts

I have searched far and low for a way to encode my cookies and then decode them. I can't find crap. So i'm curious if a function like the one i wrote real quick below would work at all, and then i'll make one simular to it to decode the cookie.

 

create function encode($var){

$out_var = '';
$s = '0';
$e = '1';

$num_char = strlen($var);

//WHILE NUMBER OF CHARACHTERS IS LESS THE THE NUMBER OF I
while( $num_char < $i ){
	$new_var = substr($var, $s, $e )

	if( $new_var == a ){
		$out_var .= '05';

	}elseif( $new_var == b ){

		$out_var .= '18';

	}elseif( $new_var == c ){

		$out_var .= '06';

	}elseif( $new_var == d ){

		$out_var .= '19';

	}elseif( $new_var == e ){

		$out_var .= '07';

	}elseif( $new_var == f ){

		$out_var .= '20';

	}elseif( $new_var == g ){

		$out_var .= '08';

	}elseif( $new_var == h ){

		$out_var .= '21';

	}elseif( $new_var == i ){

		$out_var .= '09';

	}elseif( $new_var == j ){

		$out_var .= '22';

	}elseif( $new_var == k ){

		$out_var .= '10';

	}elseif( $new_var == l ){

		$out_var .= '23';

	}elseif( $new_var == m ){

		$out_var .= '11';

	}elseif( $new_var == n ){

		$out_var .= '24';

	}elseif( $new_var == o ){

		$out_var .= '12';

	}elseif( $new_var == p ){

		$out_var .= '25';

	}elseif( $new_var == q ){

		$out_var .= '13';

	}elseif( $new_var == r ){

		$out_var .= '26';

	}elseif( $new_var == s ){

		$out_var .= '14';

	}elseif( $new_var == t ){

		$out_var .= '01';

	}elseif( $new_var == u ){

		$out_var .= '15';

	}elseif( $new_var == v ){

		$out_var .= '02';

	}elseif( $new_var == w ){

		$out_var .= '16';

	}elseif( $new_var == x ){

		$out_var .= '03';

	}elseif( $new_var == y ){

		$out_var .= '17';

	}elseif( $new_var == z ){

		$out_var .= '04';

	}else{
		echo 'encoding did not work.'
		exit;
	}					

	$s++;
	$e++;
$i++
}
return $out_var;

}

 

now i'm sure theres some errors in there but i'm at work so it's just a quick idea, and i need to know somehting like this would work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.