Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- function genRandomString() {
- $length = 5;
- $characters = "0123456789abcdefghijklmnopqrstuvwxyz";
- $string = "";
- $p = 0;
- for ($p = 0; $p < $length; $p++) {
- $string .= $characters[mt_rand(0, strlen($characters))];
- }
- return $string;
- }
- $string = genRandomString()."-".genRandomString()."-".genRandomString()."-".genRandomString()."-".genRandomString();
- $string = strtoupper($string);
- require_once("include/config.php");
- require('libs/Smarty.class.php');
- $smarty = new Smarty;
- $smarty->template_dir = 'templates';
- $smarty->compile_dir = 'temp';
- $time = Time();
- if(isset($_POST['username']) and ($_POST['password']) and ($_POST['key'])){
- $username = $_POST['username'];
- $password = md5($_POST['password']);
- $key = $_POST['key'];
- $query = mysql_query("SELECT * FROM `keys` WHERE `key`='{$key}'");
- if (mysql_num_rows($query) == 1) {
- while($row = mysql_fetch_array($query)){
- $key1 = $row[0];
- $months = $row[1];
- $max = $row[2];
- $type = $row[3];
- $reseller = $row[4];
- $trial1 = $row[5];
- $attacks = $row[6];
- }
- if($months=="lifetime"){
- $months = "lifetime";
- }elseif($months=="trial"){
- $months = $time + 86400 * $months;
- }else{
- $months = $time + 86400 * $months;
- }
- $key = mysql_real_escape_string($key);
- $query = mysql_query("INSERT INTO `users` (`login`, `passwd`, `max`, `trial`, `attacks`, `reseller`, `expiry`, `type`, `key`) VALUES ('".$username."', '".$password."', '".$max."', '".$trial1."', '$attacks', '".$reseller."', '".$months."', '".$type."', '{$key}');");
- $query = mysql_query("delete from `keys` where `key`='{$key}'");
- echo mysql_error();
- $smarty->assign("done", "Your account has been added, you can now Login!");
- }else{
- die("Your key isn't valid, please contact support.");
- }
- }else{
- $smarty->assign("done", "");
- }
- $smarty->display("class.register.tpl");
- ?>
Add Comment
Please, Sign In to add comment