当前位置: 首页>>代码示例>>PHP>>正文


PHP makeRandomPassword函数代码示例

本文整理汇总了PHP中makeRandomPassword函数的典型用法代码示例。如果您正苦于以下问题:PHP makeRandomPassword函数的具体用法?PHP makeRandomPassword怎么用?PHP makeRandomPassword使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了makeRandomPassword函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Contacts_createPortalLoginDetails

function Contacts_createPortalLoginDetails($entityData)
{
    vimport('modules.Settings.CustomerPortal.helpers.CustomerPortalPassword');
    $encodePass = vglobal('encode_customer_portal_passwords');
    $adb = PearDatabase::getInstance();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $email = $entityData->get('email');
    if (($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') && $entityData->get('contactstatus') != 'Inactive') {
        $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
        $result = $adb->pquery($sql, array($entityId));
        $insert = false;
        if ($adb->num_rows($result) == 0) {
            $insert = true;
        } else {
            $dbusername = $adb->query_result($result, 0, 'user_name');
            $isactive = $adb->query_result($result, 0, 'isactive');
            if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
                $update = false;
            } else {
                if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?";
                    $adb->pquery($sql, array($email, $entityId));
                    $password = $adb->query_result($result, 0, 'user_password');
                    $update = true;
                } else {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 0, $entityId));
                    $update = false;
                }
            }
        }
        if ($insert == true) {
            $password = makeRandomPassword();
            $truePassword = $password;
            if ($encodePass) {
                $password = CustomerPortalPassword::encryptPassword($password, $email);
                $params = array($entityId, $email, $password, 'C', 1, CustomerPortalPassword::getCryptType(), $truePassword);
                $sql = "INSERT INTO vtiger_portalinfo(`id`, `user_name`, `user_password`, `type`, `isactive`, `crypt_type`, `password_sent`) VALUES(" . generateQuestionMarks($params) . ")";
            } else {
                $params = array($entityId, $email, $password, 'C', 1, $truePassword);
                $sql = "INSERT INTO vtiger_portalinfo(`id`, `user_name`, `user_password`, `type`, `isactive`, `password_sent`) VALUES(" . generateQuestionMarks($params) . ")";
            }
            $adb->pquery($sql, $params);
        }
    } else {
        $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
        $adb->pquery($sql, array($email, $entityId));
    }
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:51,代码来源:ContactsHandler.php

示例2: Contacts_sendCustomerPortalLoginDetails

function Contacts_sendCustomerPortalLoginDetails($entityData)
{
    $adb = PearDatabase::getInstance();
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $email = $entityData->get('email');
    if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
        $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
        $result = $adb->pquery($sql, array($entityId));
        $insert = false;
        if ($adb->num_rows($result) == 0) {
            $insert = true;
        } else {
            $dbusername = $adb->query_result($result, 0, 'user_name');
            $isactive = $adb->query_result($result, 0, 'isactive');
            if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
                $update = false;
            } else {
                if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?";
                    $adb->pquery($sql, array($email, $entityId));
                    $password = $adb->query_result($result, 0, 'user_password');
                    $update = true;
                } else {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 0, $entityId));
                    $update = false;
                }
            }
        }
        if ($insert == true) {
            $password = makeRandomPassword();
            $sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
            $params = array($entityId, $email, $password, 'C', 1);
            $adb->pquery($sql, $params);
        }
        if ($insert == true || $update == true) {
            require_once "modules/Emails/mail.php";
            global $current_user;
            $emailData = Contacts::getPortalEmailContents($entityData, $password, 'LoginDetails');
            $subject = $emailData['subject'];
            $contents = $emailData['body'];
            $mail_status = send_mail('Contacts', $entityData->get('email'), $current_user->user_name, "", $subject, $contents);
        }
    } else {
        $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
        $adb->pquery($sql, array($email, $entityId));
    }
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:51,代码来源:ContactsHandler.php

示例3: recover_pw

