public function sendqueryemails() { $this->prnst(); $quesql = "select * from {{view_sendingqueque}} \n WHERE \n project_id IN (select project_id FROM {{project_master}} WHERE trueup IS NULL or trueup='' or trueup=0 )\n LIMIT 3000"; /*REmoved CONCAT(project_id,'/',panellist_id) NOT IN (SELECT CONCAT(project_id,'/',panellist_id) FROM {{panellist_project}}) And from above query for resend*/ $qrydetail = Yii::app()->db->createCommand($quesql)->query()->readAll(); $created_date = Date('y-m-d h:i:s'); foreach ($qrydetail as $rs) { $internal = getGlobalSetting('Own_Panel'); $internalevendor = 0; $vsql = "select vendor_project_id from {{project_master_vendors}} where project_id = " . $rs['project_id'] . " and vendor_id = {$internal} order by vendor_project_id LIMIT 1 "; $vdetail = Yii::app()->db->createCommand($vsql)->query()->readAll(); foreach ($vdetail as $rsv) { $internalevendor = $rsv['vendor_project_id']; } $pid = $rs['project_id'] * 7; $vpid = $internalevendor * 7; $paid = $rs['panellist_id'] * 7; $gid = $pid . "-" . $vpid . "-" . $paid; $gid = urlencode(base64_encode($gid)); $projecturl = Yii::app()->getBaseUrl(true) . '/capture.php?int=' . $gid; if ($rs['type'] == "Send") { $notassigned = 1; $rsischeck = array(); $qischeck = "SELECT * FROM {{panellist_project}} Where project_id = " . $rs['project_id'] . " and panellist_id = " . $rs['panellist_id'] . ""; $rsischeck = Yii::app()->db->createCommand($qischeck)->query()->readAll(); if (count($rsischeck) > 0) { $notassigned = 0; } if ($notassigned) { $sql_insert = "insert into {{panellist_project}} \n (panellist_id,project_id,project_url,points,status,created_date ) values\n (" . $rs['panellist_id'] . "," . $rs['project_id'] . ",'{$projecturl}'," . $rs['points'] . ",'A','{$created_date}')"; $rString = Yii::app()->db->createCommand($sql_insert)->execute(); $sql_update = "Update {{panel_list_master}} set no_invited = no_invited +1 Where panel_list_id = '" . $rs['panellist_id'] . "'"; $rString = Yii::app()->db->createCommand($sql_update)->execute(); //$reslt = mysql_query($query) or die(mysql_error() . $query); } } //Send email $whitelist = array('127.0.0.1', '::1'); $project_id = $rs['project_id']; $sql_pl = "select * from {{panel_list_master}} where panel_list_id = '" . $rs['panellist_id'] . "' and status ='E'"; //Remove BY Hari //$sql_pl = "select * from {{panel_list_master}} where panel_list_id = '" . $rs['panellist_id'] . "' and status ='E' ORDER BY RAND()";//Add BY Hari $pl_email = Yii::app()->db->createCommand($sql_pl)->queryRow(); if (!in_array($_SERVER['REMOTE_ADDR'], $whitelist)) { $send = get_SendEmail::model()->SendEmailByTemplate($pl_email['email'], EMAIL_POINT_QueryPullSend, $rs['panellist_id'], array('project_id' => "{$project_id}")); } else { $send = get_SendEmail::model()->SendEmailByTemplate($pl_email['email'], EMAIL_POINT_QueryPullSend, $rs['panellist_id'], array('project_id' => "{$project_id}")); echo '</br/>'; } //update it as sent $sql_upd = "update {{query_send_details}} set status = 1, send_date = '{$created_date}' where id = " . $rs['id'] . ""; $rString = Yii::app()->db->createCommand($sql_upd)->execute(); echo "send email" . $rs['type'] . "<br/>"; } $this->prned(); return true; //$this->getController()->redirect(array('/cron/execute/')); }
/** * Forgot Password screen */ public function forgotpassword() { $this->_redirectIfLoggedIn(); if (!Yii::app()->request->getPost('action')) { $this->_renderWrappedTemplate('authentication', 'forgotpassword'); } else { $sEmailAddr = Yii::app()->request->getPost('email'); $aFields = PL::model()->findAllByAttributes(array('email' => $sEmailAddr)); if (count($aFields) < 1) { // wrong or unknown username and/or email $aData['errormsg'] = $this->getController()->lang->gT('Email address not found. Please check the email address you have provided or register for a new account'); $aData['maxattempts'] = ''; $this->_renderWrappedTemplate('authentication', 'error', $aData); } else { $Panellist_id = $aFields[0]['panel_list_id']; $activation_id = generate_random(20); //$activation_link = Yii::app()->getBaseUrl(true) . '/index.php/pl/registration/sa/activate/c/' . $NewPanellist . '*' . $activation_id; $activation_link = Yii::app()->createAbsoluteUrl('pl/registration/sa/activate/c/' . $Panellist_id . '*' . $activation_id); $sql_code = "INSERT INTO {{activation_temp}}\n (panelllist_id,code,activation_type)\n VALUES('{$Panellist_id}','{$activation_id}','forget_pass')"; $result = Yii::app()->db->createCommand($sql_code)->query(); $whitelist = array('127.0.0.1', '::1'); if (!in_array($_SERVER['REMOTE_ADDR'], $whitelist)) { $send = get_SendEmail::model()->SendEmailByTemplate($sEmailAddr, EMAIL_POINT_PL_ForgotPassword, $Panellist_id, array('activation_link' => "{$activation_link}")); } else { echo $send = get_SendEmail::model()->SendEmailByTemplate($sEmailAddr, EMAIL_POINT_PL_ForgotPassword, $Panellist_id, array('activation_link' => "{$activation_link}")); exit; } //$send = get_SendEmail::model()->SendEmailByTemplate($sEmailAddr, EMAIL_POINT_PL_ForgotPassword, $Panellist_id, array('activation_link' => "$activation_link")); if (!$send) { $aData['message'] = 'Error in sending mail'; echo 'Error'; Yii::app()->setFlashMessage($clang->gT("Error in mail send")); } else { $aData['message'] = 'A request to reset your password has just been sent to your email address. This email will come from ' . Yii::app()->getConfig("siteadminemail") . '. Simply click on "Link" within that email to complete your password change. Please take this time to add ' . Yii::app()->getConfig("siteadminemail") . ' to your trusted or safe sender list to ensure that our emails are delivered to your Inbox. If you do not receive this email within 15 minutes, please check your junk/spam folder and Contact Us.'; } $this->_renderWrappedTemplate('authentication', 'message', $aData); } } }
function process() { $aData = array(); $clang = Yii::app()->lang; $aData['Pending'] = false; $aData['success'] = false; $aData['display'] = true; $action = isset($_POST['action']) ? $_POST['action'] : ''; if ($action == 'resend') { $panellist_id = $_POST['panellist_id']; $sql = "SELECT * FROM {{activation_temp}} WHERE panelllist_id = '{$panellist_id}' AND activation_type='reg' AND IsActive = '1'"; $result = Yii::app()->db->createCommand($sql)->query(); $count = $result->rowCount; if ($count > 0) { $sresult = $result->readAll(); $sql = "SELECT * FROM {{panel_list_master}} WHERE panel_list_id = '{$panellist_id}'"; $result = Yii::app()->db->createCommand($sql)->query()->readAll(); $email_address = $result[0]['email']; $pwd = $result[0]['password']; $pwd = base64_decode(urldecode($pwd)); $activation_id = $sresult[0]['code']; //$activation_link = Yii::app()->getBaseUrl(true) . '/index.php/pl/registration/sa/activate/c/' . $panellist_id . '*' . $activation_id; $activation_link = Yii::app()->createAbsoluteUrl('pl/registration/sa/activate/c/' . $panellist_id . '*' . $activation_id); $whitelist = array('127.0.0.1', '::1'); if (!in_array($_SERVER['REMOTE_ADDR'], $whitelist)) { $send = get_SendEmail::model()->SendEmailByTemplate($email_address, EMAIL_POINT_PL_RegistrationReSend, $panellist_id, array('pwd' => "{$pwd}", 'activation_link' => "{$activation_link}")); } else { echo $send = get_SendEmail::model()->SendEmailByTemplate($email_address, EMAIL_POINT_PL_RegistrationReSend, $panellist_id, array('pwd' => "{$pwd}", 'activation_link' => "{$activation_link}")); exit; } //$send = get_SendEmail::model()->SendEmailByTemplate($email_address, EMAIL_POINT_PL_RegistrationReSend, $panellist_id, array('pwd' => "$pwd", 'activation_link' => "$activation_link")); if (!$send) { echo 'Error'; Yii::app()->setFlashMessage($clang->gT("Error in mail send")); } $this->getController()->redirect(array("pl/registration/sa/process")); } else { $aData['success'] = true; } } elseif ($action == 'resetpassword') { $panellist_id = $_POST['panellist_id']; $new_pass = $_POST['password']; $spwd = urlencode(base64_encode($new_pass)); $oRecord = PL::model()->findByPk($panellist_id); $oRecord->password = $spwd; $Panel_id = $oRecord->save(); // $sql = "SELECT * FROM {{view_panel_list_master}} WHERE panel_list_id = '$panellist_id'"; // $sresult = Yii::app()->db->createCommand($sql)->query()->readAll(); // // Yii::app()->session['plid'] = $sresult[0]['panel_list_id']; // Yii::app()->session['plname'] = $sresult[0]['full_name']; // Yii::app()->session['plemail'] = $sresult[0]['email']; // Yii::app()->session['pluser'] = $sresult[0]['first_name']; // Yii::app()->session['session_hash'] = hash('sha256', getGlobalSetting('SessionName') . $sresult[0]['first_name'] . $sresult[0]['panel_list_id']); //$this->_doRedirect(); $this->_redirectToLoginForm(); } //$aData['display']['header'] = false; $this->_renderWrappedTemplate('', 'view_registration', $aData); }