mirror of
				https://e.coding.net/circlecloud/McAccount.git
				synced 2025-11-03 17:56:24 +00:00 
			
		
		
		
	init project...
This commit is contained in:
		
							
								
								
									
										77
									
								
								Model/authme.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								Model/authme.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,77 @@
 | 
			
		||||
<?php
 | 
			
		||||
class authme extends AmysqlModel {
 | 
			
		||||
	public function register($username, $password, $mail, $ip) {
 | 
			
		||||
		$value = array (
 | 
			
		||||
				"username" => $username,
 | 
			
		||||
				"password" => $password,
 | 
			
		||||
				"ip" => $ip,
 | 
			
		||||
				"lastlogin" => '',
 | 
			
		||||
				"x" => '0',
 | 
			
		||||
				"y" => '0',
 | 
			
		||||
				"z" => '0',
 | 
			
		||||
				"world" => 'world',
 | 
			
		||||
				"email" => $mail 
 | 
			
		||||
		);
 | 
			
		||||
		$ic = array (
 | 
			
		||||
				"username" => $username,
 | 
			
		||||
				"balance" => "30",
 | 
			
		||||
				"hidden" => "0" 
 | 
			
		||||
		);
 | 
			
		||||
		$data = array (
 | 
			
		||||
				"address" => $mail,
 | 
			
		||||
				'verify' => '',
 | 
			
		||||
				'statu' => '0',
 | 
			
		||||
				'time' => date ( 'Y-m-d' ),
 | 
			
		||||
				"user" => $username 
 | 
			
		||||
		);
 | 
			
		||||
		
 | 
			
		||||
		if ($this->_insert ( 'authme', $value ) == 0) {
 | 
			
		||||
			return false;
 | 
			
		||||
		} else {
 | 
			
		||||
			if ($this->_insert ( 'mail', $data ) == 0) {
 | 
			
		||||
				return false;
 | 
			
		||||
			} else {
 | 
			
		||||
				if ($this->_insert ( 'iconomy', $ic ) == 0) {
 | 
			
		||||
					return false;
 | 
			
		||||
				} else {
 | 
			
		||||
					return true;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	public function login($username, $password) {
 | 
			
		||||
		if ($this->_sum ( "select * from `authme` where `username` = '$username' and `password` = '$password'" ) == 0)
 | 
			
		||||
			
 | 
			
		||||
			return false;
 | 
			
		||||
		else
 | 
			
		||||
			return true;
 | 
			
		||||
	}
 | 
			
		||||
	public function pass($username, $newpass) {
 | 
			
		||||
		$key = array (
 | 
			
		||||
				"password" => $newpass 
 | 
			
		||||
		);
 | 
			
		||||
		
 | 
			
		||||
		$num = $this->_update ( 'authme', $key, "where username='" . $username . "'" );
 | 
			
		||||
		if ($num == 0)
 | 
			
		||||
			return false;
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	public function pass_forge($value, $username) {
 | 
			
		||||
		$key = array (
 | 
			
		||||
				"password" => $value 
 | 
			
		||||
		);
 | 
			
		||||
		$num = $this->_update ( 'authme', $key, "where username='" . $username . "'" );
 | 
			
		||||
		// print_r($key);
 | 
			
		||||
		if ($num == 0)
 | 
			
		||||
			return false;
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	public function check_user($user) {
 | 
			
		||||
		$sum = $this->_sum ( "select * from `authme` where `username` = '" . $user . "'" );
 | 
			
		||||
		if ($sum == 0)
 | 
			
		||||
			return true;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										12
									
								
								Model/current_model.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Model/current_model.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
<?php
 | 
			
		||||
class current_model extends AmysqlModel {
 | 
			
		||||
	function money_current($user) {
 | 
			
		||||
		$sql = "SELECT *
 | 
			
		||||
	  FROM `iconomy`
 | 
			
		||||
	  WHERE `username` = '" . $user . "'
 | 
			
		||||
	  LIMIT 0 , 75";
 | 
			
		||||
		return $this->_all ( $sql );
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										14
									
								
								Model/mail.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								Model/mail.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
<?
 | 
			
		||||
class mail extends AmysqlModel {
 | 
			
		||||
	function check($url) {
 | 
			
		||||
		if ($this->_sum ( "SELECT * FROM `authme` WHERE `email` = '$url'" ) == 0)
 | 
			
		||||
			return false;
 | 
			
		||||
		$sql = "SELECT * FROM `authme` WHERE `email` = '$url'";
 | 
			
		||||
		return $this->_all ( $sql );
 | 
			
		||||
	}
 | 
			
		||||
	function mailcheck($url) {
 | 
			
		||||
		if ($this->_sum ( "SELECT * FROM `authme` WHERE `email` = '$url'" ) == 0)
 | 
			
		||||
			return true;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										34
									
								
								Model/mail_model.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Model/mail_model.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
<?php
 | 
			
		||||
class mail_model extends AmysqlModel {
 | 
			
		||||
	public function select($where) {
 | 
			
		||||
		$sql = "SELECT password, email
 | 
			
		||||
	    FROM `authme`
 | 
			
		||||
	    WHERE `username` = '" . $where . "'
 | 
			
		||||
	    LIMIT 0 , 75";
 | 
			
		||||
		return $this->_all ( $sql );
 | 
			
		||||
	}
 | 
			
		||||
	public function mail($mail, $verify, $user) {
 | 
			
		||||
		$data = array (
 | 
			
		||||
				"address" => $mail,
 | 
			
		||||
				"verify" => $verify,
 | 
			
		||||
				"statu" => '1',
 | 
			
		||||
				"time" => date ( "Y-m-d" ) 
 | 
			
		||||
		);
 | 
			
		||||
		// var_dump($data);
 | 
			
		||||
		$num = $this->_update ( 'mail', $data, "where user='" . $user . "'" );
 | 
			
		||||
		// var_dump($num);
 | 
			
		||||
		if ($num == 0) {
 | 
			
		||||
			return false;
 | 
			
		||||
		} else {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	public function status($user) {
 | 
			
		||||
		$sql = "SELECT *
 | 
			
		||||
	  FROM `mail`
 | 
			
		||||
	  WHERE `user` = '" . $user . "'
 | 
			
		||||
	  LIMIT 0 , 75";
 | 
			
		||||
		return $this->_all ( $sql );
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user