emediastudios Posted June 16, 2008 Share Posted June 16, 2008 <?PHP if($_POST[password] == "" && $_SESSION[passed] != "y"){ $content .= "<form method='post' action='admin.php'><input type='password' name='password' value='password'><input type=submit></form>"; } else if($_POST[password] != ""){ if($password == $_POST[password]){ $_SESSION[passed] = "y"; } else{ echo "<script>window.location = 'admin.php';</script>"; } } if($_SESSION[passed] == "y"){ $path = "uploads/"; $path = $path . basename( $_FILES['uploadedfile']['name']); $name = basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $path)) { echo "File ". basename( $_FILES['uploadedfile']['name']). " Uploaded"; } else{ echo "Error"; } $time=date("Y-m-d"); $sql = mysql_query("INSERT INTO newsletter VALUES('NULL','$name','$date')") or die(mysql_error()); $content .= "Newslettr Uploaded"; echo $content; } else{ echo "You Must Be Logged In To Do That"; } ?> Quote Link to comment Share on other sites More sharing options...
shane07 Posted June 16, 2008 Share Posted June 16, 2008 you can use $sql = mysql_query("INSERT INTO newsletter VALUES('$name','$date')") or die(mysql_error()); if nl_id is auto incremented, as far as I understand. Quote Link to comment Share on other sites More sharing options...
emediastudios Posted June 16, 2008 Author Share Posted June 16, 2008 File Newsletter June.pdf UploadedColumn count doesn't match value count at row 1 Quote Link to comment Share on other sites More sharing options...
emediastudios Posted June 16, 2008 Author Share Posted June 16, 2008 File Newsletter June.pdf UploadedColumn count doesn't match value count at row 1 My SQL CREATE TABLE IF NOT EXISTS `newsletter` ( `nl_id` int(11) NOT NULL auto_increment, `nl_file` text NOT NULL, `nl_date` text NOT NULL, KEY `nl_id` (`nl_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.