Question
Examine the code in each piece of the application for this project. Is there sufficient documentation for the code? Are there unnecessary error messages or
Examine the code in each piece of the application for this project. Is there sufficient documentation for the code? Are there unnecessary error messages or inclusions in the code that reveal too much system information to the user? Correct or document any items you find and explain your modifications in the report for this week.
form_dest = 'http://www.petsales.com/index.php';
// Form destination - This can be changed if you want to test it on your own.
$fdest = 'http://www.petsales.com/index.php';
// This sets up functions for PHP use. The form described here manages the user session.
// Print form
function print_form() {
global $fname, $email, $sess;
//echo "Vars: " . $fname . $email . $sess;
//print session variables - email, session, fname
echo '
';}
// Insert database query
function mysql_insert($table, $inserts) {
$values = array_map('mysql_real_escape_string', array_values($inserts));
$keys = array_keys($inserts);
return mysql_query('INSERT INTO `'.$table.'` (`'.implode('`,`', $keys).'`) VALUES (\''.implode('\',\'', $values).'\')');
}
// Check database
function get_db($myquery) {
return mysql_query($myquery);
}
?>
html {
background-color: #fff;
}
frame {
background-color: #fff;
}
// This sets up the page - Do not edit!
function displayfile(myfile) {
var rex;
if (window.XMLHttpRequest){
// If IE7, Mozilla, Safari, etc: Use native object
var req = new XMLHttpRequest();
try {
req.open('GET', myfile, false);
req.send(null);
rex = req.responseText;
loaded = 1;
} catch(err) { rex = ""; }
}
else
{
if (window.ActiveXObject){
// ...otherwise, use the ActiveX control for IE5.x and IE6
var req = new ActiveXObject("Microsoft.XMLHTTP");
try {
req.open('GET', myfile, false);
req.send(null);
rex = req.responseText;
loaded = 1;
} catch(err) { rex = ""; }
}
}
return rex;
}
// This constructs the default page - Do not edit!
document.write(displayfile("include/header.html")); // This file manages the visual aspect of the page
// This runs the primary script for the application
include 'include/main.php';
?>
// This prints the session management form - Do not edit!
print_form();
?>
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started