Exemplo n.º 1
0
 public function AddDetails($postVar)
 {
     global $connection, $database, $mailer, $GLOBAL_WEB_ROOT;
     $displayName = $database->cleanXSS(@$postVar["displayName"]);
     $fullname = $database->cleanXSS(@$postVar["fullname"]);
     $emailaddress = $database->cleanXSS(@$postVar["emailaddress"]);
     $pwd = $database->cleanXSS(@$postVar["pwd"]);
     $fbID = $database->cleanXSS(@$postVar["fbID"]);
     if (empty($fbID)) {
         $fbID = 'undefined';
     }
     if (empty($fbName)) {
         $fbName = 'undefined';
     }
     if (empty($fbEmail)) {
         $fbEmail = 'undefined';
     }
     if (empty($userProfilePicture)) {
         $userProfilePicture = 'undefined';
     }
     $nowDateTime = date("Y-m-d H:i:s");
     $uniqueCode = createRandomCode();
     unset($variable);
     $qry = "insert into user_registration (fbID, fbName, fbEmail, userProfilePicture, displayName,fullname,emailaddress,pwd,uniqCode,createdDateTime,updatedDateTime)\n                    values (?,?,?,?,?,?,?,?,?,?,?)";
     //            $qry = "insert into user_registration (fbID, displayName,fullname,emailaddress,pwd,uniqCode,createdDateTime,updatedDateTime)
     //                    values (?,?,?,?,?,?,?,?)";
     $variable[] = array("s", $fbID);
     $variable[] = array("s", $fbName);
     $variable[] = array("s", $fbEmail);
     $variable[] = array("s", $userProfilePicture);
     $variable[] = array("s", $displayName);
     $variable[] = array("s", $fullname);
     $variable[] = array("s", $emailaddress);
     $variable[] = array("s", sha1($pwd));
     $variable[] = array("s", $uniqueCode);
     $variable[] = array("s", $nowDateTime);
     $variable[] = array("s", $nowDateTime);
     $result = $database->query("insert", $qry, $connection, $variable);
     if ($result > 0) {
         $html = '
             <table width="600" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse;">
                 <tr>
                     <td>
                         <div style="margin-bottom:20px;">Hi ' . $fullname . '!</div>
                         <div style="">
                             You have registered with Newslogue. Please click on the link below to verify your account.
                         </div>
                         <div>
                             <a href="' . $GLOBAL_WEB_ROOT . 'verify.php?c=' . $uniqueCode . '&emailaddress=' . $emailaddress . '">' . $GLOBAL_WEB_ROOT . 'verify.php?c=' . $uniqueCode . '&emailaddress=' . $emailaddress . '</a>
                         </div>
                         <div style="margin-top: 40px;">
                             Greatly Welcomed by<br />
                             The Team at Newslogue
                         
                         </div>
                     </td>
                 </tr>
             </table>
             ';
         //$mailer->AddAddress($email, $firstName. " ".$lastName);
         $mailer->AddAddress($emailaddress);
         $mailer->SetFrom("*****@*****.**", "Newslogue");
         //$mailer->AddReplyTo($employerUsername, $firstName. " ".$lastName);
         $mailer->Subject = "Newslogue Account Verification";
         $mailer->AltBody = 'To view the message, please use an HTML compatible email viewer!';
         // optional - MsgHTML will create an alternate automatically
         $mailer->MsgHTML($html);
         $result = $mailer->Send();
         return $result;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
session_start();
header('Content-Type: text/html; charset=utf-8');
//检测登录
if (isset($_SESSION['uid'])) {
} elseif (isset($_SESSION['oid'])) {
} else {
    return;
}
$result = array();
$result['success'] = false;
$success_num = 0;
$msg = '';
//上传目录
$dir = $_SERVER['DOCUMENT_ROOT'] . "\\upload";
// 取服务器时间+8位随机码作为部分文件名,确保文件名无重复。
$filename = date("YmdHis") . '_' . floor(microtime() * 1000) . '_' . createRandomCode(8);
// 处理原始图片开始------------------------------------------------------------------------>
//默认的 file 域名称是__source,可在插件配置参数中自定义。参数名:src_field_name
$source_pic = $_FILES["__source"];
//如果在插件中定义可以上传原始图片的话,可在此处理,否则可以忽略。
if ($source_pic) {
    if ($source_pic['error'] > 0) {
        $msg .= $source_pic['error'];
    } else {
        //原始图片的文件名,如果是本地或网络图片为原始文件名、如果是摄像头拍照则为 *FromWebcam.jpg
        $sourceFileName = $source_pic["name"];
        //原始文件的扩展名(不包含“.”)
        $sourceExtendName = substr($sourceFileName, strripos($sourceFileName, "."));
        //保存路径
        $savePath = "{$dir}\\php_source_{$filename}." . $sourceExtendName;
        //当前头像基于原图的初始化参数(只有上传原图时才会发送该数据,且发送的方式为POST),用于修改头像时保证界面的视图跟保存头像时一致,提升用户体验度。
Exemplo n.º 3
0
 static function addStudentGroup($group)
 {
     if (!$group) {
         drupal_set_message(t('Insert requested with empty (filtered) data set'));
         return false;
     }
     global $user;
     $txn = db_transaction();
     try {
         $uid = $user->uid;
         $institute_ids = db_select('soc_user_membership')->fields('soc_user_membership', array('group_id'))->condition('uid', $uid)->condition('type', _INSTITUTE_GROUP)->execute()->fetchCol();
         if ($institute_ids) {
             $inst_id = $institute_ids[0];
         } else {
             $inst_id = 0;
         }
         $gid = db_insert('soc_studentgroups')->fields(array('name' => $group['name'], 'owner_id' => $uid, 'inst_id' => $inst_id, 'description' => $group['description'] ?: ''))->execute();
         if ($gid) {
             $result = db_insert('soc_user_membership')->fields(array('uid' => $uid, 'type' => _STUDENT_GROUP, 'group_id' => $gid))->execute();
             if ($result) {
                 $result = $result && db_insert('soc_codes')->fields(array('type' => _STUDENT_GROUP, 'code' => createRandomCode(_STUDENT_GROUP, $gid), 'entity_id' => $inst_id, 'studentgroup_id' => $gid))->execute();
                 if (!$result) {
                     drupal_set_message(t('We could not add a code for this group.'), 'error');
                 }
             } else {
                 drupal_set_message(t('We could not add you to this group.'), 'error');
             }
         } else {
             drupal_set_message(t('We could not add your group.'), 'error');
         }
         return $result ? $gid : FALSE;
     } catch (Exception $ex) {
         $txn->rollback();
         drupal_set_message(t('We could not add your group.') . (_DEBUG ? $ex->__toString() : ''), 'error');
     }
     return FALSE;
 }