ok
Mini Shell
<?php include "../config/config.php";
if($_POST['type']=='edit_topics_form'){
try{
$date = date("Y-m-d");
$subject_type = $_POST['subject_type'];
$standard_type = $_POST['standard_type'];
$syllabus = $_POST['syllabus'];
$topic = $_POST['topic'];
$group_topic = $_POST['group_topic'];
$discription_content = $_POST['discription_content'];
$discription_keyword = $_POST['discription_keyword'];
$discription_title = $_POST['discription_title'];
$topic_content = $_POST['topic_content'];
$ids = $_POST['ids'];
$status = $_POST['status'];
$statement = $pdo->prepare("UPDATE `tbl_topic` SET `subject_id`=?,`standard_id`=?,`topic`=?,`syllabus`=?,`group_topic`=?,`discription_content`=?,`discription_keyword`=?,`discription_title`=?,`topic_content`=?,`status`=? WHERE id=?");
$result=$statement->execute(array($subject_type,$standard_type,$topic,$syllabus,$group_topic,$discription_content,$discription_keyword,$discription_title,$topic_content,$status,$ids));
if($result){
$return_arr['message']='Topic Updated Successfully...';
$return_arr['status']=200;
}
else{
$return_arr['message']='Something Went Wrong..';
$return_arr['status']=400;
}
}catch(Exception $e){
$error=$e;
}
echo json_encode($return_arr);
}
if($_POST['type']=='edit_subject_form'){
error_log("inside if condition");
try{
error_log("inside if condition");
//for($i=0;$i<count($_POST['question']);$i++){
$date = date("Y-m-d");
$subject = $_POST['subject'];
$discription_content = $_POST['discription_content'];
$discription_keywords = $_POST['discription_keywords'];
$discription_titles = $_POST['discription_titles'];
$ids = $_POST['ids'];
if($_FILES['subject_image']["name"]!=""){
$file_name = $_FILES['subject_image']['name'];
$tmp = explode('.', $file_name);
$extension = end($tmp);
//$extension = end(explode(".", $_FILES["photo"]["name"]));
$image = rand(10,1000000000)."-".$date."-subject." . $extension;
$upload = move_uploaded_file($_FILES['subject_image']['tmp_name'], '../upload/subject/' . $image);
$subject_image = 'upload/subject/' . $image;
}
if($_FILES['subject_image']["name"]==""){
$subject_image=$_POST['old_subject_image'];
}
$statement = $pdo->prepare("UPDATE `tbl_subject` SET `subject_name`=?,`image`=?,`discription_content`=?,`discription_keywords`=?,`discription_titles`=? WHERE id=?");
$result=$statement->execute(array($subject,$subject_image,$discription_content,$discription_keywords,$discription_titles,$ids));
error_log("ofter query");
if($result){
echo '<script type="text/javascript">
alert("Subject Updated successfully");
window.location.href = "placement-details.php";
</script>';
}else{
echo '<script type="text/javascript">
alert("Something went wrong try again...");
window.location.href = "banner-add.php";
</script>';
}
}catch(Exception $e){
$error=$e;
}
}
if($_POST['type']=='edit_description_form'){
error_log("inside if condition");
try{
error_log("inside if condition");
$ids = $_POST['ids'];
$title = $_POST['title'];
$keyword = $_POST['keyword'];
$description = $_POST['description'];
$type = $_POST['types'];
error_log($type."check the type");
$statement = $pdo->prepare("UPDATE `tbl_mocktest_description` SET `title`=?,`keyword`=?,`description`=?,`type`=? WHERE id=?");
$result=$statement->execute(array($title,$keyword,$description,$type,$ids));
}catch(Exception $e){
$error=$e;
}
}
if($_POST['type']=='edit_blog_form'){
error_log("edit_blog_form if condition");
try{
//for($i=0;$i<count($_POST['question']);$i++){
$date = date("Y-m-d");
$blog_type = $_POST['blog_type'];
$heading = $_POST['heading'];
$tag_line = $_POST['tag_line'];
$blog_date = $_POST['date'];
$content = $_POST['content'];
$name = $_POST['name'];
$description = $_POST['description'];
$title = $_POST['title'];
$keyword = $_POST['keyword'];
$ids = $_POST['ids'];
if($_FILES['blog_image']["name"]!=""){
$file_name = $_FILES['blog_image']['name'];
$tmp = explode('.', $file_name);
$extension = end($tmp);
//$extension = end(explode(".", $_FILES["photo"]["name"]));
$image = rand(10,1000000000)."-".$date."-blog." . $extension;
$upload = move_uploaded_file($_FILES['blog_image']['tmp_name'], '../upload/blog/' . $image);
$blog_image = 'upload/blog/' . $image;
}
if($_FILES['blog_image']["name"]==""){
$blog_image=$_POST['old_blog_image'];
}
if($_FILES['thumpnail_image']["name"]!=""){
$file_name = $_FILES['thumpnail_image']['name'];
$tmp = explode('.', $file_name);
$extension = end($tmp);
//$extension = end(explode(".", $_FILES["photo"]["name"]));
$image1 = rand(10,1000000000)."-".$date."-blog." . $extension;
$upload = move_uploaded_file($_FILES['thumpnail_image']['tmp_name'], '../upload/blog/' . $image1);
$thumnail_image = 'upload/blog/' . $image;
}
if($_FILES['thumpnail_image']["name"]==""){
$thumnail_image=$_POST['old_thumpnail_image'];
}
$statement = $pdo->prepare("UPDATE `tbl_blog` SET `name`=?,`heading`=?,`blog_image`=?,`thumpnail_image`=?,`tag_line`=?,`content`=?,`date`=?,`description`=?,`title`=?,`keyword`=?,`type`=? WHERE id=?");
$result=$statement->execute(array($name,$heading,$blog_image,$thumnail_image,$tag_line,$content,$blog_date,$description,$title,$keyword,$blog_type,$ids));
if($result){
$return_arr['message']='Blog Edit Successfully...';
$return_arr['status']=200;
}
else{
$return_arr['message']='Something Went Wrong..';
$return_arr['status']=400;
}
}catch(Exception $e){
$error=$e;
}
echo json_encode($return_arr);
}
if($_POST['type']=='edit_standared_form'){
try{
//for($i=0;$i<count($_POST['question']);$i++){
$date = date("Y-m-d");
$status = $_POST['status'];
$ids = $_POST['ids'];
$subject_id = $_POST['subject'];
$standared = $_POST['standard'];
$ids = $_POST['ids'];
$statement = $pdo->prepare("UPDATE `tbl_standard` SET `subject_id`=?,`standard`=?,`status`=? WHERE id=?");
$result=$statement->execute(array($subject_id,$standared,$status,$ids));
if($result){
$return_arr['message']='Standard Edit Successfully...';
$return_arr['status']=200;
}
else{
$return_arr['message']='Something Went Wrong..';
$return_arr['status']=400;
}
}catch(Exception $e){
$error=$e;
}
echo json_encode($return_arr);
}
if($_POST['type']=='edit_test_series_form'){
try{
$test_series = $_POST['test_series'];
$exam_type = $_POST['exam_type'];
$description = $_POST['description'];
$title = $_POST['title'];
$keyword = $_POST['keyword'];
$ids = $_POST['ids'];
$statement = $pdo->prepare("UPDATE `tbl_test_series` SET `test_name`=?,`exam_type`=?,`description`=? ,`title`=? ,`keyword`=? WHERE id=?");
$result=$statement->execute(array($test_series,$exam_type,$description,$title,$keyword,$ids));
if($result){
$return_arr['message']='Standard Edit Successfully...';
$return_arr['status']=200;
}
else{
$return_arr['message']='Something Went Wrong..';
$return_arr['status']=400;
}
}catch(Exception $e){
$error=$e;
}
echo json_encode($return_arr);
}
if($_POST['type']=='edit_decription_form'){
try{
//for($i=0;$i<count($_POST['question']);$i++){
$date = date("Y-m-d");
$title = $_POST['title'];
$keyword = $_POST['keyword'];
$content = $_POST['content'];
$type = $_POST['types'];
$status = $_POST['status'];
$ids = $_POST['ids'];
$statement = $pdo->prepare("UPDATE `tbl_current_affars_description` SET `title`=?,`keyword`=?,`description`=?,`type`=?,`status`=? WHERE id=?");
$result=$statement->execute(array($title,$keyword,$content,$type,$status,$ids));
if($result){
$return_arr['message']='Description Edit Successfully...';
$return_arr['status']=200;
}
else{
$return_arr['message']='Something Went Wrong..';
$return_arr['status']=400;
}
}catch(Exception $e){
$error=$e;
}
echo json_encode($return_arr);
}
if($_POST['type']=='edit_questions'){
error_log('edit quetions is working');
try{
$date = date("Y-m-d");
$subject_id = $_POST['subject'];
$topic_id = $_POST['topic_id'];
$standard_id = $_POST['standard'];
$question = $_POST['questions'];
$option_a = $_POST['option_a'];
$option_b = $_POST['option_b'];
$option_c = $_POST['option_c'];
$option_d = $_POST['option_d'];
$answer = $_POST['answer'];
$explanation = $_POST['explanation'];
$video = $_POST['video'];
$ids = $_POST['ids'];
if($_FILES['photo']["name"]!=""){
unlink('../'.$_POST['old_name']);
$file_name = $_FILES['photo']['name'];
$tmp = explode('.', $file_name);
$extension = end($tmp);
//$extension = end(explode(".", $_FILES["photo"]["name"]));
$image = rand(10,1000000000)."-".$date."-org_signature." . $extension;
$upload = move_uploaded_file($_FILES['photo']['tmp_name'], '../upload/image/' . $image);
$banner = 'upload/image/' . $image;
}else{
$banner = $_POST['old_name'];
}
$statement = $pdo->prepare("UPDATE `tbl_questions` SET `subjet_id`=?,`topic_id`=?,`standard_id`=?,`questions`=?,`option_a`=?,`option_b`=?,`option_c`=?,`option_d`=?,`correct_answer`=?,`question_explanation`=?,`video_link`=?,`image`=? WHERE id=?");
$result=$statement->execute(array($subject_id,$topic_id,$standard_id,$question,$option_a,$option_b,$option_c,$option_d,$answer,$explanation,$video,$banner,$ids));
if($result){
$return_arr['message']='Question Updated Successfully...';
$return_arr['status']=200;
}
else{
$return_arr['message']='Something Went Wrong..';
$return_arr['status']=400;
}
}catch(Exception $e){
$error=$e;
}
echo json_encode($return_arr);
}
?>
Zerion Mini Shell 1.0