X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_person_signup.php;h=ad391786e279bd67928fad7a4b534ad3a4964b20;hb=fcf0c66d0c4f272b279cacac28349b629069204b;hp=8e0351ffe43b8214f90234777c1027d2907b78b1;hpb=9653350588c1d3a0b2555e8c9737c977412db84b;p=Pman.Core
diff --git a/DataObjects/Core_person_signup.php b/DataObjects/Core_person_signup.php
index 8e0351ff..ad391786 100644
--- a/DataObjects/Core_person_signup.php
+++ b/DataObjects/Core_person_signup.php
@@ -37,9 +37,11 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
// if key matches verify_key
// copy into person or other entity...
// and delete....
- $this->whereAdd("verify_key = '".$key."'");
- if($this->count() > 0 ){
- $row = $this->fetch();
+ //$this->whereAdd("verify_key = '".$key."'");
+ $row =
+ var_dump($row);
+ exit();
+ if($this->get("verify_key",$key)){
$p = DB_DataObject::factory('person');
$p->honor = $row->honor;
$p->name = $row->name;
@@ -52,8 +54,37 @@ class Pman_Core_DataObjects_Core_person_signup extends DB_DataObject
//$temp_pwd = mt_rand(100000,999999);
//$p->passwd = $temp_pwd;
if($p->insert()){
+
$this->delete();
- return $temp_pwd;
+
+ //login
+ @session_start();
+
+ $_SESSION['Hydra']['authUser'] = $p ? serialize($p) : false;
+
+ //mail pwd
+ $htmlStr = "";
+ $htmlStr .= "Dear ".$p->honor.".".$p->lastname."
";
+ $htmlStr .= "Congratulations on Joining HydRa.
";
+ $htmlStr .= "If you need to access the system again please log in using the password ";
+ $htmlStr .= $temp_pwd;
+
+ $name = "Roojs";
+ $email_sender = "no-reply@roojs.com";
+ $subject = "Congratulations";
+ $recipient_email = $p->email;
+
+ $headers = "MIME-Version: 1.0\r\n";
+ $headers .= "Content-type: text/html; charset=utf-8\r\n";
+ $headers .= "From: {$name} ";
+ $headers .= "<";
+ $headers .= $email_sender;
+ $headers .= ">\r\n";
+
+ $body = $htmlStr;
+ if(mail($recipient_email, $subject, $body, $headers)){
+ error_log("Sending failed.");
+ }
}else{
error_log("db insert error");
return false;