PHP Code:
<p>This page will attempt to insert sample data into MySQL for you.</p>
<?php
include('../includes/db.php');
// Sample News 1
$about = "INSERT INTO news(author, date, newstitle, newstext, category)
(
'Sample',
NOW(),
'About',
'If you\'re the admin, you can put something in here by loging on. If you\'re not the admin, I\'m sure he/she will be along any time now, to delete me, so farewell, incase we don\'t talk again.',
'index'
)";
if(mysql_query($about)) {
echo("The 'About' entry was successfull");
} else {
echo("For some reason we could not enter the 'About' entry to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$aboutfail = "DELETE FROM news";
}
// Sample News 2
$where = "INSERT INTO news(author, date, newstitle, newstext, category)
(
'Sample',
NOW(),
'Where am I?',
'I was built in a small town, that is called, Dongola. By someone who goes by the name of Ja (imagine a y at the end of that, and you'll know how to pronounce it). His real name is Jacob, and he works for a familly owned computer store named, C & S Consulting. Ja, was 15 years old when this part here was typed, but 16 days after that, he would turn 16. I know, I know, the section was titled "Where am I?" but I got carried away, and most of this should have been in the "About" section, but what I put there, had nothing to do with "About" but I put it there anyway.',
'index'
)";
if(mysql_query($where)) {
echo("The 'Where am I?' entry was successfull");
} else {
echo("For some reason we could not enter the 'Where am I?' entry to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$wherefail = "DELETE FROM news";
}
// Sample News 3
$what = "INSERT INTO news(author, date, newstitle, newstext, category) ('Sample', NOW(), 'What to do next...', 'Well I'm assuming you're the admin, so if you are, incase you haven't noticed... Your site is pretty uhmmm bland? if you want to fix that, go back to the documentation I'm sure you followed to get this far, and go to the next section. That should teach you how to delete me, or change me. And the section after that, teaches you how to make me 'pretty'.</p><p>Also, if you ever get to a point where you just can't go any farther, or don't feel like learning this, you can always contact me (email provided at <a href='http://www.jabird.com'>my website</a>) and I would gladly give you a quote, or do it for free, depending on the complexity of it.', 'index')";
if(mysql_query($what)) {
echo("The 'What to do next...' entry was successfull");
} else {
echo("For some reason we could not enter the 'What to do next...' entry to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$whatfail = "DELETE FROM news";
}
// Sample Menu 1
$home = "INSERT INTO menu(name, url, position, is_delete, admin, author, is_logged_in, is_logged_out) ('Home', 'http://" . $domain .'/'. $path . "/index.php', '1', '0', '0', '0', '0', '0')";
if(mysql_query($home)) {
echo("Successfully entered the 'Home' link to the database.");
} else {
echo("For some reason the 'Home' link could not be added to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$homefail = "DELETE FROM menu";
}
// Sample Menu 2
$admin = "INSERT INTO menu(name, url, position, is_delete, admin, author, is_logged_in, is_logged_out) ('Admin', 'http://" . $domain .'/'. $path . "/admin.php', '2', '0', '1', '0', '0', '0')";
if(mysql_query($admin)) {
echo("Successfully entered the 'Admin' link to the database.");
} else {
echo("For some reason the 'Admin' link could not be added to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$adminfail = "DELETE FROM menu";
}
// Sample Menu 3
$user = "INSERT INTO menu(name, url, position, is_delete, admin, author, is_logged_in, is_logged_out) ('User CP', 'http://" . $domain .'/'. $path . "/usercp.php', '3', '0', '0', '1', '0', '0')";
if(mysql_query($user)) {
echo("Successfully entered the 'User CP' link to the database.");
} else {
echo("For some reason the 'User CP' link could not be added to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$userfail = "DELETE FROM menu";
}
// Sample Menu 4
$login = "INSERT INTO menu(name, url, position, is_delete, admin, author, is_logged_in, is_logged_out) ('Login', 'http://" . $domain .'/'. $path . "/login.php', '4', '0', '0', '0', '0', '1')";
if(mysql_query($login)) {
echo("Successfully entered the 'Login' link to the database.");
} else {
echo("For some reason the 'Login' link could not be added to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$loginfail = "DELETE FROM menu";
}
// Sample Menu 5
$logout = "INSERT INTO menu(name, url, position, is_delete, admin, author, is_logged_in, is_logged_out) ('Logout', 'http://" . $domain .'/'. $path . "/logout.php', '5', '0', '0', '0', '1', '0')";
if(mysql_query($logout)) {
echo("Successfully entered the 'Logout' link to the database.");
} else {
echo("For some reason the 'Logout' link could not be added to the database.<br />The error we received was:<br /><textarea cols='40' rows='5'>".mysql_error()."</textarea><br /><br />");
$logoutfail = "DELETE FROM menu";
}
if(mysql_query($about && $where && $what && $home && $admin && $user && $login && $logout)) {
echo("<br /><a href='install3.php'>Next Step</a>");
} else {
echo('Please fix any error(s) received above to continue.');
}
?>
is the entire script...
Bookmarks