function generate_access_id($id_length) { do { $unique_id = generate_random_letters($id_length); } while (id_is_in_files($unique_id)); return $unique_id; }
if (empty($_POST['fname'])) { echo "Please insert patient's full name!"; } else { ////medrecid function generate_random_letters($length) { $random = ''; for ($i = 0; $i < $length; $i++) { $random .= chr(rand(ord('a'), ord('z'))); } return $random; } $medrecid = mysqli_real_escape_string($sql_link, $_POST['medrecid']); if ($medrecid == '') { do { $unique = generate_random_letters(10); $rsql = "SELECT * FROM identification WHERE medrecid={$unique}"; $result = mysqli_query($sql_link, $rsql); } while ($result = ""); $medrecid = $unique; } ///////A.Identification $users_id = $_POST['userid']; $fname = mysqli_real_escape_string($sql_link, $_POST['fname']); $dob = mysqli_real_escape_string($sql_link, $_POST['dob']); $sex = isset($_POST['sex']) ? $_POST['sex'] : ''; $btype = mysqli_real_escape_string($sql_link, $_POST['btype']); $height = mysqli_real_escape_string($sql_link, $_POST['height']); $weight = mysqli_real_escape_string($sql_link, $_POST['weight']); $occupation = mysqli_real_escape_string($sql_link, $_POST['occupation']); $language = mysqli_real_escape_string($sql_link, $_POST['language']);
$objSearchPath = $fullpath . "/*.obj"; $objFiles = glob($objSearchPath); $theOBJFile = $objFiles[0]; //TODO error no object found in zip file $meshName = basename($objFiles[0], ".obj"); if ($verbose) { echo "<p>Found obj file with name: {$meshName}</p>"; } $processOK = 1; } else { echo "<p>Doh! I couldn't open {$target_file}</p>"; } } elseif ($needMoveOBJ == 1) { //create uid as above chmod($target_file, 0777); $uid = generate_random_letters(5); mkdir($uid); $fullpath = dirname(__FILE__) . "/" . $uid; chmod($fullpath, 0777); $theOBJFile = $fullpath . "/" . basename($target_file); $meshName = basename($theOBJFile, ".obj"); //move obj to uid directory if ($verbose) { echo "moving obj file to {$theOBJFile}"; } rename($target_file, $theOBJFile); $processOK = 1; } if ($processOK == 1) { $processCmd = "./webmesh {$theOBJFile} {$fullpath}/{$meshName}"; if ($verbose) {