Quote
<?php virtual('config.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != ""
? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != ""
? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != ""
? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != ""
? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != ""
? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add_news"
) {
$insertSQL = sprintf("INSERT INTO nieuws (id, titel, door, datum, tijd, tekst) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"
,
GetSQLValueString($_POST['titel'], "text"
,
GetSQLValueString($_POST['door'], "text"
,
GetSQLValueString($_POST['datum'], "date"
,
GetSQLValueString($_POST['tijd'], "date"
,
GetSQLValueString($_POST['tekst'], "text"
);
mysql_select_db($database_Nieuws, $Nieuws);
$Result1 = mysql_query($insertSQL, $Nieuws) or die(mysql_error());
$insertGoTo = "/index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[
www.w3.org];
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Area51 -> Nieuws toevoegen</title>
<style type="text/css">
<!--
@import url("/css.css"
;
body {
background-color: #0F0F0F;
}
.headermenu #add_news table {
font-weight: bold;
}
.headermenu #add_news table_tekst {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: normal;
color: #000000;
}
-->
</style>
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas"
});
</script>
</head>
<body>
<table width="950" border="0" align="center" cellpadding="4" cellspacing="0">
<tr align="center">
<td colspan="5"><img src="/images/header.jpg" alt="logo" width="950" height="200" /></td>
</tr>
<tr class="headermenu">
<td align="center"><a href="../index.php">Home</a></td>
<td align="center"><a href="#">Archief</a></td>
<td align="center"><a href="#">Login </a></td>
<td align="center"><a href="#">Register</a></td>
<td align="center"><a href="#">Memberlist</a></td>
</tr>
<tr class="headermenu">
<td colspan="5" align="center"><form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="add_news" id="add_news">
<br />
<table width="100%" border="0" id="add_news">
<tr>
<td width="14%" height="44">Titel van artikel </td>
<td width="86%" id="add_news"><input name="titel" type="text" id="titel" onfocus="if(this.value=='Your message')this.value='';" value="Titel van artikel?" /></td>
</tr>
<tr>
<td height="43">Auteur</td>
<td id="add_news"><input name="door" type="text" id="door" onfocus="if(this.value=='Your message')this.value='';" value="Vul hier de auteur in" /></td>
</tr>
<tr>
<td>Artikel</td>
<td id="add_news"><textarea name="tekst" cols="100" rows="10" id="add_news" onfocus="if(this.value=='Your message')this.value='';">Typ hier jouw artikel</textarea></td>
</tr>
<tr>
<td><input name="datum" type="hidden" id="datum" value="<?php echo date("Y-m-d"
; ?>" />
<input name="id" type="hidden" id="id" />
<input name="tijd" type="hidden" id="tijd" value="<?php $my_t=getdate(date("U"
); print("$my_t[hours]:$my_t[minutes]:$my_t[seconds]"
;?>" /></td>
<td id="add_news">
<input type="submit" name="Submit" value="Verzend" />
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="add_news">
</form>
</td>
</tr>
</table>
</body>
</html>