add some new shit

This commit is contained in:
printempw 2016-01-22 15:06:47 +08:00
parent 41bcbae99e
commit 7ee277f67e
3 changed files with 16 additions and 5 deletions

View File

@ -2,7 +2,7 @@
* @Author: prpr * @Author: prpr
* @Date: 2016-01-21 13:55:44 * @Date: 2016-01-21 13:55:44
* @Last Modified by: prpr * @Last Modified by: prpr
* @Last Modified time: 2016-01-22 14:32:22 * @Last Modified time: 2016-01-22 15:03:08
*/ */
'use strict'; 'use strict';
@ -64,6 +64,7 @@ $("body").on("click", "#register-button", function(){
if (json.errno == 0) { if (json.errno == 0) {
showAlert(json.msg + " Please log in."); showAlert(json.msg + " Please log in.");
$('[data-remodal-id=register-modal]').remodal().close(); $('[data-remodal-id=register-modal]').remodal().close();
showMsg('hide', "");
} else { } else {
showAlert(json.msg); showAlert(json.msg);
} }

View File

@ -3,7 +3,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-01-16 23:01:33 * @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr * @Last Modified by: prpr
* @Last Modified time: 2016-01-22 14:52:44 * @Last Modified time: 2016-01-22 15:04:59
*/ */
class user { class user {
@ -51,6 +51,12 @@ class user {
} }
} }
public function unRegister() {
utils::remove("./textures/".$this->getTexture('skin'));
utils::remove("./textures/".$this->getTexture('cape'));
return utils::delete($this->uname);
}
public function getTexture($type) { public function getTexture($type) {
if ($type == "skin") { if ($type == "skin") {
return utils::select('username', $this->uname)['skin_hash']; return utils::select('username', $this->uname)['skin_hash'];
@ -102,4 +108,3 @@ class user {
} }
} }
?>

View File

@ -3,7 +3,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-01-16 23:01:33 * @Date: 2016-01-16 23:01:33
* @Last Modified by: prpr * @Last Modified by: prpr
* @Last Modified time: 2016-01-22 14:11:23 * @Last Modified time: 2016-01-22 15:04:56
*/ */
$dir = dirname(dirname(__FILE__)); $dir = dirname(dirname(__FILE__));
require "$dir/config.php"; require "$dir/config.php";
@ -65,7 +65,7 @@ class utils {
$passwd = $array['passwd']; $passwd = $array['passwd'];
$ip = $array['ip']; $ip = $array['ip'];
self::connect(); self::connect();
$query = self::query("INSERT INTO users (username, password, ip) VALUES ('$uname', '$passwd', '$ip')"); $query = self::query("INSERT INTO users (username, password, ip, preference) VALUES ('$uname', '$passwd', '$ip', 'default')");
return $query; return $query;
} }
@ -74,6 +74,11 @@ class utils {
return $query; return $query;
} }
public static function delete($uname) {
$query = self::query("DELETE from users WHERE username='$uname'");
return $query;
}
/** /**
* Rename uploaded file * Rename uploaded file
* *