HEX
Server: LiteSpeed
System: Linux lp015.web24.net.au 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64
User: pgkdistr (10190)
PHP: 8.1.32
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/pgkdistribution.com.au/citisolar.com.au/gatehouse/add.php
<?php 
	 include_once('db.php');
	session_start();
	if ($_SESSION['ref'] == 'procadd') {
		if (strlen ($_SESSION['mysqlerr']) > 0) {
			echo $_SESSION['mysqlerr']."<br/>Row not added properly!";
		}
	}
	$_SESSION['ref'] = 'add';
?>
<html>
	<head>
	<script language="javascript">
	function SubmitForm()
	{
		var form = document.forms[0];
		var bRequired = true;
		if ((form.scorder.value.length < 1) || (form.address.value.length < 1) || (form.codes.value.length < 1) || (form.txtDate.value.length < 1)) {
			alert("Please fill out all the required fields.");
			bRequired = false;
		}
		
		scorder = form.scorder.value;
		
		if (isNaN(scorder)) {
			alert("Invalid scorder number.");
			bRequired = false;
		}
		
		datepat = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
		txtdate = form.txtDate.value;
		
		if (!datepat.test(txtdate)) {
			alert("Date has to be in this format yyyy-mm-dd");
			bRequired = false;
		}
		
		if (!bRequired) return false;
		
		form.submit();
	}
	</script>
	</head>
	<body>
		<h2>Add New Row</h2>
		<h3><a href="index.php">Back to Home Page</a></h3>
		<h3><a href="logout.php">Logout</a></h3>
		<form name="addForm" action="procadd.php" method="post">
			<table>
				<tr valign="top" height="20">
					<td align="left">Date:</td>
					<td><input type="text" name="txtDate" value="yyyy-mm-dd" size="25" maxlength="10"></td>
				</tr>
				<tr valign="top" height="20">
					<td>&nbsp;</td>
					<td align="center"><input type="button" name="cmdCal" value="Launch Calendar" onClick='javascript:window.open("calender.php?form=addForm&field=txtDate","","top=400,left=400,width=175,height=140,menubar=no,toolbar=no,scrollbars=no,resizable=no,status=no"); return false;'> </td>
				</tr>
				<tr valign="top" height="20">
					<td align="left">SC Order Num:</td>
					<td><input type="text" name="scorder" size="25" maxlength="25"></td>
				</tr>
				<tr valign="top" height="20">
					<td align="left">Address:</td>
					<td><input type="text" name="address" size="100" maxlength="255"></td>
				</tr>
				<tr valign="top" height="20">
					<td align="left">Appliance:</td>
					<td><select name="appliance">

<?php
	$result = mysqli_query($conn, "SELECT * FROM appliance");

	while ($row = mysqli_fetch_array($result)) {
		echo "<option value=\"".$row{'app_id'}."\">".$row{'app_name'}."</option>";
	}
?>
					</select></td>
				</tr>
				<tr valign="top" height="20">
					<td align="left">Codes:</td>
					<td><input type="text" name="codes" size="100" maxlength="255"></td>
				</tr>
				<tr valign="top" height="20">
					<td align="left">Tradesman:</td>
					<td><select name="tradesman">

<?php
	$result = mysqli_query($conn, "SELECT * FROM tradesman");

	while ($row = mysqli_fetch_array($result)) {
		echo "<option value=\"".$row{'trade_id'}."\">".$row{'trade_name'}."</option>";
	}
?>
					</select></td>
				</tr>
                                <tr valign="top" height="20">
                                        <td align="left">Invoice Number:</td>
                                        <td><input type="text" name="invoicenum" size="50" maxlength="50"></td>
                                </tr>
			</table>
			<input type="submit" name="submitForm" value="Add Row" onclick="SubmitForm();  return false;" >
  			<input type="reset" name="resetForm" value="Reset">
		</form>
	</body>
</html>