first commit
This commit is contained in:
16
assets/php/config.php
Normal file
16
assets/php/config.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/* Database credentials. Assuming you are running MySQL
|
||||
server with default setting (user 'root' with no password) */
|
||||
define('DB_SERVER', 'localhost');
|
||||
define('DB_USERNAME', 'devbprieshof_sysd');
|
||||
define('DB_PASSWORD', 'o1X4FzEuGV');
|
||||
define('DB_NAME', 'devbprieshof_sysd');
|
||||
|
||||
/* Attempt to connect to MySQL database */
|
||||
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
|
||||
|
||||
// Check connection
|
||||
if($link === false){
|
||||
die("ERROR: Could not connect. " . mysqli_connect_error());
|
||||
}
|
||||
?>
|
||||
27
assets/php/cuttext.php
Normal file
27
assets/php/cuttext.php
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Cut text to specific length.
|
||||
*
|
||||
* @author JoseRobinson.com
|
||||
* @version 201306301956
|
||||
* @link GitHup: https://gist.github.com/5897554
|
||||
* @param string $str The text to cut.
|
||||
* @param int $limit The maximum number of characters that must be returned.
|
||||
* @param stirng $brChar The character to use for breaking the string.
|
||||
* @param string $pad The string to use at the end of the cutted string.
|
||||
* @return string
|
||||
*/
|
||||
function cutText($str, $limit, $brChar = ' ', $pad = '...')
|
||||
{
|
||||
if (empty($str) || strlen($str) <= $limit) {
|
||||
return $str;
|
||||
}
|
||||
$output = substr($str, 0, ($limit+1));
|
||||
$brCharPos = strrpos($output, $brChar);
|
||||
$output = substr($output, 0, $brCharPos);
|
||||
$output = preg_replace('#\W+$#', '', $output);
|
||||
$output .= $pad;
|
||||
return $output;
|
||||
}
|
||||
38
assets/php/sent-request.php
Normal file
38
assets/php/sent-request.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
if(isset($_REQUEST ['sysType'], $_REQUEST ['sysID'], $_REQUEST ['location'], $_REQUEST ['rusername'], $_REQUEST ['requestype'])){
|
||||
require_once "config.php";
|
||||
|
||||
// Escape user inputs for security
|
||||
$sysID = mysqli_real_escape_string($link, $_REQUEST['sysType'].$_REQUEST['sysID']);
|
||||
$location = mysqli_real_escape_string($link, $_REQUEST['location']);
|
||||
$rusername = mysqli_real_escape_string($link, $_REQUEST['rusername']);
|
||||
$remail = mysqli_real_escape_string($link, $_REQUEST['remail']);
|
||||
$reason = mysqli_real_escape_string($link, $_REQUEST['reason']);
|
||||
|
||||
if($_REQUEST['requestype'] == 'other') {
|
||||
$requestype = mysqli_real_escape_string($link, $_REQUEST['otherrequest']);
|
||||
} else {
|
||||
$requestype = mysqli_real_escape_string($link, $_REQUEST['requestype']);
|
||||
}
|
||||
|
||||
// Attempt insert query execution
|
||||
|
||||
$sql = "INSERT INTO tickets (sysID, location, rusername, remail, reason, requestype ) VALUES ('$sysID', '$location', '$rusername', '$remail', '$reason', '$requestype')";
|
||||
if(mysqli_query($link, $sql)){
|
||||
echo "Records added successfully.";
|
||||
} else{
|
||||
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
|
||||
}
|
||||
|
||||
// Close connection
|
||||
mysqli_close($link);
|
||||
|
||||
|
||||
if($_REQUEST['backendreq'] == '1') {
|
||||
header("location: ../../backend/tickets.php");
|
||||
exit;
|
||||
}
|
||||
header("location: ../../thanks.html");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user