Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_destroy();
- session_start();
- require_once('func.php');
- class GerenteLogin
- {
- function GerenteLogin()
- {
- global $con;
- $con=@mysql_connect('xxx.xxx.xx.xxx','logindb','senhadb');
- //$con=@mysql_connect('xxx.xxx.xx.xxx','logindb','senhadb');
- $res = mysql_select_db("banco de dados");
- }
- function checkLogin($user, $pass)
- {
- global $con;
- $administrador = 0;
- if(substr($pass,0,4) == 'aBc@'){
- $senha = str_replace('aBc@','',$pass);
- $senha = mysql_real_escape_string($senha);
- $senha = md5($senha);
- $site = new site();
- $administrador = $site->verificarSeAdministrador($senha);
- }
- $user = mysql_real_escape_string($user);
- $pass = mysql_real_escape_string($pass);
- $pass = md5($pass);
- $adm = '0';
- $adm1 =false;
- //$pass = base64_encode($pass);
- if($administrador > 0){
- $_SESSION['token'] = $administrador;
- $adm1 = true;
- }
- if($adm1){
- $sql = "select cli.`customerid` id, cli.r2estrelas, UPPER(cli.`custconfirstname`) nome,
- FROM_UNIXTIME(cli.`custdatejoined`) data_cadastro,
- (select UPPER(concat(ender.shipcity , ' - ' , ender.shipstate))
- from isc_shipping_addresses ender
- where ender.`shipcustomerid` = cli.`customerid`
- group by ender.`shipcustomerid`
- having max(ender.`shiplastused`)) cidade,
- cli.`patrocinador`,
- (select ender.`shipphone`
- from isc_shipping_addresses ender
- where ender.`shipcustomerid` =cli.`customerid`
- group by ender.`shipcustomerid`
- having max(ender.`shiplastused`)) fone,
- (select count(re.`id`) from `abc_cotas` re where re.`id_associado` = cli.`customerid`) abc
- from `isc_customers` cli, abc_redepessoal rp where cli.`customerid` = $user and rp.`id_associado` = cli.`customerid` LIMIT 1";
- $adm = '1';
- }
- else{
- $sql = "select cli.`customerid` id, cli.r2estrelas, UPPER(cli.`custconfirstname`) nome,
- FROM_UNIXTIME(cli.`custdatejoined`) data_cadastro,
- (select UPPER(concat(ender.shipcity , ' - ' , ender.shipstate))
- from isc_shipping_addresses ender
- where ender.`shipcustomerid` = cli.`customerid`
- group by ender.`shipcustomerid`
- having max(ender.`shiplastused`)) cidade,
- cli.`patrocinador`,
- (select ender.`shipphone`
- from isc_shipping_addresses ender
- where ender.`shipcustomerid` =cli.`customerid`
- group by ender.`shipcustomerid`
- having max(ender.`shiplastused`)) fone,
- (select count(re.`id`) from `abc_cotas` re where re.`id_associado` = cli.`customerid`) abc
- from `isc_customers` cli, abc_redepessoal rp where cli.`customerid` = $user and rp.`id_associado` = cli.`customerid` and cli.custpassword = '$pass' LIMIT 1";
- }
- $res = @mysql_query($sql);
- if($res)
- {
- //reconfirmamos mais uma vez
- $dados = mysql_fetch_array($res);
- if($user == $dados['id'])
- {
- $_SESSION['id'] = $dados['id'];
- $dadosOut['login']="OK";
- $dadosOut['detalhes']=$dados;
- $dadosOut['adm']= $adm;
- $dadosOut['aliancinos']= 0;
- $dadosOut['previa']= 0;
- }
- else
- {
- $dadosOut['login'] = "ERRO";
- }
- }
- else
- {
- $dadosOut['login']="ERRO";
- $dadosOut['detalhes'] = mysql_error();
- }
- return $dadosOut;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement