Location: PHPKode > projects > phpHamLog > phphamlog/phphamlog/cabrillo.php
<?php
################################
# Cabrillo submit form
#
# Copyright 2002 N4FWD
# Released under the GNU GPL License
################################
#include ("configure.php");
include ("auth.php");

#if the user is not logged in, kick them out
$loggedin = false;

session_start();
$result = session_is_registered("logcallid");

switch ($program) {
	case "FIELDDAY":
		if ($result) {
			$tmpcall = $HTTP_SESSION_VARS["logcallid"];
			$sql = "SELECT logcallid, storage FROM cookies WHERE logcallid = '$tmpcall' ";
			$result = mysql_query ($sql, $db)
  				or error_die ("Could not get 'cookies' data from database");
			$myrow = mysql_fetch_array($result);
		}
		break;
	default:
		$sql = "SELECT storage FROM cookies WHERE storeid = '1' ";	
		$result = mysql_query ($sql, $db)
  			or error_die ("Could not check cookie data in database");
		$myrow = mysql_fetch_array($result);
}

switch ($myrow[storage]) {
	case 'Y':
		$loggedin = TRUE;
		break;
	default:
		$loggedin = FALSE;
}

if ($loggedin == false) {
	header("Location: index.php");
}

if ($submit) {
	$claimedscore = 0;
	$startoflog = "2.0";
	$powercat = "LOW";
	$arrlsection = strtoupper($arrlsection);
	// write out Cabrillo header info

	$sql = "INSERT INTO cabrillo (startoflog, contest, callsign, arrlsection, category, powercat, claimedscore, club, soapbox, cabname, address, myexchange ) VALUES
			('$startoflog', '$contest', '$mastercall', '$arrlsection', '$category', '$powercat', '$claimedscore', '$club', '$soapbox', '$cabname', '$address', '$myexchange')";
  	$result = mysql_query ($sql, $db)
  		or error_die ("Could not insert cabrillo data in database");
  	// goto calculation page
	header ("Location: summary.php");
	
} // ########## end of "if ($submit)"

?>
<html>
<head>
<title>phpHamLog: Cabrillo formatted file routine </title>
<meta http-equiv="pragma" content="no-cache">
</head>
<body <?php echo "bgcolor = \"$pagebackground\""; ?>>
<form action="<?php echo $myphphamlogroot?>/cabrillo.php" method="post">
<font face="Arial" size="6"><center><b>Cabrillo Log for 
<?php 
switch ($program) {
	case "FIELDDAY":
		echo $mastercall;
		break;
	default:
		echo $mycallsign; 
} 
?>
</b></center></font><br><br>

<?php
switch ($program) {
	case "FIELDDAY":
		echo "<table>\n";
		echo "<tr>\n";
		echo "	<td size-\"15\" maxlen=\"15\"><font face=\"Arial\" size=\"-2\"><b>Contest Name</b></font></td>\n";
		echo "  <td><font face=\"Arial\" size=\"-2\"><b>Our Exchange</b></font></td>\n";
		echo "	<td><font face=\"Arial\" size=\"-2\"><b>Our ARRL Section</b></font></td>\n";
		echo "	<td><font face=\"Arial\" size=\"-2\"><b>&nbsp;</b></font></td>\n";
		echo "	<td><font face=\"Arial\" size=\"-2\"><b>Our Club's Name</b></font></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "	<td><input type=\"text\" name=\"contest\" size=\"15\" maxlen=\"15\" value=\"\"></td>\n";
		echo "  <td><input type=\"text\" name=\"myexchange\" size=\"5\" maxlen=\"5\" value=\"\"></td>\n";
		echo "	<td><input type=\"text\" name=\"arrlsection\" size=\"10\" maxlen=\"10\" value=\"\"></td>\n";
		echo " <td><select name=\"category\">\n";
    		do {
      			$dbmode = $category;
      			$opcat = $opcategory[key($opcategory)];
      			echo "<option value=\"".$opcat."\"";
      			if (strcmp($opcat, $dbmode) == 0)
        			echo " selected ";
      			echo ">".$opcat."</option>\n";
    		} while (next($opcategory));
    		echo "</select></td>\n";
		echo "	<td><input type=\"text\" name=\"club\" size=\"40\" maxlen=\"40\" value=\"\"></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "	<td><font face=\"Arial\" size=\"-2\"><b>Soapbox</b></font></td>\n";
		echo "<td colspan=3><textarea name=\"soapbox\" rows=10 cols=60 wrap=\"virtual\"></textarea></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "	<td><font face=\"Arial\" size=\"-2\"><b>Name</b></font></td>\n";
		echo "	<td colspan=3><input type=\"text\" name=\"cabname\" size=\"60\" maxlen=\"60\" value=\"\"></td>\n";
		echo "</tr>\n";
		echo "<tr>\n";
		echo "	<td><font face=\"Arial\" size=\"-2\"><b>Address</b></font></td>\n";
		echo "<td colspan=4><textarea name=\"address\" rows=10 cols=60 wrap=\"virtual\"></textarea></td>\n";
		echo "</tr>\n";
		echo "</table>\n";
		echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
		break;
	default:
		/* cabrillo log is currently only for contesting, kick them back if they are in NORMAL logging mode */
		header ("Location: index.php");
}
?>
</form>
</body>
</html>
Return current item: phpHamLog