Server IP : 162.211.86.152  /  Your IP : 216.73.216.76
Web Server : Apache
System : Linux host.submitandforget.com 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User : pribs ( 1005)
PHP Version : 8.1.34
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/pribs/public_html/../bin/../www/submitandforget.com/requests/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/pribs/public_html/../bin/../www/submitandforget.com/requests/open.php
<?php
$dailylimit = 30;
/*********************************************************************
    open.php

    New tickets handle.

    Peter Rotich <peter@osticket.com>
    Copyright (c)  2006-2013 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require('client.inc.php');
$con = mysql_connect(DBHOST,DBUSER,DBPASS);
if (!$con) {
	die('Could not connect: ' . mysql_error());
}
$db_found = mysql_select_db(DBNAME, $con);
if ($db_found) {
	if (date('H') >= 8) { 
		$refdate = date('Y-m-d'); 
	} 
	else{
		$refdate = date('Y-m-d',strtotime("-1 days")); 
	}
	$SQL = "SELECT SUM(tktcount) as tkttotal FROM ost_tkt_limit WHERE DATE_FORMAT(tktdate, '%Y-%m-%d') = '$refdate'";
	$result = mysql_query($SQL);
	while ($db_field = mysql_fetch_array($result)) {
		$tkttotalc = $db_field['tkttotal'];
		
	}
	if($tkttotalc == ''){
		$tkttotalc = 0;
	}
	$balancetickets = $dailylimit - $tkttotalc;
}
if($balancetickets !=0){

define('SOURCE','Web'); //Ticket source.
$ticket = null;
$errors=array();
if ($_POST) {
    $vars = $_POST;
    $vars['deptId']=$vars['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected.
    if ($thisclient) {
        $vars['uid']=$thisclient->getId();
    } elseif($cfg->isCaptchaEnabled()) {
        if(!$_POST['captcha'])
            $errors['captcha']=__('Enter text shown on the image');
        elseif(strcmp($_SESSION['captcha'], md5(strtoupper($_POST['captcha']))))
            $errors['captcha']=__('Invalid - try again!');
    }

    $tform = TicketForm::objects()->one()->getForm($vars);
    $messageField = $tform->getField('message');
    $attachments = $messageField->getWidget()->getAttachments();
    if (!$errors && $messageField->isAttachmentsEnabled())
        $vars['cannedattachments'] = $attachments->getClean();

    // Drop the draft.. If there are validation errors, the content
    // submitted will be displayed back to the user
    Draft::deleteForNamespace('ticket.client.'.substr(session_id(), -12));
	
	$con = mysql_connect(DBHOST,DBUSER,DBPASS);
	if (!$con) {
		die('Could not connect: ' . mysql_error());
	}
	$db_found = mysql_select_db(DBNAME, $con);
	if ($db_found) {
		$tktstatid = $_POST['tktstatid'];
		$SQL = "SELECT COUNT(*) as tkttotal FROM ost_tkt_limit WHERE id='$tktstatid'";
		$result = mysql_query($SQL);
		while ($db_field = mysql_fetch_array($result)) {
			$tkttotalv = $db_field['tkttotal'];
		}
	}

    //Ticket::create...checks for errors..
	if($tkttotalv >0){
    if(($ticket=Ticket::create($vars, $errors, SOURCE))){
		$con = mysql_connect(DBHOST,DBUSER,DBPASS);
		if (!$con) {
			die('Could not connect: ' . mysql_error());
		}
		$db_found = mysql_select_db(DBNAME, $con);
		if ($db_found) {
			$tktstatid = $_POST['tktstatid'];
			$sqlup = "UPDATE ost_tkt_limit SET tktstat='1' WHERE id='$tktstatid'";
			$result = mysql_query($sqlup);	
		}
        $msg=__('Support ticket request created');
        // Drop session-backed form data
        unset($_SESSION[':form-data']);
        //Logged in...simply view the newly created ticket.
		@header('Location: https://submitandforget.com/thank-you-for-signing-up/');
		exit();
        if($thisclient && $thisclient->isValid()) {
            session_write_close();
            session_regenerate_id();
            //@header('Location: tickets.php?id='.$ticket->getId());
			@header('Location: http://submitandforget.com/thank-you/');
        }
    }else{
        $errors['err']=$errors['err']?$errors['err']:__('Unable to create a ticket. Please correct errors below and try again!');
    }
	}
	else{
		$errors['err']=$errors['err']?$errors['err']:__('Your Session Expired! Please try again by refreshing the Page.');
		@header('Location: index.php');
	}
}

//page
$nav->setActiveNav('new');
if ($cfg->isClientLoginRequired()) {
    if (!$thisclient) {
        require_once 'secure.inc.php';
    }
    elseif ($thisclient->isGuest()) {
        require_once 'login.php';
        exit();
    }
}
	if ($cfg->isClientLoginRequired()) {
    	if ($thisclient->isGuest()) {
		}
		else{
			if (!$_POST) {
				$con = mysql_connect(DBHOST,DBUSER,DBPASS);
					if (!$con) {
						die('Could not connect: ' . mysql_error());
					}
					$db_found = mysql_select_db(DBNAME, $con);
					if ($db_found) {
						$sqlfin = "INSERT INTO ost_tkt_limit (tktdate, tktcount, tktstat)VALUES (NOW(), '1', '0')";
						$result = mysql_query($sqlfin);
						$tktstatid = mysql_insert_id();
					}
			}

		}
	}
	else{
		$con = mysql_connect(DBHOST,DBUSER,DBPASS);
					if (!$con) {
						die('Could not connect: ' . mysql_error());
					}
					$db_found = mysql_select_db(DBNAME, $con);
					if ($db_found) {
						$sqlfin = "INSERT INTO ost_tkt_limit (tktdate, tktcount, tktstat)VALUES (NOW(), '1', '0')";
						$result = mysql_query($sqlfin);
						$tktstatid = mysql_insert_id();
					}
	}
require(CLIENTINC_DIR.'header.inc.php');
if($ticket
        && (
            (($topic = $ticket->getTopic()) && ($page = $topic->getPage()))
            || ($page = $cfg->getThankYouPage())
        )) {
    // Thank the user and promise speedy resolution!
    echo Format::viewableImages($ticket->replaceVars($page->getBody()));
}
else {
    require(CLIENTINC_DIR.'open.inc.php');
}
require(CLIENTINC_DIR.'footer.inc.php');
}
else{
	@header('Location: index.php');
}
session_start();
?>
<script>
function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1);
        if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
    }
    return "";
}

jQuery(document).ready(function(){	
	var email = '<?php echo $_REQUEST['email']; ?>';
	var wantp = getCookie('wantproduct');
	jQuery('.uform input[type=text]:first').val(email);
	jQuery('.pform input[type=text]:first').val(wantp);
});
</script>