db = mysql.createConnection({
host: 'localhost',
//socketPath: "/var/run/mysqld/mysqld.sock",
user : 'root',
password : '',
database : 'game'
});
db.connect((err) => {
if(err) console.log(err);
console.log("Mysql connected");
});
db.query('SELECT email FROM players WHERE email=?', [email], (err,result,fields) => {
if(err) console.log(err);
e_mail = fields[0];
console.log(JSON.stringify(e_mail));
});
if(e_mail == undefined) {
socket.emit('warning');
}
else {
console.log(e_mail + '/' + email);
db.query("INSERT INTO players (nickname,email) VALUES('" + nick + "','" + email + "')", (err,result) => {
if(err) console.log(err);
console.log("Insert");
});
}