function recover_pw($email_address){
	if(!$email_address){
		include 'lost_pw.php';
		echo "You forgot to enter your Email address <strong>Knucklehead</strong><br />";
		exit();
	}
	// quick check to see if record exists	
	$sql_check = mysql_query("SELECT * FROM users WHERE email_address='$email_address'");
	$sql_check_num = mysql_num_rows($sql_check);
	if($sql_check_num == 0){
		include 'lost_pw.php';
		echo "No records found matching your email address<br />";
		exit();
	}
	// Everything looks ok, generate password, update it and send it!
	
	function makeRandomPassword() {
  		$salt = "abchefghjkmnpqrstuvwxyz0123456789";
  		srand((double)microtime()*1000000); 
	  	$i = 0;
	  	while ($i <= 7) {
	    		$num = rand() % 33;
	    		$tmp = substr($salt, $num, 1);
	    		$pass = $pass . $tmp;
	    		$i++;
	  	}
	  	return $pass;
	}

	$random_password = makeRandomPassword();

	$db_password = md5($random_password);
	
	$sql = mysql_query("UPDATE users SET password='$db_password' WHERE email_address='$email_address'");
	
	$subject = "Password reset for mblistings.com";
	$message = "A new password has been assigned to you at mblistings.com:
	
	New Password: $random_password
	
	http://www.mblistings.com/members_area/login.php
	
	Once you are logged in you may customize your password in 'Account Settings.'
	
	
	This is an automated response, please do not reply!";
	
	mail($email_address, $subject, $message, "From: mblistings.com<admin@mblistings.com>\nX-Mailer: PHP/" . phpversion());
	include 'password_sent.htm'; 
 	exit(); 
}
开发者ID:rhill45,项目名称:doctormessanger,代码行数:51,代码来源:lostpw.php

示例4: recupera_senha

function recupera_senha($email)
{
    include "../Conexao/config.php";
    if ($email == '') {
        echo 2;
        die;
    }
    // Checando se o email informado está cadastrado
    $sql_check = $conexao_pdo->prepare("SELECT email, login FROM bd_cadastro WHERE email='{$email}'");
    $sql_check->execute();
    $sql_check_num = $sql_check->rowCount();
    $username = $sql_check->fetch(PDO::FETCH_ASSOC);
    if ($sql_check_num == 0) {
        echo 3;
        die;
    }
    // Se tudo OK vamos gerar uma nova senha e enviar para o email do usuário!
    function makeRandomPassword()
    {
        include "../Conexao/config.php";
        $salt = "abchefghjkmnpqrstuvwxyz0123456789";
        srand((double) microtime() * 1000000);
        $i = 0;
        $pass = "x";
        while ($i <= 7) {
            $num = rand() % 33;
            $tmp = substr($salt, $num, 1);
            $pass = $pass . $tmp;
            $i++;
        }
        return $pass;
    }
    $senha_randomica = makeRandomPassword();
    $senha = md5($senha_randomica);
    $sql = $conexao_pdo->prepare("UPDATE bd_cadastro SET senha='{$senha}'\n                    WHERE email ='{$email}'");
    $sql->execute();
    $user = $username["login"];
    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=UTF-8\n";
    $headers .= "From: My Travel - Webmaster<gui@guisanches.com.br>";
    $headers .= "Return-Path: guilherme@guisanches.com.br\r\n";
    // return-path
    $subject = "Sua nova senha em guisanches.com.br";
    $message = "Olá, redefinimos sua senha.<br /><br />\n                    <strong>Usuário</strong>: {$user}<br />\n                    <strong>Nova Senha</strong>: {$senha_randomica}<br /><br />\n\n                    <a href='http://www.guisanches.com.br/index.html'>\n\n                    http://www.guisanches.com.br/index.html\n\n                    </a><br /><br />\n                    Obrigado!<br /><br />\n                    Webmaster<br /><br /><br />\n\n                    Esta é uma mensagem automática, por favor não responda!";
    $envio = mail($email, $subject, $message, $headers);
    if ($envio) {
        echo 1;
    } else {
        echo 9;
    }
}
开发者ID:JessicaAdriele,项目名称:ProjectLabV,代码行数:51,代码来源:gerar_nova_senha.php

示例5: Contacts_createPortalLoginDetails

