public function register_one()
 {
     $username = $_POST['uname'];
     $email = $_POST['email'];
     $en_pass = $_POST['password'];
     $crypt_options = array('cost' => 12);
     $password = password_hash($en_pass, PASSWORD_BCRYPT, $crypt_options);
     $this->db->where('emailID', $email);
     $query = $this->db->get('email');
     if ($query->num_rows() > 0) {
         echo 2;
     } else {
         function generateUniqueToken($number)
         {
             $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
             $token = "";
             for ($i = 0; $i < $number; $i++) {
                 $index = rand(0, count($arr) - 1);
                 $token .= $arr[$index];
             }
             return $token;
         }
         $verificationCode = generateUniqueToken(20);
         $sql_1 = "INSERT INTO `customermaster`(`custName`, `custStatus`,`joomlaPWD`) VALUES(" . $this->db->escape($username) . ",'10','{$en_pass}' )";
         $this->db->query($sql_1);
         $custId = $this->db->insert_id();
         // coockie for joomla blog
         setcookie('uid4joomla', $custId, time() + 86400, "/");
         $sql_2 = "INSERT INTO `email`(`custID`, `emailID`,`security`) VALUES(" . $custId . "," . $this->db->escape($email) . "," . $this->db->escape($verificationCode) . ")";
         $this->db->query($sql_2);
         $sql_3 = "INSERT INTO `accessmaster`(`custID`, `accPWD`, `theme`) VALUES( " . $custId . "," . $this->db->escape($password) . ",1)";
         $this->db->query($sql_3);
         echo $this->db->affected_rows();
         /************MAIL *************************/
         $link = base_url() . "home/verify/" . $verificationCode . "/" . $custId . "#continue_two?id=" . $custId;
         $message = "<!DOCTYPE html>\n\t\t\t \t\t\t <html>\n\t\t\t\t\t\t<head>\n\t\t\t\t\t\t\t<title>MAHAJYOTHIS Mail</title>\n\t\t\t\t\t\t</head><body>\n\t\t\t\t\t\t\t<div class='container1' style=' height:700px; margin:0 auto; width:640px; float:none; margin-top:80px; ' >\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<div  class='header'  style='height:150px; width:640px;  background-image: url(http://www.mahajyothis.net/assets/img/email.png);  '>\n\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<p><font style='color:#ffffff;font-size:19px;font-family:calibri;'> Action Required: </font></p>\n\t\t\t\t\t\t\t<p> <font style='color:#ffffff ;font-size:23px; font-family:calibri;'><b> Please verify your e-mail address</b></font></p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div style='content'>\n\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'><b> Dear Valued Mahajyothis.net customer,</b></p>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> We noticed that you have to verify your e-mail address. </p>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> Your Account details&#58;&#45;</p>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'><b> Email:</b>" . $email . "<p>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> <b>Password:</b>" . $en_pass . "<p>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'>To do so please click the button below. You will not be allowed to log in to your Mahajyothis account. we are verifying the ownership of this e-mail address.<p>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> Without timely verification you can't fully manage your domain and we will be required to put any hosted content on hold.</p>\n\t\t\t\t\t\t\t<a href=" . $link . "><button style='background-color: peru;\n\t\t\t\t\t\t\t    height: 55px;\n\t\t\t\t\t\t\t    margin-left: 34%;'> <font style='color:#ffffff'>verify your e-mail address</font></button></a>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> Thanks for being a Mahajyothis.net customer</p>\n\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> Sincerly,</p>\n\t\t\t\t\t\t\t<p style='font-size:18px;font-family:calibri;'> <b>Mahajyothis Limited</b></p>\n\t\t\t\t\t\t\t<p style='font-size:13px;font-family:calibri;'> Enlightining the inheritance of india</p>\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div  id='bottomcolorsection'style='background:#8A8A8A; height:20px; width:640px;'>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t </div>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t</body></html>";
         $this->load->library('email');
         $config['protocol'] = 'sendmail';
         $config['mailpath'] = '/usr/sbin/sendmail';
         $config['charset'] = 'iso-8859-1';
         $config['wordwrap'] = TRUE;
         $config['mailtype'] = 'html';
         $this->email->initialize($config);
         $this->email->from('*****@*****.**', 'MAHAJYOTHIS');
         $this->email->to($email);
         $this->email->cc('*****@*****.**');
         $this->email->bcc('*****@*****.**');
         $this->email->subject('MAHAJYOHTIS VERIFICATION');
         $this->email->message($message);
         $this->email->send();
         //echo $this->email->print_debugger();
     }
 }
示例#2
0
 function generateUniqueToken($number)
 {
     $arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
     $token = "";
     for ($i = 0; $i < $number; $i++) {
         $index = rand(0, count($arr) - 1);
         $token .= $arr[$index];
     }
     if (isToken($token)) {
         return generateUniqueToken($number);
     } else {
         return $token;
     }
 }