Erelid |
|
tis trouwens uw forum script Maar ik vind het ***, dat als geen bericht invult -> error -> back -> bericht weg... dus daarom wil ik daar JS alerts van maken
<?php
if(!isset($_SESSION['suser'])) {
$error = 1;
include("login.php");
} else {
?>
<?php
include ("forum/config.php");
$cat = $_GET['cat'];
?>
<html>
<HEAD>
<script language="JavaScript">
function checkform(theform){
if (theform.titelp.value == ""){
alert("Voer een titel in.");
theform.titelp.focus();
return false;
}
if (theform.bericht.value == ""){
alert("Voer een berichtin.");
theform.bericht.focus();
return false;
}
}
</script>
<script language="Javascript1.2"><!-- // load htmlarea
_editor_url = "../htmlarea/"; // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script>
<script language="JavaScript1.2" defer>
editor_generate('bericht');
</script>
<TITLE><?php echo $forumname; ?></TITLE>
</HEAD>
<BODY>
<?php
$query = mysql_query("SELECT naam FROM categories WHERE id=$cat") or die("q: ".mysql_error());
if(!mysql_num_rows($query)) {
echo "<CENTER>De geselecteerde categorie bestaat niet (meer).<BR>\n";
echo "<A HREF=\"index.php?pagina=forum/categorieen\">Terug naar Categorieën</A><BR></CENTER>\n";
} else {
$naam = mysql_result($query, 0, "naam");
mysql_free_result($query);
echo "<A HREF=\"index.php?pagina=forum/categorieen\">".$forumname."</A> > ";
echo "<A HREF=\"index.php?pagina=forum/forum&cat=$cat\">".$naam."</A> > <B>Nieuw bericht</B><BR>\n";
?>
<BR>
<TABLE WIDTH="457" BORDER="1" align="center" CELLPADDING="2" CELLSPACING="0">
<TR>
<TD WIDTH="449" ALIGN="center">
<?php
if ($_POST['submit']) {
$error = "";
if(trim($_POST['titelp']) == "") $error = "Je moet een titel invullen<BR><BR>";
elseif(trim($_POST['bericht']) == "") $error = "Je moet een bericht invullen<BR><BR>";
if (!$error) {
$naam = $_SESSION['suser'];
$datum = time();
$datum = $datum + 25200;
$query = "INSERT INTO forum (titel, cat, naam, datum, bericht, hits, lastpost)
VALUES ('$titelp', '$cat', '$naam', '$datum', '$bericht', 0, '$datum')";
mysql_query($query) or die(mysql_error());
echo "Het bericht is verzonden.<BR>\n";
echo "klik <A HREF=\"index.php?pagina=forum/forum&cat=$cat\">hier</A> om terug naar het forum te gaan.<BR>\n";
} else {
// errors
echo "<B>".$error."</B><BR>\n";
echo "<FORM ACTION=\"index.php?pagina=forum/nieuwbericht&cat=$cat\" METHOD=\"post\">\n";
echo "<INPUT TYPE=\"submit\" VALUE=\"Terug\">\n";
echo "</FORM>";
}
} else {
?>
<div align="center">
<TABLE WIDTH="439" BORDER="0" align="center" CELLPADDING="2" CELLSPACING="0" CLASS="tf">
<FORM onsubmit="return checkform(frmPost);" name="frmPost" METHOD="post">
<TR>
<TD CLASS="tf" WIDTH="46" ALIGN="right"><B>Titel</B> </TD>
<TD CLASS="tf" WIDTH="385"><INPUT TYPE="text" id="titelp" NAME="titelp" SIZE="30" MAXLENGTH="50">
<input name="naam" type="hidden" id="naam" value="<?=$_SESSION['suser'] ?>"></TD>
</TR>
<TR>
<TD colspan="2" ALIGN="right" VALIGN="top" CLASS="tf"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<div align="left">
<textarea rows="19" cols="70" name="bericht"></textarea>
</div></td>
</tr>
</table></TD>
</TR>
<TR>
<TD CLASS="tf" COLSPAN="2" ALIGN="center"><INPUT TYPE="submit" CLASS="def" NAME="submit" VALUE="Maak onderwerp aan">
</TD>
</TR>
</FORM>
</TABLE>
<?php
} // end else
?>
</div>
</TD>
</TR>
<TR>
<TD WIDTH="449" ALIGN="center"><A HREF="index.php?pagina=forum&cat=<?php echo $cat; ?>">Terug naar Forum</A></TD>
</TR>
</TABLE>
<?php
} // end category exists check
?>
<br>
<br>
<br>
<br>
</BODY>
</HTML>
<?php } ?>
<?php if(!isset($_SESSION['suser'])) { $error = 1; include("login.php"); } else { ?> <?php include ("forum/config.php"); $cat = $_GET['cat']; ?> <html> <HEAD> <script language="JavaScript"> function checkform(theform){ if (theform.titelp.value == ""){ alert("Voer een titel in."); theform.titelp.focus(); return false; } if (theform.bericht.value == ""){ alert("Voer een berichtin."); theform.bericht.focus(); return false; } } </script> <script language="Javascript1.2"><!-- // load htmlarea _editor_url = "../htmlarea/"; // URL to htmlarea files var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; } if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } // --></script> <script language="JavaScript1.2" defer> editor_generate('bericht'); </script> <TITLE> <?php echo $forumname; ?></TITLE> </HEAD> <BODY> <?php echo "<CENTER>De geselecteerde categorie bestaat niet (meer).<BR>\n"; echo "<A HREF=\"index.php?pagina=forum/categorieen\">Terug naar Categorieën</A><BR></CENTER>\n"; } else { echo "<A HREF=\"index.php?pagina=forum/categorieen\">".$forumname."</A> > "; echo "<A HREF=\"index.php?pagina=forum/forum&cat=$cat\">".$naam."</A> > <B>Nieuw bericht</B><BR>\n"; ?> <BR> <TABLE WIDTH="457" BORDER="1" align="center" CELLPADDING="2" CELLSPACING="0"> <TR> <TD WIDTH="449" ALIGN="center"> <?php if ($_POST['submit']) { $error = ""; if(trim($_POST['titelp']) == "") $error = "Je moet een titel invullen<BR><BR>"; elseif(trim($_POST['bericht']) == "") $error = "Je moet een bericht invullen<BR><BR>"; if (!$error) { $naam = $_SESSION['suser']; $datum = $datum + 25200; $query = "INSERT INTO forum (titel, cat, naam, datum, bericht, hits, lastpost) VALUES ('$titelp', '$cat', '$naam', '$datum', '$bericht', 0, '$datum')"; echo "Het bericht is verzonden.<BR>\n"; echo "klik <A HREF=\"index.php?pagina=forum/forum&cat=$cat\">hier</A> om terug naar het forum te gaan.<BR>\n"; } else { // errors echo "<B>".$error."</B><BR>\n"; echo "<FORM ACTION=\"index.php?pagina=forum/nieuwbericht&cat=$cat\" METHOD=\"post\">\n"; echo "<INPUT TYPE=\"submit\" VALUE=\"Terug\">\n"; } } else { ?> <div align="center"> <TABLE WIDTH="439" BORDER="0" align="center" CELLPADDING="2" CELLSPACING="0" CLASS="tf"> <FORM onsubmit="return checkform(frmPost);" name="frmPost" METHOD="post"> <TR> <TD CLASS="tf" WIDTH="46" ALIGN="right"><B>Titel</B> </TD> <TD CLASS="tf" WIDTH="385"><INPUT TYPE="text" id="titelp" NAME="titelp" SIZE="30" MAXLENGTH="50"> <input name="naam" type="hidden" id="naam" value="<?=$_SESSION['suser'] ?>"></TD> </TR> <TR> <TD colspan="2" ALIGN="right" VALIGN="top" CLASS="tf"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div align="left"> <textarea rows="19" cols="70" name="bericht"></textarea> </div></td> </tr> </table></TD> </TR> <TR> <TD CLASS="tf" COLSPAN="2" ALIGN="center"><INPUT TYPE="submit" CLASS="def" NAME="submit" VALUE="Maak onderwerp aan"> </TD> </TR> </FORM> </TABLE> <?php } // end else ?> </div> </TD> </TR> <TR> <TD WIDTH="449" ALIGN="center"><A HREF="index.php?pagina=forum&cat= <?php echo $cat; ?>">Terug naar Forum</A></TD> </TR> </TABLE> <?php } // end category exists check ?> <br> <br> <br> <br> </BODY> </HTML> <?php } ?>
|