<?php header("Access-Control-Allow-Origin: *"); $ecodedata = $_POST["postdata"]; // echo "server say::".($ecodedata); //base64_decode $b= json_decode ($ecodedata); $u= $b->u; $v= $b->v; $w= $b->w; $x= $b->x; $y= $b->y; $z= $b->z; $id= $b->id; 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 =$x have=$y comp=$w for update"; //if ($have) { echo "Sorry:[$x] already taken";exit;} else { $code="1"; $company=$w; $businesstype=$v; $guser=$u; if ($businesstype==0) $businesstype=4; //$id=$_GET['id']; ////////////Collect form data///////////// ///////// End of data collection /// //echo "start create user id=$id == $x $y $code $company $v $z"; // $sql = "INSERT INTO users (username, email, code, password,company,businesstype) VALUES (?, ? ,?,?,?,?)"; $sql="update users set username='$x',email='$y',code='$code',password='$z',company='$company',businesstype='$businesstype' where id=$id"; $sql="update users set email='$y',code='$code',password='$z',company='$company',businesstype='$businesstype',guser='$guser' where id=$id"; $ret = $db->exec($sql); if(!$ret) { echo $db->lastErrorMsg(); } else { //echo $db->changes(), " Record updated successfully\n"; //echo "$x updated"; echo "OK"; $db->close(); //} } ?>
Edit file:sq_uus.php1688