I used the slackpkg update and upgraded my php. But after doing so I had a php/mysql page break with the following errors. This was a fresh iso install of Slackware 13.37 that has 5.3.6 on it and it worked fine.
[Sun Nov 06 10:12:36 2011] [error] [client 192.168.4.3] PHP Notice: Undefined index: s in /var/www/htdocs/List/
Search.php on line 6
[Sun Nov 06 10:12:36 2011] [error] [client 192.168.4.3] PHP Notice: Undefined index: s in /var/www/htdocs/List/
template.php on line 91
I have attached the two pages in question. I did not write this code and I’m not able to get a hold of the coder that did this.
gd shows up in the info.php
Here is the two files from the errors. If you need any of the others I can put those up also.
Thank you for your help.
Bob
//Search.php
<?php
require_once "dbConnect.php";
Class Search {
private $ResultArray, $numRows;
public function __construct() {
if ($_GET['s']) {
$safeQuery = mysql_real_escape_string($_GET['s']);
$theQuery = "SELECT * from parts WHERE part_num LIKE '%$safeQuery%' OR dealer LIKE '%$safeQuery%' OR retail LIKE '%$safeQuery%' OR uom LIKE '%$safeQuery%' OR page LIKE '%$safeQuery%' OR product_desc LIKE '%$safeQuery%'";
$res = mysql_query($theQuery);
$this->numRows = mysql_num_rows($res);
$i = 0;
while ($result = mysql_fetch_array($res)) {
$this->ResultArray[$i] = $result;
$i++;
}
}
else { $this->numRows = -1; }
}
public function getResult() {
return $this->ResultArray;
}
public function getNumRows() {
return $this->numRows;
}
public function __destruct() {
mysql_close();
}
}
?>
//Template.php
<?php
require_once "config.php";
require_once "recaptcha-php-1.11/recaptchalib.php";
global $captchaPublicKey;
Class Template {
public $ResultArray, $numRows = 0;
private $tmpCurr;
public function SimpleGenerate() {
echo $this->tmpCurr;
}
public function Generate() {
$captcha = new CaptchaKeys();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css">
<LINK REL="StyleSheet" HREF="thickbox.css" TYPE="text/css">
<script type="text/javascript" src="jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="thickbox-compressed.js"></script>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js?legacy"></script>
<script language="javascript">
function removeItem (ItemId) {
$('#removeImg-'+ItemId).attr("src","img/loader.gif");
$.get("deleteCart.php",{id:ItemId},function(result) {
$('#'+ItemId).html(" ");
$("#totalPrice").html(result);
});
}
function updateItem (ItemId) {
$("#loading-"+ItemId).html('<img src="img/loader.gif"/>');
$.get("updateQuantity.php",{id:ItemId,q:$("#quantity-"+ItemId).val()},function(result){
$("#total-"+ItemId).html(result);
$("#loading-"+ItemId).html(" ");
$("#totalPriceLoading").html('<img src="img/loader.gif"/>');
$.get("totalPrice.php",{},function(result){
$("#totalPrice").html(result);
$("#totalPriceLoading").html(' ');
});
});
}
function updateInfo () {
$("#loading-info").html('<img src="img/loader.gif"/> Updating...');
$.get("updateInfo.php",{email:$("#mail").val(),name:$("#name").val(),address:$("#address").val(),city:$("#city").val(),state:$("#state").val(),zip:$("#zip").val(),phone:$("#phone").val()},function(result){
if (result == "Mail Error") {
$("#error-info").html('* Please enter a valid mail address');
}
if (result == "Mail Success")
$("#error-info").html('');
$("#loading-info").html('');
});
}
function Finish () {
$("#mainloading").html('<img src="img/loader.gif"/>');
$.post("Finish.php",{recaptcha_challenge_field: Recaptcha.get_challenge(),recaptcha_response_field: Recaptcha.get_response()},function (result) {
if (result == "Error") {
$("#mainloading").html('<b>Please Enter Correct Code</b>');
Recaptcha.reload();
}
else {
$("#main").html(result);
}
});
}
function FinishNoVal () {
$("#mainloading").html('<img src="img/loader.gif"/>');
$.post("Finish.php",{},function (result) {
$("#main").html(result);
Recaptcha.create("<?=$captcha->getPublic()?>","Captcha",{theme: "white", callback: Recaptcha.focus_response_field});
});
}
</script>
</head>
<body>
<?=$this->tmpCurr?>
</body>
</html>
<?php
}
public function SearchPage() {
$this->tmpCurr = '
<div id="search">
<form action="index.php" method="GET">
Search: <input type="text" value="'.htmlentities($_GET['s']).'" name="s"/> <input type="submit" value="Search!"/>
</form>
</div>
<br/>';
if ($this->numRows == 0) {
$this->tmpCurr .= "No result";
}
elseif ($this->numRows > 0) {
$this->tmpCurr .= '
<div id="table_container">
<div id="table_row">
<div id="table_cell" class="header">Part #</div>
<div id="table_cell" class="header">Dealer Cost</div>
<div id="table_cell" class="header">Markup</div>
<div id="table_cell" class="header">Retail Cost</div>
<div id="table_cell" class="header">UOM Type</div>
<div id="table_cell" class="header">Page#</div>
<div id="table_cell" class="header">Description</div>
<div id="table_cell" class="header">Add</div>
</div>';
$markup = new Markup();
for ($i = 0; $i < $this->numRows; $i++) {
$this->tmpCurr .= '
<div id="table_row">
<div id="table_cell" class="cell">'.$this->ResultArray[$i]['part_num'].'</div>
<div id="table_cell" class="cell">'.number_format(round($this->ResultArray[$i]["dealer"], 2), 2).'</div>
<div id="table_cell" class="cell">'.number_format(round($markup->Calc($this->ResultArray[$i]["dealer"]) , 2), 2).'</div>
<div id="table_cell" class="cell">'.number_format(round($this->ResultArray[$i]["retail"], 2), 2).'</div>
<div id="table_cell" class="cell">'.$this->ResultArray[$i]['uom'].'</div>
<div id="table_cell" class="cell">'.$this->ResultArray[$i]['page'].'</div>
<div id="table_cell" class="cell">'.$this->ResultArray[$i]['product_desc'].'</div>
<div id="table_cell" class="cell"><a class="thickbox" href="addCart.php?id='.$this->ResultArray[$i]["id"].'&height=480">Add to cart</a></div>
</div>';
} // end for
$this->tmpCurr .= '</div>';
} //end No Result else
}
public function ListItems ($list) {
$this->tmpCurr = '<div id="main"><div id="listtable_container"><div class="table_row"><div id="table_cell">Item #</div><div id="table_cell">Description</div><div id="table_cell">Quantity</div><div id="table_cell">Markup</div><div id="table_cell">Total</div><div id="table_cell">Remove</div></div>';
$ItemsArray = $list->ListItems();
if ($ItemsArray) {
$markup = new Markup();
foreach ($ItemsArray as $key=>$Item) {
$this->tmpCurr .= '<div id="'.$Item->id.'" class="table_row"><div id="table_cell">'.$Item->partnum.'</div><div id="table_cell">'.$Item->description.'</div><div id="table_cell"><input type="text" onChange="updateItem(\''.$Item->id.'\');" style="width:25px" id="quantity-'.$Item->id.'" value="'.$Item->quantity.'"/><span id="loading-'.$Item->id.'"></span></div><div id="table_cell">'.number_format(round($markup->Calc($Item->price),2),2).'</div><div id="table_cell"><span id="total-'.$Item->id.'">'.number_format(round($markup->Calc($Item->price),2)*$Item->quantity,2).'</span></div><div id="table_cell"><a href="javascript:removeItem(\''.$Item->id.'\')"><img border="0" id="removeImg-'.$Item->id.'" src="img/delete.gif"/></a></div></div>';
}
}
$this->tmpCurr .= '</div>';
$this->tmpCurr .= '<div id="dtotalPrice"><span id="totalPriceLoading"></span> Total Price: <span id="totalPrice">'.number_format($list->totalPrice(),2).'</span></div>';
$this->tmpCurr .= '<div class="leftSide" id="listtable_container">' .
'<div class="table_row"><div id="table_cell">Email:</div> <div id="table_cell"><input value="'.$list->getEmail().'" onChange="updateInfo();" type="text" id="mail" /> </div></div>' .
'<div class="table_row"><div id="table_cell">Name:</div> <div id="table_cell"><input value="'.$list->getName().'" onChange="updateInfo();" type="text" id="name" /></div></div>' .
'<div class="table_row"><div id="table_cell">Address:</div> <div id="table_cell"><input value="'.$list->getAddress().'" onChange="updateInfo();" type="text" id="address" /></div></div>' .
'<div class="table_row"><div id="table_cell">City:</div> <div id="table_cell"><input value="'.$list->getCity().'" onChange="updateInfo();" type="text" id="city" /></div></div>' .
'<div class="table_row"><div id="table_cell">State:</div> <div id="table_cell"><input value="'.$list->getState().'" onChange="updateInfo();" type="text" id="state" /></div></div>' .
'<div class="table_row"><div id="table_cell">ZipCode:</div> <div id="table_cell"><input value="'.$list->getZip().'" onChange="updateInfo();" type="text" id="zip" /></div></div>' .
'<div class="table_row"><div id="table_cell">Phone:</div> <div id="table_cell"><input value="'.$list->getPhone().'" onChange="updateInfo();" type="text" id="phone" /></div></div>' .
'</div>' .
'<span id="loading-info"></span><br/><span id="error-info"></span>';
$this->tmpCurr .= '<div id="continue"><input onClick="tb_remove();" style="height:30px;padding:5px" type="button" value="Continue"></div> <div id="finish"><input style="height:30px;padding:5px;" type="button" OnClick="FinishNoVal();" value="Finish"/></div><div id="continue"><input type="button" value="Update Cart" style="height:30px;padding:5px"/></div>' .
'</div>';
}
public function captchaForm () {
?>
Please enter the code:<br/>
<form method="post" action="javascript:Finish()">
<span id="Captcha"></span>
<input type="submit" value="Submit"/> <span id="mainloading"></span>
</form>
<?php
}
public function emailOutput($list) {
$Items = $list->ListItems();
$html = '<table width="100%" border="0"><tr><td>Item #</td><td>Description</td><td>Quantity</td><td>Markup</td><td>Total</td></tr>';
$markup = new Markup();
foreach ($Items as $Item) {
$html .= '<tr><td>'. $Item->partnum .'</td><td>' . $Item->description . '</td><td>' . $Item->quantity . '</td><td>' . number_format(round($markup->Calc($Item->price),2),2) . '</td><td>'.$Item->totalPrice.'</td></tr>';
}
$html .= '</table><p align="right">Total Price: <b>' . number_format($list->totalPrice(), 2) . '</b></p>' .
'<p align="left">' .
'<table border="0">' .
'<tr><td>Email:</td><td><b>' . $list->getEmail() . '</b></td></tr>' .
'<tr><td>Name:</td><td><b>' . $list->getName() . '</b></td></tr>' .
'<tr><td>Address:</td><td><b>' . $list->getAddress() . '</b></td></tr>' .
'<tr><td>City:</td><td><b>' . $list->getCity() . '</b></td></tr>' .
'<tr><td>State:</td><td><b>' . $list->getState() . '</b></td></tr>' .
'<tr><td>ZipCode:</td><td><b>' . $list->getZip() . '</b></td></tr>' .
'<tr><td>Phone:</td><td><b>' . $list->getPhone() . '</b></td></tr>' .
'</table>' .
'</p>';
return $html;
}
}
?>
Thanks
Bob Ross