Ir para conteúdo
  • Cadastre-se

(Resolvido)Remover DIV ao acessar a página de Criar Conta


Ir para solução Resolvido por psychonaut,

Posts Recomendados

Muda pra isso, era pra pagina que eu tava pedindo, que era a do formulario existir, mas acho que esse sistema é bem diferente, bem, vamos la:
controllers/account.php

<?php
/* 
+I.D.E ENGINE+
Controller of Account for Modern AAC - Powered by IDE Engine.
A lot of new functionality and variables can be hard-coded here.
If you do NOT understand the code, do NOT change anything in here.
*/
	
	class Account extends Controller {
	
		/* Main index of Account controllers, also work as a __construct(); It is called by engine as a default. */
		function index($action = 0) {
			if($action == 1) success("Your new character has been created!");
			if($action == 2) success("Your nickname has been set! Thank you!");
			if($action == 3) success("You have exceded the maximum amount of characters per account.");
			if($action == 4) success("Your profile has been updated.");
			if($action == 5) success("Your avatar has been updated!");
			$this->load->model("Account_model");
			if(empty($_SESSION['account_id'])) $_SESSION['account_id'] = $this->Account_model->getAccountID();
			$ide = new IDE;
			$ide->requireLogin();
			if(empty($_SESSION['nickname'])) $ide->redirect(WEBSITE."/index.php/account/setNickname");
			$data = array();
			$data['loggedUser'] = $_SESSION['name'];
			$data['characters'] = $this->Account_model->getCharacters();
			$data['messages'] = $this->Account_model->checkMessages();
			$ots = POT::getInstance();
			$ots->connect(POT::DB_MYSQL, connection());
			$account = $ots->createObject('Account');
			try { $account->find($_SESSION['name']); } catch(Exception $e) {show_error('There was a problem during loading account. Err code: 220212072010 Futher details: '.$e->getMessage());}
			$data['account'] = $account;
			$data['acc'] = $this->Account_model->load($_SESSION['account_id']);
			$recovery_key = $this->Account_model->getRecoveryKey($_SESSION['name']);
			if($recovery_key === "") alert("Você não possui um recovery key. Clique <a href='".WEBSITE."/index.php/account/generate_recovery_key'><b>aqui</b></a> para criar um. Recomendamos que guarde o código em um lugar seguro.");
			/* Load view of account page and send data to it. */
			$this->load->view('account', $data);
		}
		
		/*
		Function to check if account with this name already exists, it is used by create controller as a callaback in form validation. 
		It should be made as an abstract class of database in Model, but I don't think there is point of it.
		*/
		function _account_exists($name) {
			$ots = POT::getInstance();
			$ots->connect(POT::DB_MYSQL, connection());
			$account = new OTS_Account();
			try { $account->find($name); } catch(Exception $e) {show_error('There was a problem during loading account. Err code: 220512072010 Futher details: '.$e->getMessage());}
			if($account->isLoaded()) { $this->form_validation->set_message('_account_exists', 'Account with this name already exists.');return false;} else return true;
		}
		
		function _checkCaptcha($word) { 
            /*if(strtolower($word) == strtolower($_SESSION['captcha']) && !empty($_SESSION['captcha'])) { 
                return true; 
            } 
            else { 
                $this->form_validation->set_message('_checkCaptcha', 'Captcha word is incorrect.'); 
                return false;
			}*/
            return true; 
        }
		
		function _nicknameExists($name) {
			$this->load->model("account_model");
			if($this->account_model->nicknameExists($name)) {
				$this->form_validation->set_message('_nicknameExists', 'This nickname already exists!.');
				return false;
			}
			else
				return true;
		}
		function _emailExists($email) {
			$this->load->model("account_model");
			if($this->account_model->emailExists($email)) {
				$this->form_validation->set_message('_emailExists', 'This email is already used by another account already exists!');
				return false;
			}
			else
				return true;
		}
		
		function _characterExists($name) {
			$this->load->model("character_model");
			if($this->character_model->characterExists($name)) {
				$this->form_validation->set_message('_characterExists', 'This character name already exists, please choose another one!');
				return false;
			}
			else
				return true;
		}
		
		function _checkDelay() {
			global $config;
			if(!isset($_SESSION['accountDelay'])) $_SESSION['accountDelay'] = 0;
			if($config['accountDelay']) {
				if(@(time()-$_SESSION['accountDelay']) > 240) {
					return true;
				}
				else {
					$this->form_validation->set_message('_checkDelay', 'You cannot create another account just after another. Please wait few minutes.');
					return false;
				}
			}
			else
				return true;
		}
		
	function _checkCity($id) {
		$this->config->load('create_character.php');
		if(!array_key_exists($id, $this->config->item('cities'))) {
			$this->form_validation->set_message('_checkCity', 'Unknown City');
			return false;
		}
		else
			return true;
	}
	
	function _checkWorld($id) {
		$this->config->load('create_character.php');
		if(!array_key_exists($id, $this->config->item('worlds'))) {
			$this->form_validation->set_message('_checkWorld', 'Unknown World');
			return false;
		}
		else
			return true;
	}
	
	function _checkVocation($id) {
		$this->config->load('create_character.php');
		if(!array_key_exists($id, $this->config->item('vocations'))) {
			$this->form_validation->set_message('_checkVocation', 'Unknown Vocation');
			return false;
		}
		else
			return true;
	}
	
	function _checkSex($id) {
		if($id != 0 and $id != 1) {
			$this->form_validation->set_message('_checkSex', 'Unknown Sex');
			return false;
		}
		else
			return true;
	}
	
	function _validName($name) {
		require("config.php");
		$name = explode(" ", $name);
			foreach($name as $unit) {
				if(in_array(strtolower($unit), $config['invalidNameTags'])) {
					$this->form_validation->set_message('_validName', 'Invalid Name');
					return false;
				}
				else if(strlen($unit) == 1) {
					$this->form_validation->set_message('_validName', 'Invalid Name');
					return false;
				}
				else
					continue;
			}
	}
	
	// Function which make the player more real by tatu hunter
	// Eg: elder'Druid = Elder'Druid
	//	   elder'druid = Elder'druid
	//     druid theMaster = Druid themaster
	function strFirst($name) {
		$name = explode(' ', trim($name));
		for($i=0, $t = sizeof($name); $i<$t; ++$i)
			for($j=0, $l=strlen($name[$i]); $j<$l; ++$j)
				!$j ? 
				($name[$i][$j] = !$i ? ($name[$i][$j] == strtoupper($name[$i][$j]) ? $name[$i][$j] : strtoupper($name[$i][$j])): $name[$i][$j])  : 
				($name[$i][$j] = ($name[$i][$j-1] == '\'' ? $name[$i][$j] : 
				strtolower($name[$i][$j])));
	
		$ret = '';
		foreach($name as $k)
			$ret .= $k . ' ';
	
		return trim($ret);
	}

		/* Controller of creating new account. New values can be hard-coded here. (only experienced users) */
		function create($ajax = 0) {
			require_once("system/application/config/create_character.php");
			$ide = new IDE;
			global $config;
			if($ajax == 1 && $ide->isLogged()) exit;
			if($ide->isLogged()) $ide->redirect(WEBSITE.'/index.php/account');
			$this->load->plugin('captcha');
			$this->load->helper('form');
			
			$vals = array(
					'word'		 => '',
					'img_path'	 => 'system/captcha/',
					'img_url'	 => WEBSITE.'/system/captcha/',
					'font_path'	 => WEBSITE.'/system/fonts/texb.ttf',
					'img_width'	 => '156',
					'img_height' => 30,
					'expiration' => 120
				);
			if(!$_POST && $ajax == 0) {
				$cap = create_captcha($vals);	
			}
			if($_POST) {
				$this->load->library('form_validation');
				$_POST['nickname'] = ucfirst(strtolower($_POST['nickname']));
				$this->form_validation->set_rules('name', 'Account Name', 'required|min_length[4]|max_length[32]|callback__account_exists|alpha_numeric|callback__checkDelay');
				$this->form_validation->set_rules('nickname', 'Nickname', 'required|min_length[4]|max_length[32]|callback__nicknameExists');
				$this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
				$this->form_validation->set_rules('email', 'Email', 'required|valid_email|callback__emailExists');
				$this->form_validation->set_rules('character_name', 'Character Name', 'required|min_length[4]|max_length[32]|nickname|callback__characterExists|callback__validName');
				$this->form_validation->set_rules('city', 'City', 'required|integer|callback__checkCity');
				$this->form_validation->set_rules('world', 'World', 'required|integer|callback__checkWorld');
				$this->form_validation->set_rules('vocation', 'Vocation', 'required|integer|callback__checkVocation');
				$this->form_validation->set_rules('sex', 'Sex', 'required|integer|callback__checkSex');
				/*$this->form_validation->set_rules('captcha', 'Captcha', 'required|callback__checkCaptcha');*/
				if($this->form_validation->run() == TRUE) {
					require(APPPATH.'config/ide_default.php');
					$ots = POT::getInstance();
					$ots->connect(POT::DB_MYSQL, connection());
					$account = new OTS_Account();
					$name = $account->createNamed($_POST['name2']);
					$account->setPassword(sha1($_POST['password']));
					$account->setEmail($_POST['email']);
					$account->setCustomField('nickname', $_POST['nickname']);
					$account->setCustomField('premdays', PREMDAYS);
					$account->setCustomField('lastday', $_SERVER['REQUEST_TIME']);
					try {
						$account->save();
						unset($account);
						$_SESSION['logged'] = 1;
						$_SESSION['name'] = $_POST['name2'];
						$_SESSION['nickname'] = $_POST['nickname'];
						$_SESSION['accountDelay'] = time();
						
						$account = $ots->createObject('Account');
						$account->find($_POST['name2']);
						
						$sample = new OTS_Player();
						$sample->find($config['newchar_vocations'][$_POST['world']][$_POST['vocation']]);
						if(!$sample->isLoaded()) {	show_error('Sample character could not be found!'); }
						
						// Create new character
						$player = $ots->createObject('Player');
						$player->setName($this->strFirst($_POST['character_name']));
                		$player->setAccount($account);
						$player->setWorld($_POST['world']);
                		$player->setGroup($sample->getGroup());
                		$player->setSex($_POST['sex']);
                		$player->setVocation($sample->getVocation());
                		$player->setConditions($sample->getConditions());
               		 	$player->setRank($sample->getRank());
               		 	$player->setLookAddons($sample->getLookAddons());
                		$player->setTownId($_POST['city']);
                		$player->setExperience($sample->getExperience());
                		$player->setLevel($sample->getLevel());
                		$player->setMagLevel($sample->getMagLevel());
                		$player->setHealth($sample->getHealth());
                		$player->setHealthMax($sample->getHealthMax());
                		$player->setMana($sample->getMana());
                		$player->setManaMax($sample->getManaMax());
                		$player->setManaSpent($sample->getManaSpent());
                		$player->setSoul($sample->getSoul());
                		$player->setDirection($sample->getDirection());
                		$player->setLookBody($sample->getLookBody());
                		$player->setLookFeet($sample->getLookFeet());
                		$player->setLookHead($sample->getLookHead());
                		$player->setLookLegs($sample->getLookLegs());
                		$player->setLookType($sample->getLookType());
                		$player->setCap($sample->getCap());
						$player->setPosX($startPos['x']);
               			$player->setPosY($startPos['y']);
                		$player->setPosZ($startPos['z']);
                		$player->setLossExperience($sample->getLossExperience());
                		$player->setLossMana($sample->getLossMana());
                		$player->setLossSkills($sample->getLossSkills());
                		$player->setLossItems($sample->getLossItems());
						$player->setLossContainers($sample->getLossContainers());
                		$player->save();
						$_SESSION['characterDelay'] = $_SERVER['REQUEST_TIME'];
						unset($player);
                		$player = $ots->createObject('Player');
                		$player->find($_POST['character_name']);
						if($player->isLoaded())
                		{
                    		$player->setSkill(0,$sample->getSkill(0));
                    		$player->setSkill(1,$sample->getSkill(1));
                    		$player->setSkill(2,$sample->getSkill(2));
                    		$player->setSkill(3,$sample->getSkill(3));
                    		$player->setSkill(4,$sample->getSkill(4));
                    		$player->setSkill(5,$sample->getSkill(5));
                    		$player->setSkill(6,$sample->getSkill(6));
                    		$player->save();
							$SQL = POT::getInstance()->getDBHandle();
                    		$loaded_items_to_copy = $SQL->query("SELECT * FROM player_items WHERE player_id = ".$sample->getId()."");
                    		foreach($loaded_items_to_copy as $save_item)
								$SQL->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
						
							if($ajax == 0)
								$ide->redirect(WEBSITE.'/index.php/account');
							else
								$ide->criticalRedirect(WEBSITE.'/index.php/account');
						}
					}
					catch(Exception $e) {
						error($e->getMessage());
					}
				}
				else {
					if($ajax == 0) $cap = create_captcha($vals);
				}
			}
			if($ajax == 0) {
				$_SESSION['captcha'] = $cap['word'];
				$data['captcha'] = $cap['image'];
			}
			#Load view of creating account
			if($ajax == 1) {
				echo error(validation_errors());
				$ide->system_stop();
			}
			else {
				$this->load->view('create', $data);
			}
		}
		
		/* Function to check if passed login and password are correct, it uses abstract database model. */
		function _check_login() {
			$this->load->model("Account_model");
			if($this->Account_model->check_login() == false) {
				$this->form_validation->set_message("_check_login", "Account name or password are incorrect.");
				return false;
			}
			else
				return true;
		}
		
		/* Login controller  */
		function login($action = 0) {
			if((int) $action == 1) success("You have been logged out.");
			if((int) $action == 2) success("Your account has been recovered. You may login now.");
			$ide = new IDE;
			$this->load->helper("form");
			$this->load->library("form_validation");
			if($_POST) {
				$this->form_validation->set_rules('name', 'Account Name', 'required|callback__check_login');
				$this->form_validation->set_rules('pass', 'Password', 'required');
				if(in_array($_POST['name2'], $GLOBALS['config']['restrictedAccounts']))
					error("The account you try to access is restricted!");
				else {
					if($this->form_validation->run() == true) {
						$_SESSION['logged'] = 1;
						$_SESSION['name'] = $_POST['name2'];
						if(!empty($_SESSION['forward'])) {
							$forward = $_SESSION['forward'];
							$_SESSION['forward'] = "";
							$ide->redirect($forward);
						}
						else 
							$ide->redirect(WEBSITE.'/index.php/account');
					
					}
				}
			}
			/* Load view of login page. */
			$this->load->view("login");
			
		}
		/* Function to logout from account. */
		function logout() {
			$ide = new IDE;
			$_SESSION['logged'] = '';
			$_SESSION['account_id'] = '';
			$_SESSION['name'] = '';
			$_SESSION['admin'] = 0;
			$_SESSION['forward'] = "";
			$ide->redirect('login/1');
		}
		
		/* Controller to generate random recovery key and save it, accessed by user, only once per account. */
		function generate_recovery_key() {
			$this->load->helper("form");
			$ide = new IDE;
			$ide->requireLogin();
			$this->load->model("Account_model");
			if($this->Account_model->getRecoveryKey($_SESSION['name']) != '') $ide->redirect('../account');
			if($_POST) {
				$data['info'] = '';
				$key = $this->Account_model->generateKey($_SESSION['name']);
				success("<center><font size='4'>$key</font></center>");
				alert("<b>Salve esta chave de recuperação, você verá esta key apenas uma vez! Você nunca vai vê-lo novamente, não atualize o site enquanto você não salvar a chave de recuperação!</b>");
			}
			else
				$data['info'] = '<center id=\'info\'><b>Pressione o botão abaixo para gerar seu Recovery Key. <br>Lembre-se de guardar bem, pois você só poderá retirar uma única vez!</b></center><br><center><input type=\'submit\' value=\'Gerar\' name=\'submit\'></center>';
				/* Load view of generating new recovery key. */
				$this->load->view('generate_recovery_key', $data);
		}
		
		function _checkCurrentPassword($pass) {
			$this->load->model("account_model");
			if($this->account_model->checkPassword($pass)) 
				return true;
			else {
				$this->form_validation->set_message("_checkCurrentPassword", "Current password is incorrect.");
				return false;
			}
		}
		
		function changepassword() {
			$ide = new IDE;
			$ide->requireLogin();
			$this->load->helper("form_helper");
			if($_POST) {
				$this->load->library("form_validation");
				$this->form_validation->set_rules('current', 'Current Password', 'required|callback__checkCurrentPassword');
				$this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
				if($this->form_validation->run() == true) {
					$this->load->model("account_model");
					$this->account_model->changePassword($_POST['password'], $_SESSION['name']);
					success("Your password has been changed.");
					$ide->redirect(WEBSITE."/index.php/account", 2);
				}
			}
			$this->load->view("changepassword");
		}
		
		function editcomment($id) {
			$ide = new IDE;
			$ide->requireLogin();
			if(empty($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->load->model("account_model");
			if(!$this->account_model->isUserPlayer($id)) $ide->redirect(WEBSITE."/index.php/account");
			$data['id'] = $id;
				if($_POST) {
					$this->load->library("form_validation");
						$this->form_validation->set_rules('comment', 'Comment', 'max_length[255]|alpha_ide');
					if($this->form_validation->run() == true) {
						if(@$_POST['hide'] == 1)
							$this->account_model->changeComment($id, $_POST['comment'], true);
						else
							$this->account_model->changeComment($id, $_POST['comment'], false);
						success("Your comment has been changed.");
						$ide->redirect(WEBSITE."/index.php/account", 2);
					}
				}
			$data['comment'] = $this->account_model->getPlayerComment($id);
			$this->load->helper("form_helper");
			$this->load->view("edit_comment", $data);
		}
		
		function deletePlayer($id) {
			$ide = new IDE;
			$ide->requireLogin();
			$id = (int)$id;
			if(empty($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->load->model("account_model");
			if(!$this->account_model->isUserPlayer($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->account_model->deletePlayer($id);
			$ide->redirect(WEBSITE."/index.php/account");
		}
		
		function undeletePlayer($id) {
			$ide = new IDE;
			$ide->requireLogin();
			$id = (int)$id;
			if(empty($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->load->model("account_model");
			if(!$this->account_model->isUserPlayer($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->account_model->undeletePlayer($id);
			$ide->redirect(WEBSITE."/index.php/account");
		}
		
		public function setNickname() {
			$ide = new IDE;
			$ide->requireLogin();
			if(!empty($_SESSION['nickname'])) $ide->goPrevious();
			$this->load->helper("form_helper");
				if($_POST) {
					$_POST['nickname'] = ucfirst(strtolower($_POST['nickname']));
					$this->load->library("form_validation");
					$this->form_validation->set_rules('nickname', 'Nickname', 'required|min_length[4]|max_length[32]|nickname|callback__nicknameExists');
					$this->form_validation->set_rules('rules', 'Rules', 'required');
					if($this->form_validation->run()) {
						$this->load->model("account_model");
						$this->account_model->setNickname($ide->loggedAccountId(), $_POST['nickname']);
						$_SESSION['nickname'] = $_POST['nickname'];
						$ide->redirect(WEBSITE."/index.php/account/index/2");
					}
				}
			$this->load->view("setNickname");
			
		}
		
		function _validKey($key) {
			$this->load->model("account_model");
			$_POST['key'] = str_replace("-", "", $_POST['key']);
			if($this->account_model->checkKey($_POST['key'], $_POST['email'])) {
				return true;
			}
			else {
				$this->form_validation->set_message("_validKey", "Could not change password. Make sure email and recovery key are valid.");
				return false;
			}
		}
		
		public function lost() {
			$ide = new IDE;
			$this->load->helper("form_helper");
				if($_POST) {
					$_POST['key'] = str_replace("-", "", $_POST['key']);
				
					$this->load->library("form_validation");
					$this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
					$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
					$this->form_validation->set_rules('key', 'Recovery Key', 'required|callback__validKey');
					
					if($this->form_validation->run()) {
						$this->load->model("account_model");
						$this->account_model->recoveryAccount($_POST['key'], $_POST['email'], $_POST['password']);
						$ide->redirect(WEBSITE."/index.php/account/login/2");
					}
				}
			$this->load->view("account_lost");
		}
		
	}

?
Editado por rogaforyn2 (veja o histórico de edições)

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites
Conteúdo removido. Editado por bhelliip (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Usa o controllers/account.php antigo, o seu, e no index.tpl, deixa o name como "name", como estava antes.
Aí vai no código que eu passei, depois do </style>, coloca

<script>
var field = document.getElementById("bar_login");
field.id = "shabdgdfg"; 
field.setAttribute("name", "fdgdfgfdg");
var field2 = document.getElementById("bar_password");
field2.id = "asdsaaaa"; 
field2.setAttribute("name", "xzcczxczxc");
</script>

 

Isso vai tirar o conflito, pois não teram nomes iguais, caso de algum aviso erro, por não ter com aquele nome pra fazer login, é só usar
<?php
error_reporting(E_ERROR | E_PARSE);
?>
Para ocultar. Editado por rogaforyn2 (veja o histórico de edições)

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites
Conteúdo removido. Editado por bhelliip (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Tenta assim, mas não era pra criação de contas mudar, isso acontece quando você aperta pra criar?
 

<style>
#radar {
    visibility: hidden;
}
</style>
<?php
	error_reporting(E_ERROR | E_PARSE);
?>
<div class='errors'> <?php echo error(validation_errors()); ?> </div>
<?php include("public/js/keyboard.php");
global $config;
?>
<script>
	var field = document.getElementById("bar_login");
	field.id = "shabdgdfg"; 
	field.setAttribute("name", "fdgdfgfdg");
	var field2 = document.getElementById("bar_password");
	field2.id = "asdsaaaa"; 
	field2.setAttribute("name", "xzcczxczxc");
</script>
<script>
	function createAccount() {
		$('.loader').show();
		var form = $('#createAccount').serialize();
		$.ajax({
			url: '<?php echo WEBSITE; ?>/index.php/account/create/1',
			  type: 'post',
			  data: form,
			  success: function(data) {
			  	$('.errors').html(data);
			  	$('.loader').hide();
			  }
		});
	}
</script>
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE; ?>/public/css/keyboard.css">
<div class='message'>
	<div class='title'>Criação De Conta</div>
	<div class='content'> <?php echo form_open('account/create', array('id'=>'createAccount')); ?>
		<fieldset>
			<legend>Informações Da Conta</legend>
			<!-- Tabela da conta -->
			<table>
				<tbody>
					<tr>
						<td><label for="name">Login:</label></td>
						<td><input type="text" value="<?php echo set_value('name'); ?>" id="name" class="keyboardInput" name="name"/></td>
					</tr>
					<tr>
						<td><label for="nickname">Apelido:</label></td>
						<td><input type='text' name='nickname' id="nickname" value='<?php echo set_value('nickname'); ?>' /></td>
					</tr>
					<tr>
						<td><label for="email">E-mail:</label></td>
						<td><input type="text" value="<?php echo set_value('email'); ?>" id="email" name="email"/></td>
					</tr>
					<tr>
						<td><label for="password">Senha:</label></td>
						<td><input type="password" class="keyboardInput" id="password" name="password"/></td>
					</tr>
					<tr>
						<td><label for="repeat">Repita a Senha:</label></td>
						<td><input type="password" class="keyboardInput" id="repeat" name="repeat"/></td>
					</tr>
				</tbody>
			</table>
		</fieldset>
		<table>
			<tr>
				<td>&nbsp;</td>
			</tr>
		</table>
		<fieldset>
			<legend>Informações Do Personagem</legend>
			<!-- Tabela do personagem -->
			<table>
				<tbody>
					<tr>
						<td><label for="character_name">Nick:</label></td>
						<td><input size="19" type="text" id="character_name" value="<?php echo set_value('character_name'); ?>" name="character_name"/></td>
					</tr>
					<tr>
						<td><label for="sex">Gênero:</label></td>
						<td>
							<input name="sex" type="radio" id="sex" value="1" checked="checked" />
								Masculino &nbsp;
							<input type="radio" id="sex" name="sex" value="0" />
								Feminino 
						</td>
					</tr>
					<tr>
						<td><label for="vocation">Vocação:</label></td>
						<td>
							<select name="vocation" class="keyboardInput" id="vocation">
								<option value="1">Goku</option>
								<option value="17">Vegeta</option>
								<option value="32">Piccolo</option>
								<option value="45">C17</option>
								<option value="57">Gohan</option>
								<option value="71">Trunks</option>
								<option value="83">Cell</option>
								<option value="95">Freeza</option>
								<option value="111">Majin Boo</option>
								<option value="127">Broly</option>
								<option value="140">C18</option>
								<option value="152">Uub</option>
								<option value="164">Goten</option>
								<option value="178">Chibi Trunks</option>
								<option value="192">Cooler</option>
								<option value="206">Dende</option>
								<option value="218">Tsuful</option>
								<option value="230">Bardock</option>
								<option value="244">Kuririn</option>
								<option value="256">Pan</option>
								<option value="268">Kaio</option>
								<option value="280">Videl</option>
								<option value="292">Janemba</option>
								<option value="304">Tenshinhan</option>
								<option value="316">Jenk</option>
								<option value="328">Raditz</option>
								<option value="340">C16</option>
								<option value="352">Turles</option>
								<option value="364">Bulma</option>
							</select>
						</td>
					</tr>
					<tr>
						<td><label for="city">Cidade:</label></td>
						<td>
							<select name="city" id="city">
								<?php 
									foreach($config['cities'] as $city => $name)  
									echo '<option value="'.$city.'">'.$name.'</option>'; 
								?>
							</select>
						</td>
					</tr>
					<tr>
						<td><label for="world">Mundo:</label></td>
						<td>
							<select name="world" id="world">
							<?php
								foreach($config['worlds'] as $world => $name)  
								echo '<option value="'.$world.'">'.$name.'</option>'; 
							?>
							</select>
						</td>
					</tr>
				</tbody>
			</table>
		</fieldset>
		<p align="center"><b>Ao se registrar, você estará aceitando as regras do jogo, leia-as clicando em <a href='#' onClick='$("#rules").toggle(500);'><em><font color="red">Regras</font></em></a>.</b></p>
		<div id='rules' style='margin-top: 10px; width: 100%; height: 300px; overflow: auto; display: none; padding-right: 5px;'><?php echo nl2br(getContent("system/rules.php")); ?></div>
		<br />
		<center><button class="btn btn-success" type="submit">Registrar-se</button>
		<?php loader(); ?></center>
	</div>
</div>

  Editado por rogaforyn2 (veja o histórico de edições)

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites
Conteúdo removido. Editado por bhelliip (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

Resolvido via inbox pra não causar spam. Pra quem tiver o mesmo erro:

index.tpl

<div id="vt_panel_buttons">
	<a href="http://www.mediafire.com/download/l8w9udq59ziv9ll/DBZOnline.exe" target="_blank" class="button">
		 <span></span>
	</a>
	<a href="{$path}/index.php/p/v/gifts" class="button2"></a>
</div>
<div id="radar">
	{if $logged == 1}
		<form action="{$path}/index.php/account/" method="post"></form>
	{else}
		<form action="{$path}/index.php/account/login.ide" method="post">
			<br/><br/><br/><br/>
			<span id="login_radar">Account</span>
			<input type="password" maxlength="25" id="bar_login" name="name"/>
			<br/>
			<span id="password_radar">Password</span>
			<input type="password" maxlength="25" id="bar_password" name="pass"/>
			<br/>
			<input type="Submit" id="bottom_login" name="Submit" value="LOGIN" />
			<a href="{$path}/index.php/account/create" id="bottom_register">&nbsp;Registrar&nbsp;</a>
		</form>
	{/if}
</div

controllers/account.php
<?php
/* 
+I.D.E ENGINE+
Controller of Account for Modern AAC - Powered by IDE Engine.
A lot of new functionality and variables can be hard-coded here.
If you do NOT understand the code, do NOT change anything in here.
*/
	
	class Account extends Controller {
	
		/* Main index of Account controllers, also work as a __construct(); It is called by engine as a default. */
		function index($action = 0) {
			if($action == 1) success("Your new character has been created!");
			if($action == 2) success("Your nickname has been set! Thank you!");
			if($action == 3) success("You have exceded the maximum amount of characters per account.");
			if($action == 4) success("Your profile has been updated.");
			if($action == 5) success("Your avatar has been updated!");
			$this->load->model("Account_model");
			if(empty($_SESSION['account_id'])) $_SESSION['account_id'] = $this->Account_model->getAccountID();
			$ide = new IDE;
			$ide->requireLogin();
			if(empty($_SESSION['nickname'])) $ide->redirect(WEBSITE."/index.php/account/setNickname");
			$data = array();
			$data['loggedUser'] = $_SESSION['name'];
			$data['characters'] = $this->Account_model->getCharacters();
			$data['messages'] = $this->Account_model->checkMessages();
			$ots = POT::getInstance();
			$ots->connect(POT::DB_MYSQL, connection());
			$account = $ots->createObject('Account');
			try { $account->find($_SESSION['name']); } catch(Exception $e) {show_error('There was a problem during loading account. Err code: 220212072010 Futher details: '.$e->getMessage());}
			$data['account'] = $account;
			$data['acc'] = $this->Account_model->load($_SESSION['account_id']);
			$recovery_key = $this->Account_model->getRecoveryKey($_SESSION['name']);
			if($recovery_key === "") alert("Você não possui um recovery key. Clique <a href='".WEBSITE."/index.php/account/generate_recovery_key'><b>aqui</b></a> para criar um. Recomendamos que guarde o código em um lugar seguro.");
			/* Load view of account page and send data to it. */
			$this->load->view('account', $data);
		}
		
		/*
		Function to check if account with this name already exists, it is used by create controller as a callaback in form validation. 
		It should be made as an abstract class of database in Model, but I don't think there is point of it.
		*/
		function _account_exists($name) {
			$ots = POT::getInstance();
			$ots->connect(POT::DB_MYSQL, connection());
			$account = new OTS_Account();
			try { $account->find($name); } catch(Exception $e) {show_error('There was a problem during loading account. Err code: 220512072010 Futher details: '.$e->getMessage());}
			if($account->isLoaded()) { $this->form_validation->set_message('_account_exists', 'Account with this name already exists.');return false;} else return true;
		}
		
		function _checkCaptcha($word) { 
            /*if(strtolower($word) == strtolower($_SESSION['captcha']) && !empty($_SESSION['captcha'])) { 
                return true; 
            } 
            else { 
                $this->form_validation->set_message('_checkCaptcha', 'Captcha word is incorrect.'); 
                return false;
			}*/
            return true; 
        }
		
		function _nicknameExists($name) {
			$this->load->model("account_model");
			if($this->account_model->nicknameExists($name)) {
				$this->form_validation->set_message('_nicknameExists', 'This nickname already exists!.');
				return false;
			}
			else
				return true;
		}
		function _emailExists($email) {
			$this->load->model("account_model");
			if($this->account_model->emailExists($email)) {
				$this->form_validation->set_message('_emailExists', 'This email is already used by another account already exists!');
				return false;
			}
			else
				return true;
		}
		
		function _characterExists($name) {
			$this->load->model("character_model");
			if($this->character_model->characterExists($name)) {
				$this->form_validation->set_message('_characterExists', 'This character name already exists, please choose another one!');
				return false;
			}
			else
				return true;
		}
		
		function _checkDelay() {
			global $config;
			if(!isset($_SESSION['accountDelay'])) $_SESSION['accountDelay'] = 0;
			if($config['accountDelay']) {
				if(@(time()-$_SESSION['accountDelay']) > 240) {
					return true;
				}
				else {
					$this->form_validation->set_message('_checkDelay', 'You cannot create another account just after another. Please wait few minutes.');
					return false;
				}
			}
			else
				return true;
		}
		
	function _checkCity($id) {
		$this->config->load('create_character.php');
		if(!array_key_exists($id, $this->config->item('cities'))) {
			$this->form_validation->set_message('_checkCity', 'Unknown City');
			return false;
		}
		else
			return true;
	}
	
	function _checkWorld($id) {
		$this->config->load('create_character.php');
		if(!array_key_exists($id, $this->config->item('worlds'))) {
			$this->form_validation->set_message('_checkWorld', 'Unknown World');
			return false;
		}
		else
			return true;
	}
	
	function _checkVocation($id) {
		$this->config->load('create_character.php');
		if(!array_key_exists($id, $this->config->item('vocations'))) {
			$this->form_validation->set_message('_checkVocation', 'Unknown Vocation');
			return false;
		}
		else
			return true;
	}
	
	function _checkSex($id) {
		if($id != 0 and $id != 1) {
			$this->form_validation->set_message('_checkSex', 'Unknown Sex');
			return false;
		}
		else
			return true;
	}
	
	function _validName($name) {
		require("config.php");
		$name = explode(" ", $name);
			foreach($name as $unit) {
				if(in_array(strtolower($unit), $config['invalidNameTags'])) {
					$this->form_validation->set_message('_validName', 'Invalid Name');
					return false;
				}
				else if(strlen($unit) == 1) {
					$this->form_validation->set_message('_validName', 'Invalid Name');
					return false;
				}
				else
					continue;
			}
	}
	
	// Function which make the player more real by tatu hunter
	// Eg: elder'Druid = Elder'Druid
	//	   elder'druid = Elder'druid
	//     druid theMaster = Druid themaster
	function strFirst($name) {
		$name = explode(' ', trim($name));
		for($i=0, $t = sizeof($name); $i<$t; ++$i)
			for($j=0, $l=strlen($name[$i]); $j<$l; ++$j)
				!$j ? 
				($name[$i][$j] = !$i ? ($name[$i][$j] == strtoupper($name[$i][$j]) ? $name[$i][$j] : strtoupper($name[$i][$j])): $name[$i][$j])  : 
				($name[$i][$j] = ($name[$i][$j-1] == '\'' ? $name[$i][$j] : 
				strtolower($name[$i][$j])));
	
		$ret = '';
		foreach($name as $k)
			$ret .= $k . ' ';
	
		return trim($ret);
	}

		/* Controller of creating new account. New values can be hard-coded here. (only experienced users) */
		function create($ajax = 0) {
			require_once("system/application/config/create_character.php");
			$ide = new IDE;
			global $config;
			if($ajax == 1 && $ide->isLogged()) exit;
			if($ide->isLogged()) $ide->redirect(WEBSITE.'/index.php/account');
			$this->load->plugin('captcha');
			$this->load->helper('form');
			
			$vals = array(
					'word'		 => '',
					'img_path'	 => 'system/captcha/',
					'img_url'	 => WEBSITE.'/system/captcha/',
					'font_path'	 => WEBSITE.'/system/fonts/texb.ttf',
					'img_width'	 => '156',
					'img_height' => 30,
					'expiration' => 120
				);
			if(!$_POST && $ajax == 0) {
				$cap = create_captcha($vals);	
			}
			if($_POST) {
				$this->load->library('form_validation');
				$_POST['nickname'] = ucfirst(strtolower($_POST['nickname']));
				$this->form_validation->set_rules('name2', 'Account Name', 'required|min_length[4]|max_length[32]|callback__account_exists|alpha_numeric|callback__checkDelay');
				$this->form_validation->set_rules('nickname', 'Nickname', 'required|min_length[4]|max_length[32]|callback__nicknameExists');
				$this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
				$this->form_validation->set_rules('email', 'Email', 'required|valid_email|callback__emailExists');
				$this->form_validation->set_rules('character_name', 'Character Name', 'required|min_length[4]|max_length[32]|nickname|callback__characterExists|callback__validName');
				$this->form_validation->set_rules('city', 'City', 'required|integer|callback__checkCity');
				$this->form_validation->set_rules('world', 'World', 'required|integer|callback__checkWorld');
				$this->form_validation->set_rules('vocation', 'Vocation', 'required|integer|callback__checkVocation');
				$this->form_validation->set_rules('sex', 'Sex', 'required|integer|callback__checkSex');
				/*$this->form_validation->set_rules('captcha', 'Captcha', 'required|callback__checkCaptcha');*/
				if($this->form_validation->run() == TRUE) {
					require(APPPATH.'config/ide_default.php');
					$ots = POT::getInstance();
					$ots->connect(POT::DB_MYSQL, connection());
					$account = new OTS_Account();
					$name = $account->createNamed($_POST['name2']);
					$account->setPassword(sha1($_POST['password']));
					$account->setEmail($_POST['email']);
					$account->setCustomField('nickname', $_POST['nickname']);
					$account->setCustomField('premdays', PREMDAYS);
					$account->setCustomField('lastday', $_SERVER['REQUEST_TIME']);
					try {
						$account->save();
						unset($account);
						$_SESSION['logged'] = 1;
						$_SESSION['name'] = $_POST['name2'];
						$_SESSION['nickname'] = $_POST['nickname'];
						$_SESSION['accountDelay'] = time();
						
						$account = $ots->createObject('Account');
						$account->find($_POST['name2']);
						
						$sample = new OTS_Player();
						$sample->find($config['newchar_vocations'][$_POST['world']][$_POST['vocation']]);
						if(!$sample->isLoaded()) {	show_error('Sample character could not be found!'); }
						
						// Create new character
						$player = $ots->createObject('Player');
						$player->setName($this->strFirst($_POST['character_name']));
                		$player->setAccount($account);
						$player->setWorld($_POST['world']);
                		$player->setGroup($sample->getGroup());
                		$player->setSex($_POST['sex']);
                		$player->setVocation($sample->getVocation());
                		$player->setConditions($sample->getConditions());
               		 	$player->setRank($sample->getRank());
               		 	$player->setLookAddons($sample->getLookAddons());
                		$player->setTownId($_POST['city']);
                		$player->setExperience($sample->getExperience());
                		$player->setLevel($sample->getLevel());
                		$player->setMagLevel($sample->getMagLevel());
                		$player->setHealth($sample->getHealth());
                		$player->setHealthMax($sample->getHealthMax());
                		$player->setMana($sample->getMana());
                		$player->setManaMax($sample->getManaMax());
                		$player->setManaSpent($sample->getManaSpent());
                		$player->setSoul($sample->getSoul());
                		$player->setDirection($sample->getDirection());
                		$player->setLookBody($sample->getLookBody());
                		$player->setLookFeet($sample->getLookFeet());
                		$player->setLookHead($sample->getLookHead());
                		$player->setLookLegs($sample->getLookLegs());
                		$player->setLookType($sample->getLookType());
                		$player->setCap($sample->getCap());
						$player->setPosX($startPos['x']);
               			$player->setPosY($startPos['y']);
                		$player->setPosZ($startPos['z']);
                		$player->setLossExperience($sample->getLossExperience());
                		$player->setLossMana($sample->getLossMana());
                		$player->setLossSkills($sample->getLossSkills());
                		$player->setLossItems($sample->getLossItems());
						$player->setLossContainers($sample->getLossContainers());
                		$player->save();
						$_SESSION['characterDelay'] = $_SERVER['REQUEST_TIME'];
						unset($player);
                		$player = $ots->createObject('Player');
                		$player->find($_POST['character_name']);
						if($player->isLoaded())
                		{
                    		$player->setSkill(0,$sample->getSkill(0));
                    		$player->setSkill(1,$sample->getSkill(1));
                    		$player->setSkill(2,$sample->getSkill(2));
                    		$player->setSkill(3,$sample->getSkill(3));
                    		$player->setSkill(4,$sample->getSkill(4));
                    		$player->setSkill(5,$sample->getSkill(5));
                    		$player->setSkill(6,$sample->getSkill(6));
                    		$player->save();
							$SQL = POT::getInstance()->getDBHandle();
                    		$loaded_items_to_copy = $SQL->query("SELECT * FROM player_items WHERE player_id = ".$sample->getId()."");
                    		foreach($loaded_items_to_copy as $save_item)
								$SQL->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
						
							if($ajax == 0)
								$ide->redirect(WEBSITE.'/index.php/account');
							else
								$ide->criticalRedirect(WEBSITE.'/index.php/account');
						}
					}
					catch(Exception $e) {
						error($e->getMessage());
					}
				}
				else {
					if($ajax == 0) $cap = create_captcha($vals);
				}
			}
			if($ajax == 0) {
				$_SESSION['captcha'] = $cap['word'];
				$data['captcha'] = $cap['image'];
			}
			#Load view of creating account
			if($ajax == 1) {
				echo error(validation_errors());
				$ide->system_stop();
			}
			else {
				$this->load->view('create', $data);
			}
		}
		
		/* Function to check if passed login and password are correct, it uses abstract database model. */
		function _check_login() {
			$this->load->model("Account_model");
			if($this->Account_model->check_login() == false) {
				$this->form_validation->set_message("_check_login", "Account name or password are incorrect.");
				return false;
			}
			else
				return true;
		}
		
		/* Login controller  */
		function login($action = 0) {
			if((int) $action == 1) success("You have been logged out.");
			if((int) $action == 2) success("Your account has been recovered. You may login now.");
			$ide = new IDE;
			$this->load->helper("form");
			$this->load->library("form_validation");
			if($_POST) {
				$this->form_validation->set_rules('name', 'Account Name', 'required|callback__check_login');
				$this->form_validation->set_rules('pass', 'Password', 'required');
				if(in_array($_POST['name'], $GLOBALS['config']['restrictedAccounts']))
					error("The account you try to access is restricted!");
				else {
					if($this->form_validation->run() == true) {
						$_SESSION['logged'] = 1;
						$_SESSION['name'] = $_POST['name'];
						if(!empty($_SESSION['forward'])) {
							$forward = $_SESSION['forward'];
							$_SESSION['forward'] = "";
							$ide->redirect($forward);
						}
						else 
							$ide->redirect(WEBSITE.'/index.php/account');
					
					}
				}
			}
			/* Load view of login page. */
			$this->load->view("login");
			
		}
		/* Function to logout from account. */
		function logout() {
			$ide = new IDE;
			$_SESSION['logged'] = '';
			$_SESSION['account_id'] = '';
			$_SESSION['name'] = '';
			$_SESSION['admin'] = 0;
			$_SESSION['forward'] = "";
			$ide->redirect('login/1');
		}
		
		/* Controller to generate random recovery key and save it, accessed by user, only once per account. */
		function generate_recovery_key() {
			$this->load->helper("form");
			$ide = new IDE;
			$ide->requireLogin();
			$this->load->model("Account_model");
			if($this->Account_model->getRecoveryKey($_SESSION['name']) != '') $ide->redirect('../account');
			if($_POST) {
				$data['info'] = '';
				$key = $this->Account_model->generateKey($_SESSION['name']);
				success("<center><font size='4'>$key</font></center>");
				alert("<b>Salve esta chave de recuperação, você verá esta key apenas uma vez! Você nunca vai vê-lo novamente, não atualize o site enquanto você não salvar a chave de recuperação!</b>");
			}
			else
				$data['info'] = '<center id=\'info\'><b>Pressione o botão abaixo para gerar seu Recovery Key. <br>Lembre-se de guardar bem, pois você só poderá retirar uma única vez!</b></center><br><center><input type=\'submit\' value=\'Gerar\' name=\'submit\'></center>';
				/* Load view of generating new recovery key. */
				$this->load->view('generate_recovery_key', $data);
		}
		
		function _checkCurrentPassword($pass) {
			$this->load->model("account_model");
			if($this->account_model->checkPassword($pass)) 
				return true;
			else {
				$this->form_validation->set_message("_checkCurrentPassword", "Current password is incorrect.");
				return false;
			}
		}
		
		function changepassword() {
			$ide = new IDE;
			$ide->requireLogin();
			$this->load->helper("form_helper");
			if($_POST) {
				$this->load->library("form_validation");
				$this->form_validation->set_rules('current', 'Current Password', 'required|callback__checkCurrentPassword');
				$this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
				if($this->form_validation->run() == true) {
					$this->load->model("account_model");
					$this->account_model->changePassword($_POST['password'], $_SESSION['name']);
					success("Your password has been changed.");
					$ide->redirect(WEBSITE."/index.php/account", 2);
				}
			}
			$this->load->view("changepassword");
		}
		
		function editcomment($id) {
			$ide = new IDE;
			$ide->requireLogin();
			if(empty($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->load->model("account_model");
			if(!$this->account_model->isUserPlayer($id)) $ide->redirect(WEBSITE."/index.php/account");
			$data['id'] = $id;
				if($_POST) {
					$this->load->library("form_validation");
						$this->form_validation->set_rules('comment', 'Comment', 'max_length[255]|alpha_ide');
					if($this->form_validation->run() == true) {
						if(@$_POST['hide'] == 1)
							$this->account_model->changeComment($id, $_POST['comment'], true);
						else
							$this->account_model->changeComment($id, $_POST['comment'], false);
						success("Your comment has been changed.");
						$ide->redirect(WEBSITE."/index.php/account", 2);
					}
				}
			$data['comment'] = $this->account_model->getPlayerComment($id);
			$this->load->helper("form_helper");
			$this->load->view("edit_comment", $data);
		}
		
		function deletePlayer($id) {
			$ide = new IDE;
			$ide->requireLogin();
			$id = (int)$id;
			if(empty($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->load->model("account_model");
			if(!$this->account_model->isUserPlayer($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->account_model->deletePlayer($id);
			$ide->redirect(WEBSITE."/index.php/account");
		}
		
		function undeletePlayer($id) {
			$ide = new IDE;
			$ide->requireLogin();
			$id = (int)$id;
			if(empty($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->load->model("account_model");
			if(!$this->account_model->isUserPlayer($id)) $ide->redirect(WEBSITE."/index.php/account");
			$this->account_model->undeletePlayer($id);
			$ide->redirect(WEBSITE."/index.php/account");
		}
		
		public function setNickname() {
			$ide = new IDE;
			$ide->requireLogin();
			if(!empty($_SESSION['nickname'])) $ide->goPrevious();
			$this->load->helper("form_helper");
				if($_POST) {
					$_POST['nickname'] = ucfirst(strtolower($_POST['nickname']));
					$this->load->library("form_validation");
					$this->form_validation->set_rules('nickname', 'Nickname', 'required|min_length[4]|max_length[32]|nickname|callback__nicknameExists');
					$this->form_validation->set_rules('rules', 'Rules', 'required');
					if($this->form_validation->run()) {
						$this->load->model("account_model");
						$this->account_model->setNickname($ide->loggedAccountId(), $_POST['nickname']);
						$_SESSION['nickname'] = $_POST['nickname'];
						$ide->redirect(WEBSITE."/index.php/account/index/2");
					}
				}
			$this->load->view("setNickname");
			
		}
		
		function _validKey($key) {
			$this->load->model("account_model");
			$_POST['key'] = str_replace("-", "", $_POST['key']);
			if($this->account_model->checkKey($_POST['key'], $_POST['email'])) {
				return true;
			}
			else {
				$this->form_validation->set_message("_validKey", "Could not change password. Make sure email and recovery key are valid.");
				return false;
			}
		}
		
		public function lost() {
			$ide = new IDE;
			$this->load->helper("form_helper");
				if($_POST) {
					$_POST['key'] = str_replace("-", "", $_POST['key']);
				
					$this->load->library("form_validation");
					$this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
					$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
					$this->form_validation->set_rules('key', 'Recovery Key', 'required|callback__validKey');
					
					if($this->form_validation->run()) {
						$this->load->model("account_model");
						$this->account_model->recoveryAccount($_POST['key'], $_POST['email'], $_POST['password']);
						$ide->redirect(WEBSITE."/index.php/account/login/2");
					}
				}
			$this->load->view("account_lost");
		}
		
	}

?

models/account_model.php
<?php
class Account_model extends Model {

	function __construct() {
		parent::__construct();
		$this->load->database();
	}

	function check_login() {
		require("config.php");
		$this->db->select('id, page_access, nickname');
		$sql = $this->db->get_where('accounts', array('name' => $_POST['name'], 'password' => sha1($_POST['pass'])));
		$row = $sql->row_array();
			if(!empty($row)) {
			$_SESSION['account_id'] = $row['id'];
			$_SESSION['access'] = $row['page_access'];
			$_SESSION['nickname'] = $row['nickname'];
				if($row['page_access'] >= $config['adminAccess'])
					$_SESSION['admin'] = 1;
				else
					$_SESSION['admin'] = 0;
			}
		return $sql->num_rows ? true : false;
	}
	
	function getRecoveryKey($name) {
		$this->db->select('key');
		$sql = $this->db->get_where('accounts', array('name' => $name))->row_array();		
			return $sql['key'];							

	}
	
	function generateKey($name) {
		$key = rand(1000,9999).'-'.rand(1000,9999).'-'.rand(1000,9999).'-'.rand(1000,9999);
		$save = sha1(str_replace("-", "", $key));
		$this->db->update('accounts', array('key' => $save), array('name' => $name));
		
		return $key;
	}
	
	public function getAccountID() {
		$this->db->select('id');
		$sql = $this->db->get_where('accounts', array('name' => $_SESSION['name']))->row_array();
		return (int)$sql['id'];
	}
	
	public function getCharacters() {
		$this->db->select('id, name, level');
		return $this->db->get_where('players', array('account_id' => $_SESSION['account_id']), array('deleted' => 0))->result();
	}
	
	public function checkPassword($pass) {
		$this->db->select('id');
		return ($this->db->get_where('accounts', array('name' => $_SESSION['name'], 'password' => sha1($pass)))->num_rows) ? true : false; 
	}
	
	public function changePassword($pass, $name) {
		$this->db->update('accounts', array('password' => sha1($pass)), array('name' => $name));
	}
	
	public function isUserPlayer($id) {
		$this->db->select('id');
		return ($this->db->get_where('players', array('account_id' => $_SESSION['account_id'], 'id' => $id))->num_rows) ? true : false;
	}
	
	public function getPlayerComment($id) {
		$this->db->select('comment, hide_char');
		return $this->db->get_where('players', array('id' => $id))->result_array();
	}
	
	public function changeComment($id, $comment, $hide = false) {
		$hide = $hide ? 1 : 0;
		$this->db->update('players', array('comment' => $comment, 'hide_char' => $hide), array('id' => $id));
	}
	
	public function deletePlayer($id) {
		$this->db->update('players', array('deleted' => 1), array('id' => $id));
	}
	
	public function undeletePlayer($id) {
		$this->db->update('players', array('deleted' => 0), array('id' => $id));
	}
	
	public function nicknameExists($name) {
		$this->db->select('id');
		return ($this->db->get_where('accounts', array('nickname' => $name))->num_rows) ? true : false;
	}
	public function emailExists($email) {
		$this->db->select('id');
		return ($this->db->get_where('accounts', array('email' => $email))->num_rows) ? true : false;
	}	
	public function setNickname($id, $nick) {
		$this->db->update('accounts', array('nickname' => $nick), array('id' => $id));
	}
	
	public function checkKey($key, $email) {
		return ($this->db->get_where('accounts', array('key' => sha1($key), 'email' => $email))->num_rows) ? true : false;
	}
	
	public function recoveryAccount($key, $email, $password) {
		$this->db->update('accounts', array('password' => sha1($password)), array('key' => sha1($key), 'email' => $email));
	}
	
	public function load($id) {
		$this->db->select('id, rlname, location, about_me, nickname');
		return $this->db->get_where('accounts', array('id' => $id))->result_array();
	}
	
	public function checkMessages() {
		$this->db->select('id');
		return $this->db->get_where('messages', array('to' => $_SESSION['account_id'], 'unread' => 1, 'delete_to' => 0))->num_rows;
	}
}

?

Life is so meaningless, there is nothing worth a smile
So goodbye, I'll miss you

 

 

sugestões?

 

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por amoxicilina
      Action: Remover skull
       
       
    • Por paranoiakiller
      Olá, estou criando um servidor custom tibia na versão 10.98 e gostaria de saber se é possivel remover as laterais. Por haver essas laterais no cliente, não é possivel utlizar imagens com resolução superior a 576x448 tirando muito da qualidade.

    • Por lordzetros
      Bom, como o título já informa, o script faz com que você remova um item do inventário de algum player online.
       
      Versão: 8.6 - TFS 0.4
      Em data\talkactions\scripts crie um arquivo chamado removerItem (lembrando que deve ser .lua, caso não saiba criar um, copie algum já existente e cole, após isso, mude o nome do arquivo e cole o código dentro)
       
      --[[ Script feito por Lordzetros para o fórum Tibia King ]] function onSay(cid, words, param) pos = getPlayerPosition(cid) if (param == '') then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O comando necessita de parametros (nomePlayer,idItem,quantidade). Ex.: /remover Bugador,2160,100") if (not isPlayerGhost(cid)) then doSendMagicEffect(pos, CONST_ME_POFF) end return true end local aux = string.explode(param, ",") local pid = getPlayerByNameWildcard(aux[1]) if (not pid) then return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player " .. aux[1] .. " nao encontrado.") elseif (getPlayerAccess(pid) > getPlayerAccess(cid)) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce nao pode remover itens de um superior seu.") doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "O membro da staff " ..getCreatureName(cid).. " tentou remover um item de voce!") return true end aux[1] = aux[1]:lower() local qntd = 1 if(aux[3]) then if (tonumber(aux[3]) <= 0) then return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nao eh permitido valores nulos/negativos! Caso queira remover apenas 1x, use /remover Player,idItem") else qntd = aux[3] end end if (doPlayerRemoveItem(pid, tonumber(aux[2]), qntd) == TRUE) then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Removido " ..qntd.. "x " ..getItemNameById(aux[2]).. " do player "..aux[1]) posPlayer = getCreaturePosition(pid) doSendMagicEffect(posPlayer, CONST_ME_PLANTATTACK) doCreatureSay(pid,"O membro da staff " ..getCreatureName(cid).. " removeu " ..qntd.. "x " ..getItemNameById(aux[2]).." de seu inventario!", TALKTYPE_ORANGE_1) return true else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O Player " ..aux[1].. " nao tem o item ou a quantidade do item informada em seu inventario.") end return true end Salve o arquivo no qual colocou o código, após isso navegue até data\talkactions\ e abra o arquivo talkactions.lua, e coloque este trecho de código onde quiser:
       
      <talkaction log="yes" access="3" words="/remover" event="script" value="removerItem.lua"/> Feito isso, salve o mesmo e já pode testar no seu servidor.

      Obs1.: Repare que o acesso está definido como 3, ou seja, GM para cima. (mude se quiser)

       
      Comando na prática: /remover nomePlayer,idItem,qntd

      Imagens:
      1

       
      2

       
      3


       
      4

       
      Enfim, é isso pessoal, script simples, porém, pode servir para algum tibiano interessado. 
    • Por 9k22
      Nome: Rust Remover



      Tipo de script: Action



      Versão: 8.6x


      Procurei, procurei e procurei mais não encontrei aqui no fórum nada parecido, intão resolvi postar!

      Pode ser usado para remover a ferrugem da Rusty Armor ou Rusty Legs.


      Em data/action/scripts crie um arquivo .lua com o nome rustremover e adicione:

      local breakChance = 60 local rustyItems = { [9808] = {2464, 2465, 2483, 2463, 2476}, --common rusty armor [9809] = {2464, 2465, 2483, 2463, 2476, 8891, 2487}, --semi-rare rusty armor [9810] = {2465, 2463, 2476, 8891, 2487, 2466, 2492, 2472}, --rare rusty armor [9811] = {2468, 2648, 2478, 2647, 2477}, --common rusty legs [9812] = {2468, 2648, 2478, 2647, 2477, 2488}, --semi-rare rusty legs [9813] = {2468, 2648, 2478, 2647, 2477, 2488, 2470}, --rare rusty legs [9814] = {2511, 2510, 2530, 2509, 2513, 2515}, --common rusty shield [9815] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519}, --semi-rare rusty shield [9816] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519, 2520, 2514}, --rare rusty shield [9817] = {2643, 3982, 5462, 7457}, --common rusty boots [9818] = {2643, 3982, 5462, 7457, 2195}, --semi-rare rusty boots [9819] = {2643, 3982, 5462, 7457, 2195, 2645}, --rare rusty boots [9820] = {2458, 2460, 2480, 2481, 2457, 2491}, --common rusty helmet [9821] = {2458, 2460, 2480, 2481, 2457, 2491, 2497}, --semi rare rusty helmet [9822] = {2458, 2460, 2480, 2481, 2457, 2491, 2497, 2475, 2498} --rare rusty helmet } function onUse(cid, item, fromPosition, itemEx, toPosition) if rustyItems[itemEx.itemid] ~= nil then if math.random(100) <= breakChance then doRemoveItem(itemEx.uid) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.") doSendMagicEffect(getCreaturePosition(cid),34) else local newId = rustyItems[itemEx.itemid][math.random(#rustyItems[itemEx.itemid])] doTransformItem(itemEx.uid,newId) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId)) doSendMagicEffect(getCreaturePosition(cid),66) end doRemoveItem(item.uid,1) return TRUE end return FALSE end Agora em Action/action.xml e adicione: <action itemid="9930" script="tools/rustremover.lua"/>

      9930 = Id do rustremover (pode ser alterado)

      rustremover.rar

      Créditos: Otproject 100%
    • Por zaroth1
      Bom, a pouco, fiz um tópico citando um problema, mas já foi resolvido, agora estou com outro problema, que é no login.
       
      O Site está funcionando normalmente, porém quando crio a conta e vou fazer o login para criação do Personagem, aparece o seguinte erro:
       



       
      Outro erro ocorre quando clico em Highscores, Kill Statistics e Guilds:
       



       
      É o mesmo erro para os 3...
       
      Seria algum erro na database?
       
      Alguém sabe a solução?
       
      Obrigado desde já!
       
      Segue abaixo o arquivo (htdocs\classes\account.php)



       
      E esse é o (htdocs\classes\databaselist.php)



       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo