Ir para conteúdo

Featured Replies

Postado

Não estou conseguindo fazer a verificação de email. Quando vou testar me retorna isso:

atal error: Call to undefined method Form::setAttr() in C:\xampp\htdocs\modules\account_create.php on line 31
 

 

 

<?php
/*
    Copyright (C) 2007 - 2008  Nicaw

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
include ("../include.inc.php");

//retrieve post data
$form = new Form('newaccount');
//check if any data was submited
if ($form->exists()){
    //image verification
    if ($form->validated()){
        //email formating rules
        if (AAC::ValidEmail($form->attrs['email'])){
            if (AAC::ValidEmail($form->attrs['email'])){
                $form->setAttr('email',(string)$form->attrs['email']);
                }else{$error = "This name is already taken.";}
            
/*if (!$link = mysql_connect('localhost', 'root', '6983jean')) {  
  echo 'Não foi possível conectar ao mysql';   
   exit;
   }
   if (!mysql_select_db('otserver', $link)) {  
     echo 'Não foi possível selecionar o banco de dados';   
      exit;
      }
      $email = $_GET['email']; 
      $result = mysql_query("SELECT * FROM accounts WHERE email = '$_GET'");
      if(mysql_num_rows($result) == 1){  
        echo "Email existe";
        echo $result;
        exit;
}else {    
        echo "Email não existe ";
        echo $result;
        exit;
}
*/
        
        
    $account = new Account();
    $account->setAttr('accno', rand(100000,999999)); 
            while ($account->exists());
            //set account atrributes
            $accno = $account->getAttr('accno');
            if ($form->attrs['password'] == $form->attrs['confirm'] && AAC::ValidPassword($form->attrs['password']))
                $password = $form->attrs['password'];
            else
                $password = substr(str_shuffle('qwertyuipasdfhjklzxcvbnm123456789'), 0, 6);
            $account->setPassword($password);
            $account->setAttr('email',$form->attrs['email']);
            //create the account
            $account->save();

            if ($cfg['Email_Validate']){
            $body = "Here is your login information for <a href=\"http://$cfg[server_url]/\">$cfg[server_name]</a><br/>
<b>Account number:</b> $accno<br/>
<b>Password:</b> $password<br/>
<br/>
Powered by <a href=\"http://nicaw.net/\">Nicaw AAC</a>";
            //send the email
            require_once("../extensions/class.phpmailer.php");

            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->IsHTML(true);                
            $mail->Host = $cfg['SMTP_Host'];
            $mail->Port = $cfg['SMTP_Port'];
            $mail->SMTPAuth = $cfg['SMTP_Auth'];
            $mail->Username = $cfg['SMTP_User'];
            $mail->Password = $cfg['SMTP_Password'];

            $mail->From = $cfg['SMTP_From'];
            $mail->AddAddress($form->attrs['email']);

            $mail->Subject = $cfg['server_name'].' - Login Details';
            $mail->Body    = $body;

            if ($mail->Send()){
                    //create new message
                    $msg = new IOBox('message');
                    $msg->addMsg('Your login details were emailed to '.$form->attrs['email']);
                    $msg->addClose('Finish');
                    $msg->show();
                }else
                    $error = "Mailer Error: " . $mail->ErrorInfo;
                    
            }else{
                //create new message
                $msg = new IOBox('message');
                $msg->addMsg('Please write down your login information:');
                $msg->addInput('account','text',$accno,50,true);
                $msg->addInput('password','text',$password,50,true);
                $msg->addMsg('You can now login into your account and start creating characters.');
                $msg->addClose('Finish');
                $msg->show();
                $account->logAction('Created');
            }
        }else{ $error = "Bad email address";}
    }else{ $error = "Image verification failed";}
    if (!empty($error)){
        //create new message
        $msg = new IOBox('message');
        $msg->addMsg($error);
        $msg->addReload('<< Back');
        $msg->addClose('OK');
        $msg->show();
    }
}else{
    //create new form
    $form = new IOBox('newaccount');
    $form->target = $_SERVER['PHP_SELF'];
    $form->addLabel('Create Account');
    $form->addInput('email');
    $form->addInput('password','password');
    $form->addInput('confirm','password');
    $form->addCaptcha();
    $form->addClose('Cancel');
    $form->addSubmit('Next >>');
    $form->show();
}?>

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo