Location: PHPKode > projects > Standardized Test Practice Engine > stpe/admin/newadder.php
<?php
/*
Copyright 2004 by Jonathan Bell and Daniel Perelman
This file is part of STPE - the Standardized Test Practice Engine.

    STPE is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    STPE is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
include_once("../globals.inc.php");
?>
<?php
include("login.inc.php");

include_once("../dbinit.inc.php");
	if(isset($_POST['newtopicnum'])){
	$code = substr(md5($_POST['newtopicnum'].$_POST['newsectionnum']."23".$thisnames),0,12);
	$sql = "INSERT INTO users
	(topicnum,topicdesc,sectionnum,sectiondesc,names,code,teachername)
	VALUES
	(\"".$_POST['newtopicnum']."\",\"".$_POST['newtopicdesc']."\",\"".$_POST['newsectionnum']."\",\"".$_POST['newsectiondesc']."\",\"".$_POST['newnames']."\",\"$code\",\"".$_POST['newteachername']."\")";
	$result = @mysql_query($sql, $connection) or die("Error #". mysql_errno() . ": " . mysql_error());
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php echo $site_name; ?> Admin</title>

<link rel="stylesheet" type="text/css" href="../style.css" />
</head>
<body>
<?php include("../header.inc.php"); ?>
	<table>
		<tr valign="top">
			<?php include("../nav.inc.php"); ?>
			<td class="maincontent">
				<h2>Add a test adding user</h2>
				<form action="newadder.php" method="post">
	<p>Add a new section:
	<input type="hidden" name="action" value="add" /></p>
	<table>
	<tr><th>Topic Number</th><th>Topic Description</th><th>Section Number</th><th>Section Description</th><th>Names</th><th>Teacher Name</th></tr>
	<tr><td><input type="text" name="newtopicnum" /></td><td><input type="text" name="newtopicdesc" /></td><td><input type="text" name="newsectionnum" /></td><td>
	<input type="text" name="newsectiondesc" /></td><td><input type="text" name="newnames" /></td><td><input type="text" name="newteachername" /></td></tr>
	</table>
	<p><input type="submit" name="Add new" value="Add new" /></p>
	</form>
			</td>
		</tr>
	</table>
<?php include("../footer.inc.php"); ?>
</body>
</html>
Return current item: Standardized Test Practice Engine