Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Username= filter_var($_REQUEST['Username'], FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_LOW);
- $Password = filter_var($_REQUEST['Password'], FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_LOW);
- $sql="SELECT Username, Password FROM doctoradd WHERE Username = :Username AND Password = :Password";
- //$sql = "INSERT INTO technologies(name, description) VALUES(:Username, :Password)";
- $stmt = $pdo->prepare($sql);
- $stmt->bindParam(':Username', $Username, PDO::PARAM_STR);
- $stmt->bindParam(':Password', $Password, PDO::PARAM_STR);
- $stmt->execute();
- while($row = $stmt->fetch(PDO::FETCH_OBJ))
- {
- // Assign each row of data to associative array
- $data[] = $row;
- }
- if($data == []){
- echo json_encode("null");
- }
- else{
- echo json_encode("accepted");
- }
- let Username : string = this.form.controls["Username"].value,
- Password : string = this.form.controls["Password"].value;
- let body : string = "Username=" + Username + "&Password=" + Password,
- type : string = "application/x-www-form-urlencoded; charset=UTF-8",
- headers : any = new Headers({ 'Content-Type': type}),
- options : any = new RequestOptions({ headers: headers }),
- url : any = this.baseURI + "sign-in.php";
- this.http.post(url, body, options)
- .subscribe((data) =>
- {
- // If the request was successful notify the user
- // if(data.status === 200)
- // {
- // //this.hideForm = true;
- // this.toast.create({
- // message: 'Welcome ',
- // duration:3000
- // }).present();
- // //this.sendNotification(`Congratulations the technology: ${username} was successfully added`);
- // }
- // // Otherwise let 'em know anyway
- // else
- // {
- // //this.sendNotification('Something went wrong!');
- // this.toast.create({
- // message: 'Wrong Username or Password',
- // duration:3000
- // }).present();
- // }
- });
- this.SignIn();
- SignIn(){
- this.http.get('http://localhost:10080/testdb/sign-in.php')
- .map(res => res.json())
- .subscribe(data =>
- {
- this.items = data;
- });
- alert(this.items);
- if(this.items=="accepted"){
- this.navCtrl.push('ExamplePage',this.username);
- }
- else{
- this.toast.create({
- message: 'Wrong Username or Password',
- duration:3000
- }).present();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement