conveting
Posted: Mon Mar 06, 2006 10:53 am
im not 100% sure on how i can do this, but i need to be able to convert one script, so it works the same way, but less info on it.
instead of
would the second one work with this php?
please not that the second one has not been connected to a database yet
instead of
it only needsQuest Name:
Guide Written by:
Quest Description:
Quest Length:
Quest Difficulty:
Requirements:
Items:
Members?: Use Y or N only
Starting Location: Please be sure to get it exact.
Main Guide: When including, bold, italics, images etc. Please use HTML
Reward:
Sort Name: This is the name of the quest without spaces or the leading "The" if it has one.
the php code for the first oneQuest Name:
Guide Written by:
Members?: Use Y or N only
Main Guide: When including, bold, italics, images etc. Please use HTML
Code: Select all
<?php
include('header.inc');
function questview($id) {
require_once ('../mysql_connect.php');//connect to db
/* query for item */
$query = "SELECT * FROM quest WHERE id=$id";
$result = mysql_query ($query);
/* if we get no results back, error out */
$numrtn = mysql_num_rows($result);
if ($numrtn == 0) {
echo "The quest guide requested cannot be found\n";
echo $id;
return;
}
$row = mysql_fetch_assoc($result);
/* easier to read variables and
* striping out tags */
$id = $row['id'];
$name = $row['name'];
$contributors = $row['contributors'];
$guideby = $row['guideby'];
$added = $row['added'];
$location = $row['startinglocation'];
$members = $row['members'];
$description = $row['description'];
$difficulty = $row['difficulty'];
$requirements = $row['requirements'];
$items = $row['items'];
$reward = $row['reward'];
$guide = $row['mainbody'];
$length = $row['length'];
$updated = $row['updated'];
if ($members == "Y") {
$mem = "members only quest</b>, so it can only be done on a <b>members</b> server.";
}else{
$mem = "non-members quest</b>.";
}
if ($updated == 0){
$up = 'No-one has updated this quest guide';
}else{
$date2 = date("l jS of F Y @ H:i:s ", $updated);
$up = 'It was last updated on '.$date2;
}
if ($contributors != ""){
$con = 'Thanks also to <b>'.$contributors.'</b> for changes.';
}else{
$con = 'No-one else has contributed to this quest guide.';
}
//$date = date("D M jS, Y g:i a", $added);
$date = date("l jS of F Y @ H:i:s ", $added);
echo '
<div id="quest">
<p><span class="questheader"><center>'.$name.'</center></span></p>
<p class="text">This quest guide was written by <b>'.$guideby.'</b> for use on Runehints and entered into the database on '.$date.'. '.$up.'. '.$con.' <br /></p>
<p><span class="text"><br />This quest is <b>'.$mem.'</span></p>
<p>
<span class="qtitle">Description: </span><span class="text">'.$description.'</span></p>
<p><span class="qtitle">Difficulty Level: </span><span class="text">'.$difficulty.'</span></p>
<p>
<span class="qtitle">Requirements: </span><span class="text">'.$requirements.'</span></p>
<p>
<span class="qtitle">Items Needed During Quest: </span><span class="text">'.$items.'</span></p>
<p>
<span class="qtitle">Starting Location: </span><span class="text">'.$location.'</span></p>
<p><span class="qtitles">Quest Instructions:</span></p>
<span class="text">
<p>'.$guide.'</p>
</span>
<p>
<span class="qtitle">Reward: </span><span class="text">'.$reward.'</span></p>
</div> ';
}
function selectquest(){
require_once ('../mysql_connect.php');//connect to db
global $sitestyle;
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="#000000" align="center" border="0" cellpadding="0" cellspacing="0" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopl.jpg" height="25" width="30"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopm.jpg" height="25"><div align="center"><font class="text"><b>Non-member's Quests</b></font></div></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopr.jpg" height="25" width="30"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidl.jpg" width="16"></td>
<td bgcolor="#000000" align="left" border="0" cellpadding="0" cellspacing="0">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?php
/* query for quests */
$n_query = "SELECT id, name, guideby, members, sorter FROM quest WHERE members='n' ORDER BY sorter ASC";
$n_result = mysql_query ($n_query);
while ($n_row = mysql_fetch_assoc($n_result)) {
$n_name = $n_row['name'];
$n_guideby = $n_row['guideby'];
$id = $n_row['id'];
/* place table row data in
* easier to use variables.
* & display the data */
echo '<tr><td width=100%><b><a href="quest.php?flibble=questview&id='.$id.'&ic=1">'.$n_name.'</a></b></td><td><font class=small>'.$n_guideby.'</font></td></tr>';
}
/* finish up table*/
?>
</table>
</td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidr.jpg" width="16"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottoml.jpg" height="13" width="16"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13" width="1"></td>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomr.jpg" height="13" width="16"></td>
</tr>
</table>
</td>
<td width="16"></td>
<td bgcolor="#000000" align="center" border="0" cellpadding="0" cellspacing="0" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopl.jpg" height="25" width="30"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopm.jpg" height="25"><div align="center"><font class="text"><b>Member's Quests</b></font></div></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopr.jpg" height="25" width="30"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidl.jpg" width="16"></td>
<td bgcolor="#000000" align="left" border="0" cellpadding="0" cellspacing="0">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?php
/* query for quests */
$y_query = "SELECT id, name, guideby, members, sorter FROM quest WHERE members='y' ORDER BY sorter ASC";
$y_result = mysql_query ($y_query);
while ($y_row = mysql_fetch_assoc($y_result)) {
$y_name = $y_row['name'];
$y_guideby = $y_row['guideby'];
$yid = $y_row['id'];
/* place table row data in
* easier to use variables.
* & display the data */
echo '<tr><td width=100%><b><a href="quest.php?flibble=questview&id='.$yid.'&ic=1">'.$y_name.'</a></b></td><td><font class=small>'.$y_guideby.'</font><br /></td></tr>';
}
/* finish up table*/?>
</table>
</td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidr.jpg" width="16"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottoml.jpg" height="13" width="16"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13" width="1"></td>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomr.jpg" height="13" width="16"></td>
</tr>
</table>
</td></tr></table>
<?php
}
switch($_GET['flibble']) {
case 'selectquest':
selectquest();
break;
case 'questview':
questview($_GET['id']);
break;
default:
selectquest();
}
include('footer.inc');
?>Code: Select all
<?php
include('header.inc');
?>
<?
function skillview($id) {
require_once ('../mysql_connect.php');//connect to db
/* query for item */
$query = "SELECT * FROM skill WHERE id=$id";
$result = mysql_query ($query);
/* if we get no results back, error out */
$numrtn = mysql_num_rows($result);
if ($numrtn == 0) {
echo "The Skill guide requested cannot be found\n";
echo $id;
return;
}
$row = mysql_fetch_assoc($result);
/* easier to read variables and
* striping out tags */
$id = $row['id'];
$name = $row['name'];
$contributors = $row['contributors'];
$guideby = $row['guideby'];
$added = $row['added'];
$members = $row['members'];
$guide = $row['mainbody'];
$updated = $row['updated'];
if ($members == "Y") {
$mem = "members only Skill</b>, so it can only be done on a <b>members</b> server.";
}else{
$mem = "non-members Skill</b>.";
}
if ($updated == 0){
$up = 'No-one has updated this skill guide';
}else{
$date2 = date("l jS of F Y @ H:i:s ", $updated);
$up = 'It was last updated on '.$date2;
}
if ($contributors != ""){
$con = 'Thanks also to <b>'.$contributors.'</b> for changes.';
}else{
$con = 'No-one else has contributed to this Skill guide.';
}
//$date = date("D M jS, Y g:i a", $added);
$date = date("l jS of F Y @ H:i:s ", $added);
echo '
<div id="skill">
<p><span class="skillheader"><center>'.$name.'</center></span></p>
<p class="text">This skill guide was written by <b>'.$guideby.'</b> for use on Runehints and entered into the database on '.$date.'. '.$up.'. '.$con.' <br /></p>
<p><span class="text"><br />This skill is <b>'.$mem.'</span></p>
<p>
<p><span class="qtitles">Skill Guide:</span></p>
<span class="text">
<p>'.$guide.'</p>
</span>
</div> ';
}
function selectskill(){
require_once ('../mysql_connect.php');//connect to db
global $sitestyle;
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="#000000" align="center" border="0" cellpadding="0" cellspacing="0" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopl.jpg" height="25" width="30"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopm.jpg" height="25"><div align="center"><font class="text"><b>Non-member's Skills</b></font></div></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopr.jpg" height="25" width="30"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidl.jpg" width="16"></td>
<td bgcolor="#000000" align="left" border="0" cellpadding="0" cellspacing="0">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?php
/* query for skills */
$n_query = "SELECT id, name, guideby, members, sorter FROM skill WHERE members='n' ORDER BY sorter ASC";
$n_result = mysql_query ($n_query);
while ($n_row = mysql_fetch_assoc($n_result)) {
$n_name = $n_row['name'];
$n_guideby = $n_row['guideby'];
$id = $n_row['id'];
/* place table row data in
* easier to use variables.
* & display the data */
echo '<tr><td width=100%><b><a href="skills.php?flibble=skillview&id='.$id.'&ic=1">'.$n_name.'</a></b></td><td><font class=small>'.$n_guideby.'</font></td></tr>';
}
/* finish up table*/
?>
</table>
</td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidr.jpg" width="16"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottoml.jpg" height="13" width="16"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13" width="1"></td>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomr.jpg" height="13" width="16"></td>
</tr>
</table>
</td>
<td width="16"></td>
<td bgcolor="#000000" align="center" border="0" cellpadding="0" cellspacing="0" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopl.jpg" height="25" width="30"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopm.jpg" height="25"><div align="center"><font class="text"><b>Member's Skills</b></font></div></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tabletopr.jpg" height="25" width="30"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidl.jpg" width="16"></td>
<td bgcolor="#000000" align="left" border="0" cellpadding="0" cellspacing="0">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?php
/* query for skills */
$y_query = "SELECT id, name, guideby, members, sorter FROM skills WHERE members='y' ORDER BY sorter ASC";
$y_result = mysql_query ($y_query);
while ($y_row = mysql_fetch_assoc($y_result)) {
$y_name = $y_row['name'];
$y_guideby = $y_row['guideby'];
$yid = $y_row['id'];
/* place table row data in
* easier to use variables.
* & display the data */
echo '<tr><td width=100%><b><a href="skills.php?flibble=skillview&id='.$yid.'&ic=1">'.$y_name.'</a></b></td><td><font class=small>'.$y_guideby.'</font><br /></td></tr>';
}
/* finish up table*/?>
</table>
</td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablemidr.jpg" width="16"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottoml.jpg" height="13" width="16"></td>
<td background="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomm.jpg" height="13" width="1"></td>
<td width="16"><img src="images/<?php echo $sitestyle.'_'; ?>tablebottomr.jpg" height="13" width="16"></td>
</tr>
</table>
</td></tr></table>
<?php
}
switch($_GET['flibble']) {
case 'selectskill':
selectskill();
break;
case 'skillview':
skillview($_GET['id']);
break;
default:
selectskill();
}
include('footer.inc');
?>please not that the second one has not been connected to a database yet