<?php
if (!$writer){
echo("
<script>
window.alert('이름이 없습니다. 다시 입력해 주세요')
history.go(-1)
</script>
");
exit;
}
if (!$email){
echo("
<script>
window.alert('메일 주소가 없습니다. 다시 입력해 주세요')
history.go(-1)
</script>
");
exit;
}
if (!$topic){
echo("
<script>
window.alert('주제가 없습니다. 다시 입력해 주세요')
history.go(-1)
</script>
");
exit;
}
if (!$content){
echo("
<script>
window.alert('내용이 없습니다. 다시 입력해 주세요')
history.go(-1)
</script>
");
exit;
}
$Connection = mysql_connect("localhost","mysql","");
mysql_select_db("bbs",$Connection);
$Result = mysql_query("select id from $board ", $Connection);
$Total = mysql_num_rows($Result);
if(!$Total){
$id = 1;
}else{
$id = $Total + 1;
}
$wdate = date("y-m-d");
mysql_query("insert into $board(id, writer, email, homepage, passwd, topic, content, hit, wdate) values($id, '$writer', '$email', '$homepage', '$passwd', '$topic', '$content', 0, '$wdate')", $Connection);
//echo "<meta http-equiv='Refresh' content='0; URL=show.php3?board=$board&page=1'>";
echo ("
<html>
<head></head>
<body OnLoad=\document.f1.submit()\>
<form name=\f1\ action=show.php3>
<input type=hidden name=board value=$board>
<input type=hidden name=page value=1>
</form>
</body>
</html>
");
exit;
mysql_close($Connection);
?>
|