Location: PHPKode > projects > Butterfly Organizer > input.php
Butterfly Organizer
Copyright (C) 2007-2008 Butterfly Media Romania

This file is part of Butterfly Organizer.

Butterfly Organizer is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


echo '<h2>Add New Site</h2>';

$mytable = $_GET['mytable'];

if(isset($_POST['submit'])) {
	$currentDate = date("F j, Y, g:i a");

	$id = $_POST['id'];
	$date = $_POST['date'];
	$reference = $_POST['reference'];
	$name = $_POST['name'];
	$url = $_POST['url'];
	$username = $_POST['username'];
	$password = $_POST['password'];
	$notes = $_POST['notes'];
	$other = $_POST['other'];

	$sql = "INSERT INTO ".$mytable." (id, date, reference, name, url, username, password, notes, other, lastmodified) VALUES ('$id', '$date', '$reference', '$name', '$url', '$username', '$password', '$notes', '$other', '$currentDate')";
	$result = mysql_query($sql);
	echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php\" />";
else {
	echo "<form method='post' action='input.php?mytable=".$mytable."' id='myform'>";
	echo "<table cellspacing='1' cellpadding='2' class='mainTable'>";
	echo "<tr><td class='td_title'>ID:</td><td class='td_content'><input type='text' name='id' readonly='readonly' /></td></tr>";
	echo "<tr><td class='td_title'>Date:</td><td class='td_content'><input type='text' name='date' value=".date('d.m.Y')." /></td></tr>";
	echo "<tr><td class='td_title'>Reference:</td><td class='td_content'><input type='text' name='reference' /></td></tr>";
	echo "<tr><td class='td_title'>Name:</td><td class='td_content'><input type='text' name='name' /></td></tr>";
	echo "<tr><td class='td_title'>URL Address:</td><td class='td_content'><input type='text' name='url' value='http://' /></td></tr>";
	echo "<tr><td class='td_title'>Username:</td><td class='td_content'><input type='text' name='username' /></td></tr>";
	echo "<tr><td class='td_title'>Password:</td><td class='td_content'><input type='text' name='password' id='password' onKeyUp=\"runPassword(this.value, 'password');\" /> <span id='password_text' style='font-size: 10px;'></span><div id='password_bar' style='font-size: 1px; height: 6px; width: 0px; border: 1px solid white;'></div></td></tr>";
	echo "<tr><td class='td_title'>Notes:</td><td class='td_content'><textarea class='expanding' name='notes' ></textarea></td></tr>";
	echo "<tr><td class='td_title'>Other:</td><td class='td_content'><textarea class='expanding' name='other' cols='40'></textarea></td></tr>";
	echo "<tr><td class='td_title' colspan='2'><input type='submit' name='submit' value='Add' /></td></tr>";
	echo "</table>";
	echo "</form>";

Return current item: Butterfly Organizer