File "ticket-vendor.php"
Full Path: /home/u165092617/domains/tadzz.com/public_html/forms/ticket-vendor.php
File size: 2.42 KB
MIME-type: text/x-php
Charset: utf-8
<?php session_start();
require_once("../config/config.php");
//require_once("../config/commonsetting.php");
$myformId=SESS_MASTER;
$myIp= ipCheck() ;
$dateceated=date("Y-m-d G:i:s");
$createdby='0';
$full_name = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'name']);
$ticket_cat = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'ticket_cat']);
$message = secureSuperGlobalPOST($_REQUEST[SESS_MASTER.'message']);
$user_id=$_SESSION[ADD_TAG.'_UserId_vendor'];
$sql = "SELECT * FROM ticket_master ORDER BY rowId ASC";
$myquery=$conn->query($sql);
$mydara= $myquery->fetchAll() ;
$rows_found = $myquery->rowCount();
if($rows_found==0){
$ticket_no='1001';
}else{
foreach( $mydara as $row ) {
$ticket_no = $row['ticket_no'];
$u_id = $row['user_id'];
if($u_id==$user_id){
$activestatus = $row['activestatus'];
$user_type = $row['user_type'];
if($activestatus=='0'&&$user_type=='1'){
$status = $activestatus;
header("location:../vendor-profile");
}
}
}
$ticket_no=$ticket_no+1;
}
if($_POST&&$status==''){
try{
$olgaquery="INSERT INTO ticket_master SET createdIp='$myIp',datecreated='$dateceated',createdby='$createdby', full_name='$full_name',ticket_category='$ticket_cat',ticket_status='0',user_id='$user_id',ticket_no='$ticket_no',user_type='1',activestatus='0'";
$stmt = $conn->prepare($olgaquery);
if($stmt->execute()){
$last_insert_id = $conn->lastInsertId();
$olgaquerys="INSERT INTO ticket_message SET createdIp='$myIp',datecreated='$dateceated',createdby='$createdby', message='$message',user_id='$user_id',ticket_id='$last_insert_id',user_type='1',activestatus='0'";
$stmts = $conn->prepare($olgaquerys);
if($stmts->execute()){
$_SESSION["ticket"] = $last_insert_id ;
header("location:../vendor-id/5");
}
}
}
// show error
catch(PDOException $exception){
die('ERROR: ' . $exception->getMessage());
}
}
?>