gaya Posted January 18, 2013 Share Posted January 18, 2013 The following is my code.I've to include another seperate folder in this code itself.How shall i include the another text file in this itself. $img=$_GET['a'];$txt=$_POST['txt'];$ans = "$img.txt";$imgsplit=explode("-",$img);$qid = $imgsplit[0];$qidsplit = preg_split("/[0-9]/",$qid);$len = strlen($qidsplit[0]);if($len==5){ $sub = substr($qidsplit[0],2,3); $bd = substr($qidsplit[0],0,2); }else{ $bdsub = str_split($qidsplit[0],2); $bd = $bdsub[0]; $sub = $bdsub[1];}$id = $imgsplit[1];$no = $imgsplit[2];$qno = $imgsplit[3];$folder="$bd-$sub-$id/";$upload = "img/$folder";$uploadfile = $ans;$uploadPath = $upload.$uploadfile;$incomingdata = file_get_contents('php://input');if(!$incomingdata) die("No input data");if(!is_dir($upload)) mkdir($upload);$anshandle = fopen($ans, 'w+') or die("can't open file - $ans");if (!fwrite($anshandle, $txt)) { echo "hai"; }else{// code} Link to comment Share on other sites More sharing options...
jeffman Posted January 18, 2013 Share Posted January 18, 2013 (edited) Please rephrase the question. I don't understand it. But I will warn you that your code gives any malicious user the ability to damage your file system. You should validate your GET and POST data before opening and writing files that are determined by that data. Edited January 18, 2013 by Deirdre's Dad 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now