Advertisement
Advertisement
| 04.20.2008 at 04:49AM PDT, ID: 23337597 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: |
<?php
$search = '90035';
$path= "cgi-bin/cart/ipn_data";
$directory = opendir($path);
while (false !== ($file = readdir($directory))) {
if ($file !='.' && $file !='..' ){
$data = file_get_contents($path."/".$file);
if(preg_match("/$search/",$data)){
preg_match('/\$first_name = qq\((.*?)\);[\x0a|\x0d]{0,}\$last_name = qq\((.*?)\);/',$data,$name);
$desiredFile[] = $file;
$names[] = array($name[1],$name[2]);
}
}
}
function get_db_item_info($file_path, $db_item){
// Create a temporary array to store information.
$item_info_tmp = array();
//set defaults
$item_info_tmp["no"] = '';
$item_info_tmp["price"] = '';
$item_info_tmp["status"] = '-1';
$item_info_tmp["info"] = '';
// Creates a file handle in read-only mode.
$db_file = fopen($file_path, "r");
// Read the next line.
while($item_line = fgets($db_file)){
// Break everything up into an array.
$item_info = explode("|", $item_line);
// Check for required information.
if(trim($item_info[4])==$db_item){
$item_info_tmp["no"] = trim($item_info[1]);
$item_info_tmp["price"] = trim($item_info[6]);
$item_info_tmp["status"] = trim($item_info[8]);
$item_info_tmp["info"] = trim($item_info[5]);
break;
}
}
// Close the file handle.
fclose($db_file);
// Return the information.
return $item_info_tmp;
}
// Get item information.
$db_item_info = get_db_item_info("cgi-bin/cart/ppcal_data/items_8001.txt", $search);
// Output
echo "<b>Item:</b> {$db_item_info["no"]}<br />\n";
echo "<b>Price:</b> {$db_item_info["price"]}<br />\n";
// Right now we are wrapping to 80 characters.
$db_item_info["info"] = wordwrap($db_item_info["info"], 30, "<br />\n");
echo "<b>Info:</b> <br />\n";
// Check for availability of the item.
if($db_item_info["status"]==-1){
echo "<b>Status:</b><br />\n";
}else{
if($db_item_info["status"]>0){
echo "<b>Status:</b> <span style=\"color:green;\"><b>For Sale</b></span><br />\n";
}else{
echo "<b>Status:</b> <span style=\"color:green;\"><b>Sold</b></span><br />\n";
// print fname lname
foreach ($names as $name)
echo "<b>Buyer: </b>{$name[0]} {$name[1]}<br />\n";
}
}
?>
|