APACHE crashes when I execute a FORM
Posted by: dEUS101 (---.access.telenet.be)
Date: December 02, 2006 06:55PM

My APACHE server crashes every time i visit a page with a form on it.
Why is this happening? Lousy code or a bug in WAMPServer?

Thanks smiling smiley
dEUS101

Options: ReplyQuote
Re: APACHE crashes when I execute a FORM
Posted by: yfastud (---.mia.bellsouth.net)
Date: December 02, 2006 07:14PM

What wampserver version are you using? Im having 1.6.5 w/ latest mysql and phpmyadmin version and do use a lot of forms and never had any problem.

Options: ReplyQuote
Re: APACHE crashes when I execute a FORM
Posted by: dEUS101 (---.access.telenet.be)
Date: December 02, 2006 07:16PM

1.6.6 and 1.6.5... Tried them both. I'm now using 1.6.5

I also use Dreamweaver to set up connections, make forms etc.



Post Edited (12-02-06 19:17)

Options: ReplyQuote
Re: APACHE crashes when I execute a FORM
Posted by: yfastud (---.mia.bellsouth.net)
Date: December 02, 2006 07:21PM

in that case check your code

Options: ReplyQuote
Re: APACHE crashes when I execute a FORM
Posted by: dEUS101 (---.access.telenet.be)
Date: December 02, 2006 07:27PM

Well, I just ran it on my other server, a paid host, and it worked over there.
It did gave a "headers already sent" error though... Should i use Output Buffering or somehting?

Options: ReplyQuote
Re: APACHE crashes when I execute a FORM
Posted by: yfastud (---.mia.bellsouth.net)
Date: December 02, 2006 07:59PM

Quote

It did gave a "headers already sent" error though...

he he.... ;-) you've got the answer right there, check your code

About coding, I'm sorry I can't help since I'm a very lumpsy coder, but you can post your code here so cyberspatium or others can help you out.

Options: ReplyQuote
Re: APACHE crashes when I execute a FORM
Posted by: dEUS101 (---.access.telenet.be)
Date: December 02, 2006 08:49PM

Ok, here's the code:
Quote

<?php virtual('config.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""winking smiley
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != ""winking smiley ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != ""winking smiley ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != ""winking smiley ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != ""winking smiley ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != ""winking smiley ? $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"winking smiley) {
$insertSQL = sprintf("INSERT INTO nieuws (id, titel, door, datum, tijd, tekst) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"winking smiley,
GetSQLValueString($_POST['titel'], "text"winking smiley,
GetSQLValueString($_POST['door'], "text"winking smiley,
GetSQLValueString($_POST['datum'], "date"winking smiley,
GetSQLValueString($_POST['tijd'], "date"winking smiley,
GetSQLValueString($_POST['tekst'], "text"winking smiley);

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"winking smiley;
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"winking smiley; ?>" />
<input name="id" type="hidden" id="id" />
<input name="tijd" type="hidden" id="tijd" value="<?php $my_t=getdate(date("U"winking smiley); print("$my_t[hours]:$my_t[minutes]:$my_t[seconds]"winking smiley ;?>" /></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>

This is the config.php :

Quote

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Nieuws = "localhost";
$database_Nieuws = "nieuws";
$username_Nieuws = "********";
$password_Nieuws = "*******************";
$Nieuws = mysql_pconnect($hostname_Nieuws, $username_Nieuws, $password_Nieuws) or trigger_error(mysql_error(),E_USER_ERROR);
?>



Post Edited (12-02-06 20:51)

Options: ReplyQuote


Sorry, only registered users may post in this forum.