<?php header("Access-Control-Allow-Origin: *"); $ecodedata = $_POST["postdata"]; // echo "server say::".($ecodedata); //base64_decode $b= json_decode ($ecodedata); $v= $b->v; $w= $b->w; $x= $b->x; $y= $b->y; $z= $b->z; require_once "configs.php"; //echo $x; //check data $sql='SELECT * FROM users where username="'.$x.'"'; $res = $db->query($sql); $i=0; while ($row = $res->fetchArray()) { // echo "{$row['username']}"; $i++; } if ($i>0) $have=$i; //echo "we have=$have="; if ($have) { echo "Sorry:[$x] already taken";exit;} else { $code="1"; $company=$w; $businesstype=$v; // echo "start create user $x $y $code $company $v $z"; // $sql = "INSERT INTO users (username, email, code, password,company,businesstype) VALUES (?, ? ,?,?,?,?)"; $stmt = $db->prepare("INSERT INTO users (username,email,code,password,company,businesstype) VALUES (?,?,?,?,?,?)"); $stmt->bindParam(1,$x); $stmt->bindParam(2,$y); $stmt->bindParam(3,$code); $stmt->bindParam(4,$z); $stmt->bindParam(5,$company); $stmt->bindParam(6,$v); $stmt->execute(); if ($db==FALSE) echo "Error in fetch ".$db->lastErrorMsg(); //echo "done $x $have"; echo "OK"; //$db->close(); } ?>
Edit file:sq_ius.php1399