D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
epksuofuukz9
/
www
/
admin
/
php
/
Filename :
function.php
back
Copy
<?php session_start(); include("../includes/functions.php"); if(isset($_GET) && $_GET['action'] == 'leade'){ $delete="DELETE FROM `leads` WHERE id='".$_GET['id']."'"; $run_insert_post=query($delete); if($run_insert_post){ echo json_encode(['success'=>true,'message'=>'Lead deleted successfully!']); die; } } if(isset($_POST) && $_GET['action'] == 'enquiry'){ $post = $_POST; $name = $post['name']; $email = $post['email']; $number1 = $post['number1']; $course = $post['course']; $course_type = $post['course_type']; $msg = $post['msg']; $to = 'intikhabalam2020@hotmail.com'; $subject = 'Website Enquiry Form'; $req='Enquiry User'; $message =' <html> <head> <title>Website Enquiry Form</title> </head> <body> <p style="font-family:Arial, Helvetica, sans-serif; color:#FF0000; font-size:16px; font-weight:600;">Enquiry Form </p> <table width="500" border="1" style="border:1px solid #CCCCCC;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;border-radius:5px; border-collapse:collapse;" > <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Full name</td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$name.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Email address </td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$email.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Contact Number</td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$number1.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Course</td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$course.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Course Type</td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$course_type.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Message</td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$msg.'</td> </tr> </table> </body> </html>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: $req <intikhabalam2020@hotmail.com>" . "\r\n"; mail($to, $subject, $message, $headers); if(empty($post['name'])){ echo json_encode(['success'=>false,'error'=>'Name is required!']); die; }if(empty($post['number1'])){ echo json_encode(['success'=>false,'error'=>'Mobile No is required!']); die; }if(empty($post['email'])){ echo json_encode(['success'=>false,'error'=>'Email is required!']); die; }if(empty($post['course'])){ echo json_encode(['success'=>false,'error'=>'Course is required!']); die; }if(empty($post['course_type'])){ echo json_encode(['success'=>false,'error'=>'Training Mode is required!']); die; }if(empty($post['msg'])){ echo json_encode(['success'=>false,'error'=>'Meesage is required!']); die; } if($_REQUEST['session_captcha'] !=$_REQUEST['captcha']){ echo json_encode(['success'=>false,'error'=>'Invalid captcha!']); die; } $sql="INSERT INTO `leads`(`name`,`email`, `mobile_no`, `type`, `course_name`, `training`, `message`) VALUES ('".$post['name']."','".$post['email']."','".$post['number1']."','".$_GET['action']."','".$post['course']."','".$post['course_type']."','".$post['msg']."' )"; $query=query($sql); if($query){ echo json_encode(['success'=>true,'message'=>'Request send successfully!']); die; } } if(isset($_POST) && $_GET['action'] == 'demo_leads'){ $post = $_POST; $name = $post['name']; $email = $post['email']; $mobile_no = $post['mobile_no']; $to = 'intikhabalam2020@hotmail.com'; $subject = 'Website Enquiry Form'; $req='Enquiry User'; $message =' <html> <head> <title>Website Enquiry Form</title> </head> <body> <p style="font-family:Arial, Helvetica, sans-serif; color:#FF0000; font-size:16px; font-weight:600;">Enquiry Form </p> <table width="500" border="1" style="border:1px solid #CCCCCC;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;border-radius:5px; border-collapse:collapse;" > <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Full name</td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$name.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Email address </td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$email.'</td> </tr> <tr style="background:#f5f5f5"> <td style="border-bottom:0px dotted black;padding:5px; color:#0066FF; font-weight:600; font-size:13px;" width="123"> Country Code </td> <td style="border-bottom:0px dotted black;padding:5px;" width="361">'.$mobile_no.'</td> </tr> </table> </body> </html>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: $req <intikhabalam2020@hotmail.com>" . "\r\n"; mail($to, $subject, $message, $headers); if(empty($post['name'])){ echo json_encode(['success'=>false,'error'=>'Name is required!']); die; }if(empty($post['mobile_no'])){ echo json_encode(['success'=>false,'error'=>'Mobile No is required!']); die; }if(empty($post['email'])){ echo json_encode(['success'=>false,'error'=>'Email is required!']); die; } $sql="INSERT INTO `leads`(`name`,`email`, `mobile_no`, `type`, `url`) VALUES ('".$post['name']."','".$post['email']."','".$post['mobile_no']."','".$_GET['action']."','".$post['url']."' )"; $query=query($sql); if($query){ echo json_encode(['success'=>true,'message'=>'Request send successfully!']); die; } } if(isset($_POST) && $_GET['action'] == 'add_course'){ $post = $_POST; $data = []; if(empty($post['course_id'])){ $data['course'] = 'Course is required!'; }if(empty($post['offer'])){ $data['offer'] = 'Offer is required!'; }if(empty($post['rating_value'])){ $data['rating_value'] = 'Rating value is required!'; }if(empty($post['rating_point'])){ $data['rating_point'] = 'Rating point is required!'; }if(empty($post['contents'])){ $data['contents'] = 'Description is required!'; } if(empty($post['course_id']) || empty($post['offer']) || empty($post['rating_value']) || empty($post['rating_point']) || empty($post['contents'])){ echo json_encode(['success'=>false,'errors'=>$data]); die(); } $insert_post="INSERT INTO `course_header_content`(`course_id`,`offer`, `rating_value`, `rating_point`, `description`, `type_menu`) VALUES ('".$post['course_id']."','".$post['offer']."','".$post['rating_value']."','".$post['rating_point']."','".$post['contents']."','".$post['type_menu']."')"; $run_insert_post=query($insert_post); if($run_insert_post){ echo json_encode(['success'=>true,'message'=>'Course added successfully!']); die; } } if(isset($_GET) && $_GET['action'] == 'delete_course'){ $delete="DELETE FROM `course_header_content` WHERE id='".$_GET['id']."'"; $run_insert_post=query($delete); if($run_insert_post){ echo json_encode(['success'=>true,'message'=>'Course deleted successfully!']); die; } } if(isset($_POST) && $_GET['action'] == 'update_course'){ $post = $_POST; $data = []; if(empty($post['course_id'])){ $data['course'] = 'Course is required!'; }if(empty($post['offer'])){ $data['offer'] = 'Offer is required!'; }if(empty($post['rating_value'])){ $data['rating_value'] = 'Rating value is required!'; }if(empty($post['rating_point'])){ $data['rating_point'] = 'Rating point is required!'; }if(empty($post['contents'])){ $data['contents'] = 'Description is required!'; } if(empty($post['course_id']) || empty($post['offer']) || empty($post['rating_value']) || empty($post['rating_point']) || empty($post['contents'])){ echo json_encode(['success'=>false,'errors'=>$data]); die(); } //$insert_post="INSERT INTO `course_header_content`(`course_id`,`offer`, `rating_value`, `rating_point`, `description`, `type_menu`) VALUES ('".$post['course_id']."','".$post['offer']."','".$post['rating_value']."','".$post['rating_point']."','".$post['contents']."','".$post['type_menu']."')"; $update_post="UPDATE `course_header_content` SET `course_id`='".$post['course_id']."',`offer`='".$post['offer']."',`rating_value`='".$post['rating_value']."',`rating_point`='".$post['rating_point']."',`description`='".$post['contents']."',`type_menu`='".$post['type_menu']."' WHERE id='".$_GET['id']."'"; $query=query($update_post); if($query){ echo json_encode(['success'=>true,'message'=>'Course updated successfully!']); die; } } if(isset($_GET) && $_GET['action'] == 'get_data'){ $i=1; $get_all="SELECT * FROM course_header_content ORDER BY id DESC"; $run_all=query($get_all); $html = ' <tr> <th>#.</th> <th>Course Name</th> <th>Offer</th> <th>Rating Value</th> <th>Rating Point</th> <th>Date & Time</th> <th>Action</th> </tr> '; while($row=fetch($run_all)){ $get_all2="SELECT course_name FROM courses where course_id='".$row['course_id']."'"; $query=query($get_all2); $course=fetch($query); $coursename = $course['course_name']; if(row_count($query) < 1){ $get_all2="SELECT menu_course_courses_name FROM menu_course where menu_course_id='".$row['course_id']."'"; $query=query($get_all2); $course=fetch($query); $coursename = $course['menu_course_courses_name']; } $html.='<tr row-id="'.$row['id'].'"> <td>'.$i++.'</td> <td>'.$coursename.'</td> <td>'.$row['offer'].'</td> <td>'.$row['rating_value'].'</td> <td>'.$row['rating_point'].'</td> <td>'.$row['created_at'].'</td> <td><a href="manage_course.php?page=edit&id='.$row['id'].'">Edit</a> | <a class="del" href="javascript:void(0);">Delete</a> </td> </tr>'; } $html.=' <tr> <th>#.</th> <th>Course Name</th> <th>Offer</th> <th>Rating Value</th> <th>Rating Point</th> <th>Date & Timee</th> <th>Action</th> </tr> '; echo json_encode(['success'=>true,'html'=>$html]); die; } function get_course_content(){ $url = end(explode('/',get_url())); $sql = "SELECT courses.course_name, course_header_content.* FROM courses left JOIN course_header_content ON courses.course_id = course_header_content.course_id where courses.slug_url='".$url."'"; $query=query($sql); // print_r(fetch($query)); // die; // $sql="SELECT * FROM course_header_content where course_id='".$id."'"; // $query=query($sql); return fetch($query); } function get_menu_course_content(){ $url = end(explode('/',get_url())); $sql = "SELECT menu_course.menu_course_courses_name, course_header_content.* FROM menu_course left JOIN course_header_content ON menu_course.menu_course_id = course_header_content.course_id where menu_course.menu_course_slug_url='".$url."'"; $query=query($sql); return fetch($query); } function get_course($id){ $sql="SELECT course_name FROM courses where course_id='".$id."'"; $query=query($sql); return fetch($query); } function get_url(){ return $_SERVER['REQUEST_URI']; } ?>