public function decode_session($session_id) { $cr = new crypto(); $usr_session = $cr->decrypt(base64_decode($session_id)); $tokens = split('&', $usr_session); if (count($tokens) != 3) { return false; } $this->session_uid = $tokens[0]; $this->session_uname = $tokens[1]; $this->session_email = $tokens[2]; return true; }
function activate_user() { $activated = false; $token = $_GET['activate']; if ($token != '') { $cr = new crypto(); $uid = $cr->decrypt(base64_decode(urldecode($token))); $u = new user(); if ($u->activate_user($uid)) { $activated = true; } } return $activated; }
<?php include "/var/www/includes/crypt.php"; $c = new crypto(); $a = 'abc123'; echo $a; echo "<BR/>"; echo $c->one_way_crypt($a); echo "<BR/>"; $u = $_GET['u']; $token = urldecode($u); echo $token; echo "<BR/>"; $t = base64_decode($token); echo $t; echo "<BR/>"; echo $c->decrypt($t);
<?php $e = "2Xe41PNx4WY="; echo urldecode($e); echo "<BR/>"; $c = base64_decode($e); include_once "/var/www/includes/crypt.php"; $cr = new crypto(); $uid = $cr->decrypt($c); include_once "/var/www/includes/user.php"; $u = new user(); $u->activate_user($uid);
<nav> </nav> </header> <?php $msg = false; $err = ""; $linktoken = ""; if (isset($_GET['u'])) { include_once "/var/www/includes/crypt.php"; include_once "/var/www/includes/user.php"; $token = urldecode($_GET['u']); if ($token != "") { $u = new user(); $cr = new crypto(); $uid = $cr->decrypt(base64_decode(urldecode($token))); try { if ($u->already_activated($uid)) { throw new Exception("User is already activated"); } else { if ($u->activate_user($uid)) { $msg = true; } else { throw new Exception("Activatation failed!!!"); } } } catch (Exception $e) { $err = $e->getMessage(); } } } elseif (isset($_GET['linktoken'])) {