App. Post ('/register ', function (the req, res, next) {
Var connection=mysql. The createConnection ({
Host: 'localhost',
User: 'root',
Password: "'
Port: '3306',
The database: 'test'
});
Connection. The connect ();
Var users='select * from the users';
Connection. The query (users, function (err, rows) {
If (err) throw err;
for(var i=0; i
The console. The log (' registration failure);
Res. The send (404, '& lt; Script> Alert (" account has been registered "); Window. The history. The back (); & lt;/script> ');
break;
}
If (the req. Body. Nicheng==rows [I] nicheng) {
The console. The log (' registration failure);
Res. The send (404, '& lt; Script> Alert (" the nickname has already occupied "); Window. The history. The back (); & lt;/script> ');
break;
}
If (the req. Body. At terumo==rows [I] at terumo) {
The console. The log (' registration failure);
Res. The send (404, '& lt; Script> Alert (" mobile phones have been registered "); Window. The history. The back (); & lt;/script> ');
break;
}
If (the req. Body. Youxiang==rows [I] youxiang) {
The console. The log (' registration failure);
Res. The send (404, '& lt; Script> Alert (" your email has been registered "); Window. The history. The back (); & lt;/script> ');
break;
}
The else {
The console. The log (' prepare registration);
The next ();
break;
}
}
})
Connection. The end ();
})