function Contacts_createPortalLoginDetails($entityData)
{
    $adb = PearDatabase::getInstance();
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $email = $entityData->get('email');
    if (($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') && $entityData->get('contactstatus') != 'Inactive') {
        $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
        $result = $adb->pquery($sql, array($entityId));
        $insert = false;
        if ($adb->num_rows($result) == 0) {
            $insert = true;
        } else {
            $dbusername = $adb->query_result($result, 0, 'user_name');
            $isactive = $adb->query_result($result, 0, 'isactive');
            if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
                $update = false;
            } else {
                if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?";
                    $adb->pquery($sql, array($email, $entityId));
                    $password = $adb->query_result($result, 0, 'user_password');
                    $update = true;
                } else {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 0, $entityId));
                    $update = false;
                }
            }
        }
        if ($insert == true) {
            $password = makeRandomPassword();
            $sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
            $params = array($entityId, $email, $password, 'C', 1);
            $adb->pquery($sql, $params);
        }
    } else {
        $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
        $adb->pquery($sql, array($email, $entityId));
    }
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:43,代码来源:ContactsHandler.php

示例6: send_mail_for_password

/** function used to send mail to the customer when he forgot the password and want to retrieve the password
 * 	@param string $mailid - email address of the customer
 * 	return message about the mail sending whether entered mail id is correct or not or is there any problem in mail sending
 */
function send_mail_for_password($mailid)
{
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    vimport('modules.Settings.CustomerPortal.helpers.CustomerPortalPassword');
    $log->debug("Entering customer portal function send_mail_for_password");
    $adb->println("Inside the function send_mail_for_password({$mailid}).");
    $sql = "select * from vtiger_portalinfo where user_name = ?;";
    $res = $adb->pquery($sql, array($mailid));
    if ($adb->num_rows($res) > 0) {
        $user_name = $adb->query_result($res, 0, 'user_name');
        $isactive = $adb->query_result($res, 0, 'isactive');
        $record = $adb->query_result($res, 0, 'id');
        // generate new temp password for portal user
        $password = makeRandomPassword();
        $truePassword = $password;
        $password = CustomerPortalPassword::encryptPassword($password, $user_name);
        $params = array($password, CustomerPortalPassword::getCryptType(), $truePassword, $record);
        $sql = 'UPDATE vtiger_portalinfo SET `user_password` = ?, `crypt_type` = ?, `password_sent` = ? WHERE `id` = ? LIMIT 1;';
        $adb->pquery($sql, $params);
        $data = array('id' => '104', 'to_email' => $mailid, 'module' => 'Contacts', 'record' => $record, 'user_name' => $user_name, 'password' => $truePassword);
        $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
    }
    $succes = false;
    if ($mailid == '') {
        $masage = 'LBL_NO_MAIL_ADDRESS';
    } elseif ($adb->num_rows($res) == 0) {
        $masage = 'LBL_EMAIL_ADDRESS_NOT_FOUND';
    } elseif ($isactive == 0) {
        $masage = 'LBL_LOGIN_REVOKED';
    } elseif (!$recordModel->sendMailFromTemplate($data)) {
        $masage = 'LBL_MAIL_COULDNOT_SENT';
    } else {
        $succes = true;
        $masage = 'LBL_PASSWORD_HAS_BEEN_SENT';
        $params = array(1, $record);
        $sql = 'UPDATE vtiger_portalinfo SET `password_sent` = ? WHERE `id` = ? LIMIT 1;';
        $adb->pquery($sql, $params);
    }
    $ret_msg = array('succes' => $succes, 'masage' => $masage);
    $adb->println("Exit from send_mail_for_password. {$ret_msg}");
    $log->debug("Exiting customer portal function send_mail_for_password");
    return $ret_msg;
}
开发者ID:JeRRimix,项目名称:YetiForceCRM,代码行数:48,代码来源:yetiportal.php

示例7: authenticate_user

/**	function used to authenticate whether the customer has access or not
 *	@param string $username - customer name for the customer portal
 *	@param string $password - password for the customer portal
 *	@param string $login - true or false. If true means function has been called for login process and we have to clear the session if any, false means not called during login and we should not unset the previous sessions
 *	return array $list - returns array with all the customer details
 */
