Advertisement
Advertisement
| 08.22.2008 at 03:43AM PDT, ID: 23669769 |
|
[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: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: |
################ techtutorials.php ###################
<link rel="stylesheet" href="../css/globalstyles.css" type="text/css" />
<div id="pagecell1">
<!--pagecell1-->
<img alt="" src="images/tl_curve_white.gif" height="6" width="6" id="tl" />
<img alt="" src="images/tr_curve_white.gif" height="6" width="6" id="tr" />
<div id="breadCrumb">
<?php include 'inc/breadcrumb.inc'; ?>
</div>
<div id="pageName">
<h2>Technicians Zone</h2>
</div>
<!-- Left hand column holding navigation -->
<?php include 'pagenav.php'; ?>
<div id="content">
<?php include ('process/weeklytutorials.php'); ?>
<div class="story">
<?php //Display a list of head options (software name, developer etc) depending on selection
//Paging functions
require('paging/data.php');
require('paging/paging.php');
//Connect to the database by the data.php 1.database 2.server 3.user 4.password
//$database = new Database('webtg2008', 'PBPC', 'root', '25130217cmt');
$database = new Database('w####8', 'localhost', 'w#####8', 'c#####7');
//Set session for using in paging functions (links) these will allow paging.php to keep track of the search criteria
$_SESSION['pagingurl'] = "index.php?cellname=$_SESSION[cellname]";
//$limit." offset ".$start
$start = 45;
//Get variable values from URL
$step = $_GET['step'];
$criteria = $_GET['criteria'];
if($step == "start"){
//Step 1 - Display the main catagory selecting newbie only catagories
$result = mysql_query("SELECT * FROM searchcriteria s JOIN topicsymbols i ON s.tag = i.imgOwner WHERE s.entryType = 'Catagory' AND s.entryZone = 'Tech' OR s.entryType = 'Catagory' AND s.entryZone = 'All' ORDER BY entryID");
if (!$result) {
die('Query execution problem: ' . mysql_error());
}
$step = "2";
}
else if($step == "2"){
//Step 2 - Display the options that match the choosing criteria for newbies
$query = 'SELECT * FROM searchcriteria s JOIN topicsymbols i ON s.tag = i.imgOwner WHERE s.entryType = "'.$criteria.'" AND s.entryZone = "Tech" OR s.entryType = "'.$criteria.'" AND s.entryZone = "All" ORDER BY entryID';
$result=mysql_query($query) or die ('Query execution problem on step 2' . mysql_error());
$step = "3";
}
else if($step == "3"){
//Step 3 - Display the resulting list of tutorials,guides,downloads etc
$query = 'SELECT * FROM tutorials t JOIN topicsymbols i ON t.software = i.imgOwner OR t.developer = i.imgOwner WHERE t.software = "'.$criteria.'" OR t.developer = "'.$criteria.'" ORDER BY entryID';
$result=mysql_query($query) or die ('Query execution problem on step 3' . mysql_error());
$step = "4";
}
else if($step == "4"){
//Should not arrive here the URL set by step 3 should take user to final tutorial selected
}
else{
//Error
echo "Error: All steps to retreive records failed on techzone.php";
}
//GLOBAL TABLE ALL RESULTS ARE DISPLAYED IN THIS FORMAT
//If no errors then a query should be choosen so pass it to paging and then display results
$paging = new Paging($query, 10, 'result', $database);
//Decide what step were at in search then Display results
if($step == "start" || $step == 2 || $step == 3){
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
while ($rs = $paging->fetch()){
echo"<tr>
<td align='center' bgcolor='#FFFFFF'><font size='4'>$rs->entryID</font></td>
<td bgcolor='#FFFFFF'>
<a href='index.php?cellname=pagecells/techtutorials.php&criteria=$rs->imgOwner&step=$step&tutid=$rs->entryID'>
<img src='images/topicsymbols/$rs->imgName' align='left' border='0'>
<strong><font face='Arial' size='3'>$rs->entryTitle</font></strong></a>
<br>$rs->entryComment
<br>
</td>
<td align='center' bgcolor='#FFFFFF'>
<a href='index.php?cellname=pagecells/techtutorials.php&criteria=$rs->imgOwner&step=$step&tutid=$rs->entryID' style='text-decoration: none;'>
Visits</a>
<br>$rs->entryViews
</td>
</tr>";
}
}
else if($step == 4){
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
while ($rs = $paging->fetch()){
echo"<tr>
<td align='center' bgcolor='#FFFFFF'><font size='4'>$rs->entryID</font></td>
<td bgcolor='#FFFFFF'>
<a href='index.php?cellname=pagecells/tutorials.php&tutid=$rs->entryID'>
<img src='images/topicsymbols/$rs->imgName' align='left' border='0'>
<strong><font face='Arial' size='3'>$rs->entryTitle</font></strong></a>
<br>$rs->entryComment
<br>
</td>
<td align='center' bgcolor='#FFFFFF'>
<a href='index.php?cellname=pagecells/tutorials.php&tutid=$rs->entryID' style='text-decoration: none;'>
Visits</a>
<br>$rs->entryViews
</td>
</tr>";
}
}
else{
//Should not get to this step
echo "Error: No layout selected";
}
echo "</table>";
echo '<br/><br/>';
echo $paging->get_links();
?>
</div>
</div>
<div id="siteInfo">
<?php include 'cellfoot.php'; ?>
</div>
<!--end pagecell1-->
<br />
################ data.php ##################################
<?php
class Database{
var $queries, $result = null, $server, $user, $password, $database;
function __construct($database, $server, $user, $password) {
$this->queries = 0;
$this->server = $server;
$this->user = $user;
$this->password = $password;
$this->database = $database;
$this->connect();
}
function connect() {
mysql_connect($this->server, $this->user, $this->password)
or die('Server connection failed.');
mysql_select_db($this->database)
or die('Database connection failed.');
}
function query($query) {
$this->queries++;
$this->result = mysql_query($query);
return $this->result;
}
function unique($query) {
$result = $this->query("$query LIMIT 1");
$line = mysql_fetch_row($result);
return $line[0];
}
function fetch_object($result = null) {
$result = $result == null ? $this->result : $result;
if ($result == null || mysql_num_rows($result) < 1) {
return null;
} else {
return mysql_fetch_object($result);
}
}
function num($result = null) {
if ($result == null){
return mysql_num_rows($this->result);
}
else{
return mysql_num_rows($result);
}
}
function data_seek($result, $seek) {
return mysql_data_seek($result, $seek);
}
function close() {
mysql_close();
}
}
?>
################# paging.php #########################
<?php
class Paging {
var $result, $pagesize, $page, $rs, $param, $db;
function __construct($query, $pagesize, $param, $db) {
@$resultpage = $_GET[$param];
$this->db = $db;
$this->result = $this->db->query($query);
$this->pagesize = $pagesize;
$this->param = $param;
if ((int)$resultpage <= 0) {
$resultpage = 1;
}
if ($resultpage > $this->get_num_pages()) {
$resultpage = $this->get_num_pages();
}
$this->set_page_num($resultpage);
}
function get_num_pages() {
if (!$this->result) {
return false;
}
return ceil($this->db->num($this->result)/(float)$this->pagesize);
}
function set_page_num($pagenum) {
if ($pagenum > $this->get_num_pages() or $pagenum <= 0) {
return false;
}
$this->page = $pagenum;
$this->rs = 0;
$this->db->data_seek($this->result,($pagenum-1) * $this->pagesize);
}
function get_page_num() {
return $this->page;
}
function is_last_page() {
return ($this->page >= $this->get_num_pages());
}
function is_first_page() {
return ($this->page <= 1);
}
function fetch() {
if ($this->rs >= $this->pagesize || !$this->result) {
return false;
}
$this->rs++;
return $this->db->fetch_object($this->result);
}
//PLEASE SET URL VALUES IN SESSIONS ON PAGE PRIOR TO CALLING THIS FUNCTION $_SESSION['pagingurl']
//This allows the function to be used by numerous applications on the same site especially if the URL is passing values
function get_links($params = '') {
$links = '';
$params = !empty($params) ? "&$params" : '';
if (!$this->is_first_page()) {
$links .= "<a href=\"$_SESSION[pagingurl]$this->param=".($this->get_page_num()-1).''.$params.'">Back</a> ';
}
if ($this->get_num_pages() > 1) {
for ($i = 1; $i <= $this->get_num_pages(); $i++) {
if ($i==$this->page) {
$links .= "$i ";
} else {
$links .= "<a href=\"$_SESSION[pagingurl]$this->param={$i}".$params."\">{$i}</a> ";
}
}
if (!$this->is_last_page()) {
$links .= "<a href=\"$_SESSION[pagingurl]$this->param=".($this->get_page_num()+1).''.$params.'">Next</a> ';
}
}
return $links;
}
}
?>
|