har fundet en simpel blog jge vil udbygge. har lige testen den. når jeg prøver at tilføje noget til bloggen får jeg denne fejl: Out of range value adjusted for column 'id' at row 1. hvad kan det være?
kode:
<?php
session_start();
if (!isset($_SESSION['laccess']) && $_POST['referer'] != 'login') {
header("Location: index.php?f=needlogin");
exit;
}
include('../inc.config.php');
if ($_POST['referer'] == 'login') {
if ($_POST['username'] == $cfg['admin']['username'] && $_POST['password'] == $cfg['admin']['password']) {
$_SESSION['laccess'] = 1;
header("Location: administration.php");
} else {
header("Location: index.php?f=wronglogin");
}
}
if ($_POST['referer'] == 'post_news') {
if ($_FILES['image']['name'] != '') {
$image = time().substr($_FILES['image']['name'],strrpos($_FILES['image']['name'],'.'));
move_uploaded_file($_FILES['image']['tmp_name'], '../files/'.$image);
} elseif ($_POST['standard'] != '') {
$image = $_POST['standard'];
} else {
$image = '';
}
mysql_query("INSERT INTO news VALUES ('','".$_POST['title']."','".$_POST['author']."',now(),'".$_POST['synopsis']."','".$_POST['text']."','".$image."')") or die(mysql_error());
header("Location: news.list.php");
}
if ($_POST['referer'] == 'edit_news') {
mysql_query("UPDATE news SET title='".$_POST['title']."', author='".$_POST['author']."', synopsis='".$_POST['synopsis']."', text='".$_POST['text']."', image='".$_POST['image']."' WHERE id=".$_POST['id']."") or die(mysql_error());
header("Location: news.list.php?offset=".$_POST['offset']);
}
if ($_POST['referer'] == 'upload') {
for ($i=0;$i<count($_FILES['file']['name']);$i++) {
if ($_FILES['file']['name'][$i] != '') {
move_uploaded_file($_FILES['file']['tmp_name'][$i], '../files/'.$_FILES['file']['name'][$i]);
}
}
header("Location: files.list.php");
}
?>
Indlæg senest redigeret d. 13.04.2007 16:49 af Bruger #10050