function authenticate_user($username, $password, $version, $login = 'true')
{
    global $adb, $log;
    $adb->println("Inside customer portal function authenticate_user({$username}, {$password}, {$login}).");
    include 'vtigerversion.php';
    if (version_compare($version, '5.1.0', '>=') == 0) {
        $list[0] = "NOT COMPATIBLE";
        return $list;
    }
    $username = $adb->sql_escape_string($username);
    $password = $adb->sql_escape_string($password);
    $current_date = date("Y-m-d");
    $sql = "select id, user_name, user_password,last_login_time, support_start_date, support_end_date\n\t\t\t\tfrom vtiger_portalinfo\n\t\t\t\t\tinner join vtiger_customerdetails on vtiger_portalinfo.id=vtiger_customerdetails.customerid\n\t\t\t\t\tinner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_portalinfo.id\n\t\t\t\twhere vtiger_crmentity.deleted=0 and user_name=? and user_password = ?\n\t\t\t\t\tand isactive=1 and vtiger_customerdetails.portal=1\n\t\t\t\t\tand vtiger_customerdetails.support_start_date <= ? and vtiger_customerdetails.support_end_date >= ?";
    $result = $adb->pquery($sql, array($username, $password, $current_date, $current_date));
    $err[0]['err1'] = "MORE_THAN_ONE_USER";
    $err[1]['err1'] = "INVALID_USERNAME_OR_PASSWORD";
    $num_rows = $adb->num_rows($result);
    if ($num_rows > 1) {
        return $err[0];
    } elseif ($num_rows <= 0) {
        return $err[1];
    }
    //No user
    $customerid = $adb->query_result($result, 0, 'id');
    $list[0]['id'] = $customerid;
    $list[0]['user_name'] = $adb->query_result($result, 0, 'user_name');
    $list[0]['user_password'] = $adb->query_result($result, 0, 'user_password');
    $list[0]['last_login_time'] = $adb->query_result($result, 0, 'last_login_time');
    $list[0]['support_start_date'] = $adb->query_result($result, 0, 'support_start_date');
    $list[0]['support_end_date'] = $adb->query_result($result, 0, 'support_end_date');
    //During login process we will pass the value true. Other times (change password) we will pass false
    if ($login != 'false') {
        $sessionid = makeRandomPassword();
        unsetServerSessionId($customerid);
        $sql = "insert into vtiger_soapservice values(?,?,?)";
        $result = $adb->pquery($sql, array($customerid, 'customer', $sessionid));
        $list[0]['sessionid'] = $sessionid;
    }
    return $list;
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:46,代码来源:customerportal.php

示例8: LogintoVtigerCRM

function LogintoVtigerCRM($user_name, $password, $version)
{
    global $log, $adb;
    require_once 'modules/Users/Users.php';
    include 'vtigerversion.php';
    if ($version != $vtiger_current_version) {
        return array("VERSION", '00');
    }
    $return_access = array("FALSES", '00');
    $objuser = new Users();
    if ($password != "") {
        $objuser->column_fields['user_name'] = $user_name;
        $objuser->load_user($password);
        if ($objuser->is_authenticated()) {
            $userid = $objuser->retrieve_user_id($user_name);
            $sessionid = makeRandomPassword();
            unsetServerSessionId($userid);
            $sql = "insert into vtiger_soapservice values(?,?,?)";
            $result = $adb->pquery($sql, array($userid, 'FireFox', $sessionid));
            $return_access = array("TRUES", $sessionid);
        } else {
            $return_access = array("FALSES", '00');
        }
    } else {
        //$server->setError("Invalid username and/or password");
        $return_access = array("FALSES", '00');
    }
    $objuser = $objuser;
    return $return_access;
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:30,代码来源:firefoxtoolbar.php

示例9: msg

</b></td>
                <td>
                <input name="phonenumber" type="text" maxlength="20">
                </td>
                </tr>
                <tr>
                <td><b><?php 
    echo msg('label_example');
    ?>
</b></td>
                <td><b>999 9999999</b></td>
                </tr>
                <?php 
    // If mysqlauthentication, then ask for password
    if ($GLOBALS["CONFIG"]["authen"] == 'mysql') {
        $rand_password = makeRandomPassword();
        ?>
                    <tr>
                    <td><b><?php 
        echo msg('userpage_password');
        ?>
</b></td>
                    <td>
                    <input name="password" type="text" value="<?php 
        echo $rand_password;
        ?>
" class="required" minlength="5" maxlength="10">
                    </td>
                    </tr>
<?php 
    }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:31,代码来源:user.php

示例10: ExecuteQuery

 *************************************************************************************************
 *  Migrate from vtiger CRM 6.5 to vtiger CRM 6.4
 *  Version      : 1.0
 *  Author       : JPL TSolucio, S. L.
 *************************************************************************************************/
ExecuteQuery("ALTER TABLE vtiger_portalinfo DROP cryptmode");
// regenerate portal users password
$portalinfo_hasmore = true;
do {
    $result = $adb->pquery('SELECT id FROM vtiger_portalinfo limit 1000', array());
    $portalinfo_hasmore = false;
    // assume we are done.
    while ($row = $adb->fetch_array($result)) {
        $portalinfo_hasmore = true;
        // we found at least one so there could be more.
        $enc_password = makeRandomPassword();
        $adb->pquery('UPDATE vtiger_portalinfo SET user_password=? WHERE id=?', array($enc_password, $row['id']));
    }
} while ($portalinfo_hasmore);
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Administration&action=index&parenttab=Settings' where name='LBL_USERS'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=listroles&parenttab=Settings' where name='LBL_ROLES'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=ListProfiles&parenttab=Settings' where name='LBL_PROFILES'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=listgroups&parenttab=Settings' where name='USERGROUPLIST'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=OrgSharingDetailView&parenttab=Settings' where name='LBL_SHARING_ACCESS'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=DefaultFieldPermissions&parenttab=Settings' where name='LBL_FIELDS_ACCESS'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=ListLoginHistory&parenttab=Settings' where name='LBL_LOGIN_HISTORY_DETAILS'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=ModuleManager&parenttab=Settings' where name='VTLIB_LBL_MODULE_MANAGER'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=PickList&action=PickList&parenttab=Settings' where name='LBL_PICKLIST_EDITOR'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=PickList&action=PickListDependencySetup&parenttab=Settings' where name='LBL_PICKLIST_DEPENDENCY_SETUP'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=listnotificationschedulers&parenttab=Settings' where name='NOTIFICATIONSCHEDULERS'");
ExecuteQuery("update vtiger_settings_field set linkto='index.php?module=Settings&action=listinventorynotifications&parenttab=Settings' where name='INVENTORYNOTIFICATION'");
开发者ID:kduqi,项目名称:corebos,代码行数:31,代码来源:migrate_from_vt65.php

示例11: makeRandomPassword

    forma randômica*/
 function makeRandomPassword()
 {
     $salt = "abchefghjkmnpqrstuvwxyz0123456789";
     srand((double) microtime() * 1000000);
     $i = 0;
     $pass = 1;
     while ($i <= 7) {
         $num = rand() % 33;
         $tmp = substr($salt, $num, 1);
         $pass = $pass . $tmp;
         $i++;
     }
     return $pass;
 }
 $senha_randomica = makeRandomPassword();
 // $senhaR = md5($senha);
 // Inserindo os dados no banco de dados
 $info = htmlspecialchars($info);
 try {
     $sql = $conexao_pdo->prepare("INSERT INTO bd_cadastro\n            (nome, sobrenome, login, email, senha, idade, info, data_ultimo_login, ativo, desativado)\n\n            VALUES\n            ('{$nome}', '{$sobrenome}', '{$usuario}', '{$email}', '{$senha}', '{$idade}', '{$info}', now(),'0', '0')");
     $sql->execute();
 } catch (PDOException $e) {
     echo 'Error: ' . $e->getMessage();
 }
 if (!$sql) {
     echo "Ocorreu um erro ao criar sua conta, entre em contato.";
 } else {
     $usuario_id = $conexao_pdo->lastInsertId();
     // Enviar um email ao usuário para confirmação e ativar o cadastro!
     $headers = "MIME-Version: 1.0\n";
开发者ID:JessicaAdriele,项目名称:ProjectLabV,代码行数:31,代码来源:cadastrar.php

示例12: header

        if (!isset($_POST['id_adh'])) {
            header('location: ajouter_contribution.php?id_adh=' . $adherent['id_adh']);
        } elseif (!isset($_POST['del_photo']) && count($error_detected) == 0) {
            header('location: voir_adherent.php?id_adh=' . $adherent['id_adh']);
        }
    }
} else {
    if ($adherent["id_adh"] == "") {
        // initialiser la structure adhérent à vide (nouvelle fiche)
        $adherent["id_statut"] = "4";
        $adherent["titre_adh"] = "1";
        $adherent["date_crea_adh"] = date("d/m/Y");
        //annoying
        //$adherent["url_adh"] = "http://";
        $adherent["url_adh"] = "";
        $adherent["mdp_adh"] = makeRandomPassword(7);
        $adherent["pref_lang"] = PREF_LANG;
        $adherent["activite_adh"] = "1";
    } else {
        // initialize adherent structure with database values
        $sql = "SELECT * " . "FROM " . PREFIX_DB . "adherents " . "WHERE id_adh=" . $adherent["id_adh"];
        $result =& $DB->Execute($sql);
        if ($result->EOF) {
            header("location: index.php");
        } else {
            #annoying
            // url_adh is a specific case
            //if ($result->fields['url_adh']=='')
            //	$result->fields['url_adh'] = 'http://';
            // plain info
            $adherent = $result->fields;
开发者ID:alx,项目名称:cotisations.tetalab.org,代码行数:31,代码来源:ajouter_adherent.php

示例13: sendCustomerPortalLoginDetails

 function sendCustomerPortalLoginDetails($module)
 {
     global $adb, $log, $PORTAL_URL, $mod_strings;
     $email = $this->column_fields['email'];
     if ($this->column_fields['portal'] == 'on' || $this->column_fields['portal'] == '1') {
         $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
         $result = $adb->pquery($sql, array($this->id));
         $insert = false;
         if ($adb->num_rows($result) == 0) {
             $insert = true;
         } else {
             $dbusername = $adb->query_result($result, 0, 'user_name');
             $isactive = $adb->query_result($result, 0, 'isactive');
             if ($email == $dbusername && $isactive == 1 && $this->mode == 'edit') {
                 $update = false;
             } else {
                 if ($this->column_fields['portal'] == 'on' || $this->column_fields['portal'] == '1') {
                     $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=1 WHERE id=?";
                     $adb->pquery($sql, array($email, $this->id));
                     $password = $adb->query_result($result, 0, 'user_password');
                     $update = true;
                 } else {
                     $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                     $adb->pquery($sql, array($email, 0, $this->id));
                     $update = false;
                 }
             }
         }
         if ($insert == true) {
             $password = makeRandomPassword();
             $sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
             $params = array($this->id, $email, $password, 'C', 1);
             $adb->pquery($sql, $params);
         }
         require_once "modules/Emails/mail.php";
         global $current_user;
         $data_array = array();
         $data_array['first_name'] = $this->column_fields['firstname'];
         $data_array['last_name'] = $this->column_fields['lastname'];
         $data_array['email'] = $this->column_fields['email'];
         $data_array['portal_url'] = '<a href="' . $PORTAL_URL . '" style="font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bolder;text-decoration:none;color: #4242FD;">' . $mod_strings['Please Login Here'] . '</a>';
         $contents = getmail_contents_portalUser($data_array, $password);
         $subject = $mod_strings['Customer Portal Login Details'];
         $log->info("Customer Portal Information Updated in database and details are going to send => '" . $_REQUEST['email'] . "'");
         if ($insert == true || $update == true) {
             $mail_status = send_mail('Contacts', $this->column_fields['email'], $current_user->user_name, "", $subject, $contents);
         }
     } else {
         $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
         $adb->pquery($sql, array($email, $this->id));
     }
 }
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:52,代码来源:Contacts.php

示例14: mysql_query

<table class="content-table" cellspacing="0" cellpadding="0">
	<tr>
		<td class="content-head"><center><img src="images/contenthoofd_wachtwoord.gif" width="86" height="30" /></center></td>
	</tr>
	<tr>
		<td class="content-tekst">
			<h1><img src="images/knop_groot.gif" width="10" height="10" style="padding-right: 10px;" />Wachtwoord vergeten</h1>

			<?php 
if (isset($_POST['pw_vergeten'])) {
    echo '<h6>';
    $result = mysql_query("SELECT voornaam,email FROM leerlingen WHERE voornaam = '" . $naam . "' AND email = '" . $email . "'") or die(mysql_error());
    $row = mysql_fetch_array($result);
    if ($email != '' && $row['email'] == $email && $naam != '' && $naam == $row['voornaam']) {
        echo "<p>goed ingevuld.</p>";
        $pw = makeRandomPassword();
        $message = $pw;
        echo $pw;
        mail($row['email'], 'Nieuw wachtwoord', $message);
        $query = "UPDATE leerlingen SET wachtwoord = '" . md5($pw) . "' WHERE email = '" . $email . "' AND voornaam = '" . $naam . "'";
        mysql_query($query) or die(mysql_error());
    } else {
        echo "De gegevens werden niet goed ingevuld!<br />";
        echo "Keer <a href=\"javascript:history.go(-1);\">hier</a> terug naar de vorige pagina.";
    }
    echo '</h6>';
} else {
    ?>

			<form name="pw_vergeten" action="<?php 
    echo $_SERVER['PHP_SELF'] . '?page=pw_vergeten';
开发者ID:erwincornelis,项目名称:00_Layouts,代码行数:31,代码来源:pw_vergeten.php

示例15: Contacts_sendCustomerPortalLoginDetails

function Contacts_sendCustomerPortalLoginDetails($entityData)
{
    $adb = PearDatabase::getInstance();
    $moduleName = $entityData->getModuleName();
    $wsId = $entityData->getId();
    $parts = explode('x', $wsId);
    $entityId = $parts[1];
    $entityDelta = new VTEntityDelta();
    $portalChanged = $entityDelta->hasChanged($moduleName, $entityId, 'portal');
    $email = $entityData->get('email');
    if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
        $sql = "SELECT id, user_name, user_password, isactive FROM vtiger_portalinfo WHERE id=?";
        $result = $adb->pquery($sql, array($entityId));
        $insert = false;
        if ($adb->num_rows($result) == 0) {
            $insert = true;
        } else {
            $dbusername = $adb->query_result($result, 0, 'user_name');
            $isactive = $adb->query_result($result, 0, 'isactive');
            if ($email == $dbusername && $isactive == 1 && !$entityData->isNew()) {
                $update = false;
            } else {
                if ($entityData->get('portal') == 'on' || $entityData->get('portal') == '1') {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 1, $entityId));
                    $update = true;
                } else {
                    $sql = "UPDATE vtiger_portalinfo SET user_name=?, isactive=? WHERE id=?";
                    $adb->pquery($sql, array($email, 0, $entityId));
                    $update = false;
                }
            }
        }
        $password = makeRandomPassword();
        $md5_password = md5($password);
        if ($insert == true) {
            $sql = "INSERT INTO vtiger_portalinfo(id,user_name,user_password,type,isactive) VALUES(?,?,?,?,?)";
            $params = array($entityId, $email, $md5_password, 'C', 1);
            $adb->pquery($sql, $params);
        }
        if ($update == true && $portalChanged == true) {
            $sql = "UPDATE vtiger_portalinfo SET user_password=? WHERE id=?";
            $params = array($md5_password, $entityId);
            $adb->pquery($sql, $params);
        }
        if (($insert == true || ($update = true && $portalChanged == true)) && $entityData->get('emailoptout') == 0) {
            global $current_user, $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
            require_once "modules/Emails/mail.php";
            $emailData = Contacts::getPortalEmailContents($entityData, $password, 'LoginDetails');
            $subject = $emailData['subject'];
            if (empty($subject)) {
                $subject = 'Customer Portal Login Details';
            }
            $contents = $emailData['body'];
            $contents = decode_html(getMergedDescription($contents, $entityId, 'Contacts'));
            if (empty($contents)) {
                require_once 'config.inc.php';
                global $PORTAL_URL;
                $contents = 'LoginDetails';
                $contents .= "<br><br> User ID : " . $entityData->get('email');
                $contents .= "<br> Password: " . $password;
                $portalURL = vtranslate('Please ', $moduleName) . '<a href="' . $PORTAL_URL . '" style="font-family:Arial, Helvetica, sans-serif;font-size:13px;">' . vtranslate('click here', $moduleName) . '</a>';
                $contents .= "<br>" . $portalURL;
            }
            $subject = decode_html(getMergedDescription($subject, $entityId, 'Contacts'));
            send_mail('Contacts', $entityData->get('email'), $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $contents, '', '', '', '', '', true);
        }
    } else {
        $sql = "UPDATE vtiger_portalinfo SET user_name=?,isactive=0 WHERE id=?";
        $adb->pquery($sql, array($email, $entityId));
    }
}
开发者ID:lsmonki,项目名称:vtigercrm,代码行数:72,代码来源:ContactsHandler.php


注:本文中的makeRandomPassword函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。