<?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"; //check data $sql='SELECT * FROM difa where title="'.$v.'" and owndifaid='.$y; $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:[$v] already taken by yours ($y)";exit;} else { //echo $v.$w; $vv=$v; $st=1; // echo "start create user $x $y $code $company $v $z"; // $sql = "INSERT INTO difa(username, email, code, password,company,businesstype) VALUES (?, ? ,?,?,?,?)"; $sql="INSERT INTO difa(title, description,scode,owndifaid,status) VALUES (?,?,?,?,?)"; $stmt = $db->prepare($sql); $stmt->bindParam(1,$v); //$stmt = $db->prepare("INSERT INTO users (username,email,code,password,company,businesstype) VALUES (?,?,?,?,?,?)"); $stmt->bindParam(2,$w); $stmt->bindParam(3,$x); $stmt->bindParam(4,$y); $stmt->bindParam(5,$st); $stmt->execute(); $sql="update dyna set profile=".$rows. " where ownerid=".$y; $res = $db->query($sql); if ($db==FALSE) echo "Error in fetch ".$db->lastErrorMsg(); //echo "done $x $have"; echo "OK"; //$db->close(); } ?>
Edit file:sq_idifax.php1602