Jump to content

Jnerocorp

Members
  • Posts

    261
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Jnerocorp's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Well, Could you at least tell me what this is called like i dont know how to explain is there a name for what i am asking to be done something that I can search up on google. thanks.
  2. thats the problem i dont understand jquery very much at all
  3. Hello, I am using a nice wordpress template that I found but there is a feature I want to add and I'm unsure of how to do so. I have designed in photoshop what I am trying to make it do: This is how it looks right now: This is how I want to make it look: And this is what I want it to do: Here is the code: <?php /** * Front Page * * Note: You can overwrite home.php as well as any other Template in Child Theme. * Create the same file (name) and you're all set to go! * * @file front-page.php * @package WordPress * @subpackage Shell * @author Emil Uzelac * @copyright 2003 - 2011 ThemeID * @license license.txt * @version Release: 1.0 * @filesource wp-content/themes/shell-lite/front-page.php * @link N/A * @since available since Release 1.0 */ ?> <?php get_header(); ?> <div id="content-full" class="grid col-940"> <?php $options = get_option('shell_theme_options'); // First let's check if headline was set if ($options['home_headline']) { echo '<h1 class="featured-title">'; echo $options['home_headline']; echo '</h1>'; // If not display dummy headline for preview purposes } else { echo '<h1 class="featured-title">'; echo 'Your H1 Headline Goes Right Here. Great for SEO!'; echo '</h1>'; } ?> <div class="grid col-460"> <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/featured-image.jpg" width="440" height="300" alt="" /> </div><!-- end of .col-460 --> <div class="grid col-460 fit"> <?php $options = get_option('shell_theme_options'); // First let's check if headline was set if ($options['home_subheadline']) { echo '<h2 class="featured-subtitle">'; echo $options['home_subheadline']; echo '</h2>'; // If not display dummy headline for preview purposes } else { echo '<h2 class="featured-subtitle">'; echo 'Your H2 Subheadline Here'; echo '</h2>'; } ?> <?php $options = get_option('shell_theme_options'); // First let's check if content is in place if ($options['home_content_area']) { echo '<p>'; echo $options['home_content_area']; echo '</p>'; // If not let's show dummy content for demo purposes } else { echo '<p>'; echo 'Properly structured landing page is big part of the Search Engine Optimization. Shell is a hassle-free WordPress CMS Theme. All of the content on this landing page is fully manageable directly from Theme Options, including call-to-action button and its destination.'; echo '</p>'; } ?> <div class="featured-button"> <?php $options = get_option('shell_theme_options'); // First let's check if headline was set if ($options['featured_button_link'] && $options['featured_button_text']) { echo '<p>'; echo '<a href="'.$options['featured_button_link'].'">'; echo $options['featured_button_text']; echo '</a>'; echo '</p>'; // If not display dummy headline for preview purposes } else { echo '<p>'; echo '<a href="#nogo">'; echo 'Call to Action'; echo '</a>'; echo '</p>'; } ?> </div><!-- end of .featured-button --> </div><!-- end of .col-460 fit --> </div><!-- end of #content-full --> <?php get_sidebar('home'); ?> <?php get_footer(); ?> I don't mind it being regular html instead of editable in the Theme options as I understand how to edit manually. I'm just not sure how to make the coding to set it up like I want and make it work. Help is greatly appreciated. Thank you
  4. you sir are a genius I thank you so very much this was driving me absolutely insane
  5. yes it is numerical, as i said i didnt create the script and i think the work is sloppy in my opinion I just want to get this working thank you for your help so far. its very appreciated
  6. Here it is: index.php <?php include ("./header.php"); //======================================================================== Commands If (isSet($_GET['sort'])) { $sortby = $_GET['sort']; If ($sortby=='name' || $sortby=='ip' || $sortby=='votes' || $sortby=='username') { If ($sortby=='name') { $options = "<option value='./index.php?sort=name' selected='selected'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($sortby=='ip') { $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip' selected='selected'>IP Address</option> <option value='./index.php?sort=votes'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($sortby=='votes') { $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes' selected='selected'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($sortby=='username') { $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes'>Rank</option> <option value='./index.php?sort=username' selected='selected'>Owner</option>"; } } else { $sortby = "votes"; $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes' selected='selected'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } } else { $sortby = "votes"; $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes' selected='selected'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($_GET['act']=='see' && isSet($_GET['id'])) { //=================================================================== XSS protection $sid = str_replace("/", "", $_GET['id']); $sid = str_replace(Chr(92), "", $sid); $sid = str_replace("'", "", $sid); $sid = str_replace('"', "", $sid); $sid = str_replace("<", "", $sid); $sid = str_replace(">", "", $sid); $sid = str_replace("-", "", $sid); $sid = str_replace("union", "", $sid); $sid = str_replace("information_schema", "", $sid); $sid = strtolower(trim($sid)); //=================================================================== XSS protection $result = mysql_query("SELECT * FROM servers WHERE id='$sid'") or die (mysql_error()); $nr = mysql_num_rows($result); If ($nr<='0') { $exist = "No"; } else { $exist = "Yes"; while($row = mysql_fetch_array($result)) { If ($row['name']=='') { $servername = "<img src='./banners/" .$row['banner']. "' style='width:468px;height:60px' title='Server details'>"; } else { $servername = $row['name']; } $did = $row['id']; $dname = $row['name']; $dbanner = $row['banner']; $dip = $row['ip']; $ddescription = $row['description']; $dwebsite = $row['website']; $dcountry = $row['country']; $dsponsored = $row['sponsored']; $dvotes = $row['votes']; $mineq = $row['mineq']; $dusername = $row['username']; $ddate = $row['date']; If ($dusername==$username) { $me = "Yes"; } else { $me = "No"; } If ($mineq=='Yes') { If (!$dip=='') { include ("./minequery.class.php"); $mine = array((Minequery::query($dip))); $donlinep = $mine["0"]["playerCount"]; If ($donlinep>0) { for ($i = 0; $i <= $donlinep; $i++) { $playername = $mine["0"]["playerList"][$i]; If (!$playername=='') { $donline .= $playername. ", "; } } $donline = left($donline, strlen($donline)-2); } } else { $donline = "<i>n/a</i>"; } } else { $donline = "<i>n/a</i>"; } } } } If ($_GET['act']=='' || $_GET['act']=='sponsored' || $_GET['act']=='myservers') { $result = mysql_query("SELECT * FROM servers ORDER BY votes DESC") or die (mysql_error()); while($rk_list[] = mysql_fetch_array($result)); If (isSet($username) && $_GET['act']=='myservers') { $result = mysql_query("SELECT * FROM servers WHERE username='$username' ORDER BY id DESC") or die (mysql_error()); } else { If ($_GET['act']=='sponsored') { $result = mysql_query("SELECT * FROM servers WHERE sponsored='Yes' ORDER BY id DESC") or die (mysql_error()); } else { If (isSet($_GET['country'])) { $result = mysql_query("SELECT * FROM servers WHERE country='$_GET[country]' ORDER BY votes DESC") or die (mysql_error()); } else { $result = mysql_query("SELECT * FROM servers ORDER BY $sortby DESC") or die (mysql_error()); } } } $nr = mysql_num_rows($result); If ($nr<='0') { $serverslist = "<tr><td align='center' colspan='6'>There are no servers added yet !</td></tr>"; } else { include ("./minequery.class.php"); $rank = "0"; while($row = mysql_fetch_array($result)){ $data[] = $row; } foreach ($data as $row) { $rank = ($rank + 1); If ($row['banner']=='') { $servername = $row['name']; } else { $servername = "<img src='" .$row['banner']. "' style='width:400px;height:60px' title='Server details'>"; } If ($row['sponsored']=='Yes') { $star = "style='background:url(./images/star.png);background-repeat:no-repeat;'"; } else { $star = ""; } If ($row['mineq']=='Yes') { If (!$row['ip']=='') { $mine = array((Minequery::query($row['ip']))); $onlinep = $mine["0"]["playerCount"]; } else { $onlinep = "<i>n/a</i>"; } } else { $onlinep = "<i>n/a</i>"; } $country = "./flags/" .$row['country']. ".png"; $serverslist .= "<tr><td align='center'>" .(array_search($row, $rk_list) + 1). "</td><td align='center'><a href='./index.php?country=" .$row['country']. "'><img src='" .$country. "' title='" .$row['country']. "' style='width:32px;height:32px;'></a></td><td align='center' valign='middle' style='height:60px;'><a class='nav' href='./index.php?act=see&id=" .$row['id']. "' title='Server details'>" .$servername. "</a></td><td align='center' " .$star. ">" .$row['ip']. "</td><td align='center'>" .$onlinep. "</td><td align='center'>" .$row['votes']. "</td></tr>"; //$serverslist .= "<tr><td align='center'>" .$row['id']. "</td><td align='center' valign='middle' style='height:60px;'><a class='nav' href='./index.php?act=see&id=" .$row['id']. "' title='Server details'>" .$servername. "</a></td><td align='center'><img src='./flags/" .$row['country']. ".ico' title='" .$row['country']. "'> " .$row['ip']. "</td><td align='center'>" .$row['votes']. "</td><td align='center'>" .$row['date']. "</td></tr>"; //$serverslist .= "<tr><td align='center'>" .$row['id']. "</td><td align='center'>" .$servername. "</td><td align='center'>" .country_flag($row['ip']). " " .$row['ip']. "</td><td align='center'>" .$row['votes']. "</td></tr>"; } } } //======================================================================== Strings $countries = "<option>Afghanistan</option> <option>Albania</option> <option>Algeria</option> <option>Andorra</option> <option>Angola</option> <option>Antigua and Barbuda</option> <option>Argentina</option> <option>Armenia</option> <option>Aruba</option> <option>Australia</option> <option>Austria</option> <option>Azerbaijan</option> <option>Bahamas, The</option> <option>Bahrain</option> <option>Bangladesh</option> <option>Barbados</option> <option>Belarus</option> <option>Belgium</option> <option>Belize</option> <option>Benin</option> <option>Bermuda</option> <option>Bhutan</option> <option>Bolivia</option> <option>Bosnia and Herzegovina</option> <option>Botswana</option> <option>Brazil</option> <option>Brunei</option> <option>Bulgaria</option> <option>Burkina Faso</option> <option>Burma</option> <option>Burundi</option> <option>Cambodia</option> <option>Cameroon</option> <option>Canada</option> <option>Cape Verde</option> <option>Cayman Islands</option> <option>Central African Republic</option> <option>Chad</option> <option>Chile</option> <option>China</option> <option>Colombia</option> <option>Comoros</option> <option>Congo, Democratic Republic of the</option> <option>Congo, Republic of the</option> <option>Costa Rica</option> <option>Cote d'Ivoire</option> <option>Croatia</option> <option>Cuba</option> <option>Curacao</option> <option>Cyprus</option> <option>Czech Republic</option> <option>Denmark</option> <option>Djibouti</option> <option>Dominica</option> <option>Dominican Republic</option> <option>Ecuador</option> <option>Egypt</option> <option>El Salvador</option> <option>Equatorial Guinea</option> <option>Eritrea</option> <option>Estonia</option> <option>Ethiopia</option> <option>Fiji</option> <option>Finland</option> <option>France</option> <option>Gabon</option> <option>Gambia</option> <option>Georgia</option> <option>Germany</option> <option>Ghana</option> <option>Greece</option> <option>Grenada</option> <option>Guatemala</option> <option>Guinea</option> <option>Guinea-Bissau</option> <option>Guyana</option> <option>Haiti</option> <option>Holy See</option> <option>Honduras</option> <option>Hong Kong</option> <option>Hungary</option> <option>Iceland</option> <option>India</option> <option>Indonesia</option> <option>Iran</option> <option>Iraq</option> <option>Ireland</option> <option>Israel</option> <option>Italy</option> <option>Jamaica</option> <option>Japan</option> <option>Jordan</option> <option>Kazakhstan</option> <option>Kenya</option> <option>Kiribati</option> <option>Kosovo</option> <option>Kuwait</option> <option>Kyrgyzstan</option> <option>Laos</option> <option>Latvia</option> <option>Lebanon</option> <option>Lesotho</option> <option>Liberia</option> <option>Libya</option> <option>Liechtenstein</option> <option>Lithuania</option> <option>Luxembourg</option> <option>Macau</option> <option>Macedonia</option> <option>Madagascar</option> <option>Malawi</option> <option>Malaysia</option> <option>Maldives</option> <option>Mali</option> <option>Malta</option> <option>Marshall Islands</option> <option>Mauritania</option> <option>Mauritius</option> <option>Mexico</option> <option>Micronesia</option> <option>Moldova</option> <option>Monaco</option> <option>Mongolia</option> <option>Montenegro</option> <option>Morocco</option> <option>Mozambique</option> <option>Namibia</option> <option>Nauru</option> <option>Nepal</option> <option>Netherlands</option> <option>Netherlands Antilles</option> <option>New Zealand</option> <option>Nicaragua</option> <option>Niger</option> <option>Nigeria</option> <option>North Korea</option> <option>Norway</option> <option>Oman</option> <option>Pakistan</option> <option>Palau</option> <option>Panama</option> <option>Papua New Guinea</option> <option>Paraguay</option> <option>Peru</option> <option>Philippines</option> <option>Poland</option> <option>Portugal</option> <option>Qatar</option> <option>Romania</option> <option>Russia</option> <option>Rwanda</option> <option>Saint Kitts and Nevis</option> <option>Saint Lucia</option> <option>Saint Vincent and the Grenadines</option> <option>Samoa</option> <option>San Marino</option> <option>Sao Tome and Principe</option> <option>Saudi Arabia</option> <option>Senegal</option> <option>Serbia</option> <option>Seychelles</option> <option>Sierra Leone</option> <option>Singapore</option> <option>Slovakia</option> <option>Slovenia</option> <option>Solomon Islands</option> <option>Somalia</option> <option>South Africa</option> <option>South Korea</option> <option>South Sudan</option> <option>Spain</option> <option>Sri Lanka</option> <option>Sudan</option> <option>Suriname</option> <option>Swaziland</option> <option>Sweden</option> <option>Switzerland</option> <option>Syria</option> <option>Taiwan</option> <option>Tajikistan</option> <option>Tanzania</option> <option>Thailand</option> <option>Timor-Leste</option> <option>Togo</option> <option>Tonga</option> <option>Trinidad and Tobago</option> <option>Tunisia</option> <option>Turkey</option> <option>Turkmenistan</option> <option>Tuvalu</option> <option>Uganda</option> <option>Ukraine</option> <option>United Arab Emirates</option> <option>United Kingdom</option> <option>Uruguay</option> <option>Uzbekistan</option> <option>Vanuatu</option> <option>Venezuela</option> <option>Vietnam</option> <option>Yemen</option> <option>Zambia</option> <option>Zimbabwe</option>"; $servers = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='6'>Servers list</th></tr> <tr><td align='left' colspan='3'>Servers : " .$nr. "</td><td align='right' colspan='3'>Arrange by : <select name='by' onChange=location.href=this.options[this.selectedIndex].value;>" .$options. "</select></td></tr> <tr><th align='center' width='1%'>#</th><th align='center' width='1%'>Country</th><th align='center' width='47%'>Name / Banner</th><th align='center' width='20%'>IP Address</th><th align='center' width='1%'>Players Online</th><th align='center' width='1%'>Votes</th></tr> " .$serverslist. " </table>"; $addsv = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Add server</th></tr> <tr><td align='left' width='100px'>Name :</td><td align='left'><input class='field' type='text' name='aname' style='width:100%;'></td></tr> <tr><td align='left'>Banner url :</td><td align='left'><input class='field' type='text' name='abanner' style='width:100%;'></td></tr> <tr><td align='left'>Description :</td><td align='left'><textarea class='textarea' name='adescription'></textarea></td></tr> <tr><td align='left'>IP Address :</td><td align='left'><input class='field' type='text' name='aip'></td></tr> <tr><td align='left'>Website :</td><td align='left'><input class='field' type='text' name='awebsite'></td></tr> <tr><td align='left'>Country :</td><td align='left'><select name='acountry'>" .$countries. "</select></td></tr> <tr><td align='left'>MineQuery :</td><td align='left'><select name='amine'><option selected='selected'>Yes</option><option>No</option></select></td></tr> <tr><td align='left'>Captcha :</td><td align='left'><img src='./captcha.php' title='Captcha'> <input class='field' type='text' name='captcha' style='width:100px;' maxlength='5'></td></tr> <tr><td> </td><td align='left'><input type='submit' name='aok' value='Add'></td></tr> </table>"; $login = "<table align='left' class='fancy' width='40%'> <tr><th align='left' colspan='2'>Login</th></tr> <tr><td align='left' width='30%'>Username :</td><td align='left'><input class='field' type='text' name='lname'></td></tr> <tr><td align='left'>Password :</td><td align='left'><input class='field' type='password' name='lpass'></td></tr> <tr><td> </td><td align='left'><input type='submit' name='lok' value='Login'></td></tr> </table>"; $register = "<table align='left' class='fancy' width='45%'> <tr><th align='left' colspan='2'>Register</th></tr> <tr><td align='left' width='30%'>Username :</td><td align='left'><input class='field' type='text' name='rname'> <font color='red'>*</font></td></tr> <tr><td align='left'>E-mail :</td><td align='left'><input class='field' type='text' name='rmail'> <font color='red'>*</font></td></tr> <tr><td align='left'>Password :</td><td align='left'><input class='field' type='password' name='rpass'> <font color='red'>*</font></td></tr> <tr><td align='left'>Re-Password :</td><td align='left'><input class='field' type='password' name='rrepass'> <font color='red'>*</font></td></tr> <tr><td> </td><td align='left'><input type='submit' name='rok' value='Register'></td></tr> </table>"; $settings = "<table align='left' class='g' width='80%'> <tr><th align='left' colspan='2'>Settings</th></tr> <tr><td width='50%' valign='top'> <table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>My account</th></tr> <tr><td align='left'>E-mail : </td><td align='left'>" .$uemail. "</td></tr> <tr><td align='left'>Servers : </td><td align='left'>" .$uservers. "</td></tr> <tr><td align='left'>Next vote : </td><td align='left'>" .$unextvoted. "</td></tr> <tr><td align='left'>Join date : </td><td align='left'>" .$udate. "</td></tr> </table> </td><td width='50%' valign='top'> <table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Change password</th></tr> <tr><td align='left'>Current password : </td><td align='left'><input type='password' name='cpass'></td></tr> <tr><td align='left'>New password : </td><td align='left'><input type='password' name='cnpass'></td></tr> <tr><td align='left'>New re-password : </td><td align='left'><input type='password' name='cnrepass'></td></tr> <tr><td> </td><td align='left'><input type='submit' name='cok' value='Change'></td></tr> </table> </td></tr> </table>"; $f = fopen("./mine.txt", "r"); while ($line = fgets($f, 9999)) { $minetext .= $line. ""; } fclose($f); $minequery = "<table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>MineQuery</th></tr> <tr><td align='left'> " .$minetext. " </td></tr> </table>"; $f = fopen("./help.txt", "r"); while ($line = fgets($f, 9999)) { $helptext .= $line. ""; } fclose($f); $help = "<table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Help</th></tr> <tr><td align='left'> " .$helptext. " </td></tr> </table>"; If ($me=='No') { If ($dname=='') { $dname = "<i>none</i>"; } If ($dbanner=='') { $dbanner = "<i>none</i>"; } else { $dbanner = "<img src='" .$dbanner. "' title='Banner' style='width:468px;height:60px'>"; } $details = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Server details</th></tr> <tr><td align='left' width='100px'>Name :</td><td align='left'>" .$dname. "</td></tr> <tr><td align='left'>Banner url :</td><td align='left'>" .$dbanner. "</td></tr> <tr><td align='left'>Description :</td><td align='left'>" .$ddescription. "</td></tr> <tr><td align='left'>Players online :</td><td align='left'>" .$donline. "</td></tr> <tr><td align='left'>IP Address :</td><td align='left'>" .$dip. "</td></tr> <tr><td align='left'>Website :</td><td align='left'>" .$dwebsite. "</td></tr> <tr><td align='left'>Sponsored :</td><td align='left'>" .$dsponsored. "</td></tr> <tr><td align='left'>Votes :</td><td align='left'>" .$dvotes. "</td></tr> <tr><td align='left'>Owner :</td><td align='left'>" .$dusername. "</td></tr> <tr><td align='left'>Added at :</td><td align='left'>" .$ddate. "</td></tr> <tr><td align='left'>Vote link :</td><td align='left'><a class='nav' href='" .$siteurl. "/vote.php?id=" .$did. "' title='Vote link'>" .$siteurl. "/vote.php?id=" .$did. "</td></tr> </table>"; } else { $details = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Server details</th></tr> <tr><td align='left' width='100px'>Name :</td><td align='left'><input class='field' type='text' name='nname' style='width:700px;' value='" .$dname. "'></td></tr> <tr><td align='left'>Banner url :</td><td align='left'><input class='field' type='text' name='nbanner' style='width:700px;' value='" .$dbanner. "'></td></tr> <tr><td align='left'>Description :</td><td align='left'><textarea class='textarea' name='ndescription'>" .$ddescription. "</textarea></td></tr> <tr><td align='left'>Players online :</td><td align='left'>" .$donline. "</td></tr> <tr><td align='left'>IP Address :</td><td align='left'><input class='field' type='text' name='nip' value='" .$dip. "'></td></tr> <tr><td align='left'>Website :</td><td align='left'><input class='field' type='text' name='nwebsite' value='" .$dwebsite. "'></td></tr> <tr><td align='left'>Vote link :</td><td align='left'><a class='nav' href='" .$siteurl. "/vote.php?id=" .$did. "' title='Vote link'>" .$siteurl. "/vote.php?id=" .$did. "</td></tr> <tr><td> </td><td align='left'><input type='submit' name='dok' value='Update'> <input type='submit' name='delok' value='Delete'></td></tr> </table>"; } //======================================================================== Display echo "<form method='post' action='" .curPageURL(). "' style='margin:0px;'>"; If ($sidebar=="Yes") { echo "<table align='center' width='100%'> <tr><td align='left' width='80%' valign='top'>"; } If ($_GET['act']=='add' || $_GET['act']=='see' || $_GET['act']=='login' || $_GET['act']=='register' || $_GET['act']=='settings' || $_GET['act']=='myservers' || $_GET['act']=='minequery' || $_GET['act']=='help') { If ($_GET['act']=='add') { If (!$_SESSION['user']=='') { echo $addsv; } else { echo $login; } } If ($_GET['act']=='login') { If ($_SESSION['user']=='') { echo $login; } else { echo $servers; } } If ($_GET['act']=='register') { If ($_SESSION['user']=='') { echo $register; } else { echo $servers; } } If ($_GET['act']=='see') { If ($exist=='Yes') { echo $details; } else { echo $servers; } } If ($_GET['act']=='settings') { If ($_SESSION['user']=='') { echo $login; } else { echo $settings; } } If ($_GET['act']=='myservers') { echo $servers; } If ($_GET['act']=='minequery') { echo $minequery; } If ($_GET['act']=='help') { echo $help; } } else { echo $servers; } If ($sidebar=="Yes") { echo "</td><td align='right' width='20%' valign='top'> <table align='center' width='100%' class='fancy'> " .$rsidead. " </table> </td></tr> </table>"; } echo "</form>"; include ("./footer.php"); ?>
  7. hmmm im not sure how to do that I didnt create this script im just trying to make it have pages to show 20 at a time instead of all at once.
  8. Hello, I am trying to incorporate pagination to only show 20 rows per page but instead the links work but shows all rows on all pages. Link to see: http://webjax.99k.org/ Full Code: <?php include ("./header.php"); //PAGINATION $sql = "SELECT COUNT(*) FROM servers"; $result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 20; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; //END PAGINATION //======================================================================== Commands If (isSet($_GET['sort'])) { $sortby = $_GET['sort']; If ($sortby=='name' || $sortby=='ip' || $sortby=='votes' || $sortby=='username') { If ($sortby=='name') { $options = "<option value='./index.php?sort=name' selected='selected'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($sortby=='ip') { $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip' selected='selected'>IP Address</option> <option value='./index.php?sort=votes'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($sortby=='votes') { $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes' selected='selected'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($sortby=='username') { $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes'>Rank</option> <option value='./index.php?sort=username' selected='selected'>Owner</option>"; } } else { $sortby = "votes"; $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes' selected='selected'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } } else { $sortby = "votes"; $options = "<option value='./index.php?sort=name'>Name</option> <option value='./index.php?sort=ip'>IP Address</option> <option value='./index.php?sort=votes' selected='selected'>Rank</option> <option value='./index.php?sort=username'>Owner</option>"; } If ($_GET['act']=='see' && isSet($_GET['id'])) { //=================================================================== XSS protection $sid = str_replace("/", "", $_GET['id']); $sid = str_replace(Chr(92), "", $sid); $sid = str_replace("'", "", $sid); $sid = str_replace('"', "", $sid); $sid = str_replace("<", "", $sid); $sid = str_replace(">", "", $sid); $sid = str_replace("-", "", $sid); $sid = str_replace("union", "", $sid); $sid = str_replace("information_schema", "", $sid); $sid = strtolower(trim($sid)); //=================================================================== XSS protection $result = mysql_query("SELECT * FROM servers WHERE id='$sid'") or die (mysql_error()); $nr = mysql_num_rows($result); If ($nr<='0') { $exist = "No"; } else { $exist = "Yes"; while($row = mysql_fetch_array($result)) { If ($row['name']=='') { $servername = "<img src='./banners/" .$row['banner']. "' style='width:468px;height:60px' title='Server details'>"; } else { $servername = $row['name']; } $did = $row['id']; $dname = $row['name']; $dbanner = $row['banner']; $dip = $row['ip']; $ddescription = $row['description']; $dwebsite = $row['website']; $dcountry = $row['country']; $dsponsored = $row['sponsored']; $dvotes = $row['votes']; $mineq = $row['mineq']; $dusername = $row['username']; $ddate = $row['date']; If ($dusername==$username) { $me = "Yes"; } else { $me = "No"; } If ($mineq=='Yes') { If (!$dip=='') { include ("./minequery.class.php"); $mine = array((Minequery::query($dip))); $donlinep = $mine["0"]["playerCount"]; If ($donlinep>0) { for ($i = 0; $i <= $donlinep; $i++) { $playername = $mine["0"]["playerList"][$i]; If (!$playername=='') { $donline .= $playername. ", "; } } $donline = left($donline, strlen($donline)-2); } } else { $donline = "<i>n/a</i>"; } } else { $donline = "<i>n/a</i>"; } } } } If ($_GET['act']=='' || $_GET['act']=='sponsored' || $_GET['act']=='myservers') { $result = mysql_query("SELECT * FROM servers ORDER BY votes DESC") or die (mysql_error()); while($rk_list[] = mysql_fetch_array($result)); If (isSet($username) && $_GET['act']=='myservers') { $result = mysql_query("SELECT * FROM servers WHERE username='$username' ORDER BY id DESC") or die (mysql_error()); } else { If ($_GET['act']=='sponsored') { $result = mysql_query("SELECT * FROM servers WHERE sponsored='Yes' ORDER BY id DESC") or die (mysql_error()); } else { If (isSet($_GET['country'])) { $result = mysql_query("SELECT * FROM servers WHERE country='$_GET[country]' ORDER BY votes DESC") or die (mysql_error()); } else { $result = mysql_query("SELECT * FROM servers ORDER BY $sortby DESC") or die (mysql_error()); } } } $nr = mysql_num_rows($result); If ($nr<='0') { $serverslist = "<tr><td align='center' colspan='6'>There are no servers added yet !</td></tr>"; } else { include ("./minequery.class.php"); $rank = "0"; while($row = mysql_fetch_array($result)){ $data[] = $row; } foreach ($data as $row) { $rank = ($rank + 1); If ($row['banner']=='') { $servername = $row['name']; } else { $servername = "<img src='" .$row['banner']. "' style='width:400px;height:60px' title='Server details'>"; } If ($row['sponsored']=='Yes') { $star = "style='background:url(./images/star.png);background-repeat:no-repeat;'"; } else { $star = ""; } If ($row['mineq']=='Yes') { If (!$row['ip']=='') { $mine = array((Minequery::query($row['ip']))); $onlinep = $mine["0"]["playerCount"]; } else { $onlinep = "<i>n/a</i>"; } } else { $onlinep = "<i>n/a</i>"; } $country = "./flags/" .$row['country']. ".png"; $serverslist .= "<tr><td align='center'>" .(array_search($row, $rk_list) + 1). "</td><td align='center'><a href='./index.php?country=" .$row['country']. "'><img src='" .$country. "' title='" .$row['country']. "' style='width:32px;height:32px;'></a></td><td align='center' valign='middle' style='height:60px;'><a class='nav' href='./index.php?act=see&id=" .$row['id']. "' title='Server details'>" .$servername. "</a></td><td align='center' " .$star. ">" .$row['ip']. "</td><td align='center'>" .$onlinep. "</td><td align='center'>" .$row['votes']. "</td></tr>"; //$serverslist .= "<tr><td align='center'>" .$row['id']. "</td><td align='center' valign='middle' style='height:60px;'><a class='nav' href='./index.php?act=see&id=" .$row['id']. "' title='Server details'>" .$servername. "</a></td><td align='center'><img src='./flags/" .$row['country']. ".ico' title='" .$row['country']. "'> " .$row['ip']. "</td><td align='center'>" .$row['votes']. "</td><td align='center'>" .$row['date']. "</td></tr>"; //$serverslist .= "<tr><td align='center'>" .$row['id']. "</td><td align='center'>" .$servername. "</td><td align='center'>" .country_flag($row['ip']). " " .$row['ip']. "</td><td align='center'>" .$row['votes']. "</td></tr>"; } } } /****** build the pagination links ******/ // range of num links to show $range = 3; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; // echo forward link for lastpage echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } // end if /****** end build pagination links ******/ //======================================================================== Strings $countries = "<option>Afghanistan</option> <option>Albania</option> <option>Algeria</option> <option>Andorra</option> <option>Angola</option> <option>Antigua and Barbuda</option> <option>Argentina</option> <option>Armenia</option> <option>Aruba</option> <option>Australia</option> <option>Austria</option> <option>Azerbaijan</option> <option>Bahamas, The</option> <option>Bahrain</option> <option>Bangladesh</option> <option>Barbados</option> <option>Belarus</option> <option>Belgium</option> <option>Belize</option> <option>Benin</option> <option>Bermuda</option> <option>Bhutan</option> <option>Bolivia</option> <option>Bosnia and Herzegovina</option> <option>Botswana</option> <option>Brazil</option> <option>Brunei</option> <option>Bulgaria</option> <option>Burkina Faso</option> <option>Burma</option> <option>Burundi</option> <option>Cambodia</option> <option>Cameroon</option> <option>Canada</option> <option>Cape Verde</option> <option>Cayman Islands</option> <option>Central African Republic</option> <option>Chad</option> <option>Chile</option> <option>China</option> <option>Colombia</option> <option>Comoros</option> <option>Congo, Democratic Republic of the</option> <option>Congo, Republic of the</option> <option>Costa Rica</option> <option>Cote d'Ivoire</option> <option>Croatia</option> <option>Cuba</option> <option>Curacao</option> <option>Cyprus</option> <option>Czech Republic</option> <option>Denmark</option> <option>Djibouti</option> <option>Dominica</option> <option>Dominican Republic</option> <option>Ecuador</option> <option>Egypt</option> <option>El Salvador</option> <option>Equatorial Guinea</option> <option>Eritrea</option> <option>Estonia</option> <option>Ethiopia</option> <option>Fiji</option> <option>Finland</option> <option>France</option> <option>Gabon</option> <option>Gambia</option> <option>Georgia</option> <option>Germany</option> <option>Ghana</option> <option>Greece</option> <option>Grenada</option> <option>Guatemala</option> <option>Guinea</option> <option>Guinea-Bissau</option> <option>Guyana</option> <option>Haiti</option> <option>Holy See</option> <option>Honduras</option> <option>Hong Kong</option> <option>Hungary</option> <option>Iceland</option> <option>India</option> <option>Indonesia</option> <option>Iran</option> <option>Iraq</option> <option>Ireland</option> <option>Israel</option> <option>Italy</option> <option>Jamaica</option> <option>Japan</option> <option>Jordan</option> <option>Kazakhstan</option> <option>Kenya</option> <option>Kiribati</option> <option>Kosovo</option> <option>Kuwait</option> <option>Kyrgyzstan</option> <option>Laos</option> <option>Latvia</option> <option>Lebanon</option> <option>Lesotho</option> <option>Liberia</option> <option>Libya</option> <option>Liechtenstein</option> <option>Lithuania</option> <option>Luxembourg</option> <option>Macau</option> <option>Macedonia</option> <option>Madagascar</option> <option>Malawi</option> <option>Malaysia</option> <option>Maldives</option> <option>Mali</option> <option>Malta</option> <option>Marshall Islands</option> <option>Mauritania</option> <option>Mauritius</option> <option>Mexico</option> <option>Micronesia</option> <option>Moldova</option> <option>Monaco</option> <option>Mongolia</option> <option>Montenegro</option> <option>Morocco</option> <option>Mozambique</option> <option>Namibia</option> <option>Nauru</option> <option>Nepal</option> <option>Netherlands</option> <option>Netherlands Antilles</option> <option>New Zealand</option> <option>Nicaragua</option> <option>Niger</option> <option>Nigeria</option> <option>North Korea</option> <option>Norway</option> <option>Oman</option> <option>Pakistan</option> <option>Palau</option> <option>Panama</option> <option>Papua New Guinea</option> <option>Paraguay</option> <option>Peru</option> <option>Philippines</option> <option>Poland</option> <option>Portugal</option> <option>Qatar</option> <option>Romania</option> <option>Russia</option> <option>Rwanda</option> <option>Saint Kitts and Nevis</option> <option>Saint Lucia</option> <option>Saint Vincent and the Grenadines</option> <option>Samoa</option> <option>San Marino</option> <option>Sao Tome and Principe</option> <option>Saudi Arabia</option> <option>Senegal</option> <option>Serbia</option> <option>Seychelles</option> <option>Sierra Leone</option> <option>Singapore</option> <option>Slovakia</option> <option>Slovenia</option> <option>Solomon Islands</option> <option>Somalia</option> <option>South Africa</option> <option>South Korea</option> <option>South Sudan</option> <option>Spain</option> <option>Sri Lanka</option> <option>Sudan</option> <option>Suriname</option> <option>Swaziland</option> <option>Sweden</option> <option>Switzerland</option> <option>Syria</option> <option>Taiwan</option> <option>Tajikistan</option> <option>Tanzania</option> <option>Thailand</option> <option>Timor-Leste</option> <option>Togo</option> <option>Tonga</option> <option>Trinidad and Tobago</option> <option>Tunisia</option> <option>Turkey</option> <option>Turkmenistan</option> <option>Tuvalu</option> <option>Uganda</option> <option>Ukraine</option> <option>United Arab Emirates</option> <option>United Kingdom</option> <option>Uruguay</option> <option>Uzbekistan</option> <option>Vanuatu</option> <option>Venezuela</option> <option>Vietnam</option> <option>Yemen</option> <option>Zambia</option> <option>Zimbabwe</option>"; $servers = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='6'>Servers list</th></tr> <tr><td align='left' colspan='3'>Servers : " .$nr. "</td><td align='right' colspan='3'>Arrange by : <select name='by' onChange=location.href=this.options[this.selectedIndex].value;>" .$options. "</select></td></tr> <tr><th align='center' width='1%'>#</th><th align='center' width='1%'>Country</th><th align='center' width='47%'>Name / Banner</th><th align='center' width='20%'>IP Address</th><th align='center' width='1%'>Players Online</th><th align='center' width='1%'>Votes</th></tr> " .$serverslist. " </table>"; $addsv = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Add server</th></tr> <tr><td align='left' width='100px'>Name :</td><td align='left'><input class='field' type='text' name='aname' style='width:100%;'></td></tr> <tr><td align='left'>Banner url :</td><td align='left'><input class='field' type='text' name='abanner' style='width:100%;'></td></tr> <tr><td align='left'>Description :</td><td align='left'><textarea class='textarea' name='adescription'></textarea></td></tr> <tr><td align='left'>IP Address :</td><td align='left'><input class='field' type='text' name='aip'></td></tr> <tr><td align='left'>Website :</td><td align='left'><input class='field' type='text' name='awebsite'></td></tr> <tr><td align='left'>Country :</td><td align='left'><select name='acountry'>" .$countries. "</select></td></tr> <tr><td align='left'>MineQuery :</td><td align='left'><select name='amine'><option selected='selected'>Yes</option><option>No</option></select></td></tr> <tr><td align='left'>Captcha :</td><td align='left'><img src='./captcha.php' title='Captcha'> <input class='field' type='text' name='captcha' style='width:100px;' maxlength='5'></td></tr> <tr><td> </td><td align='left'><input type='submit' name='aok' value='Add'></td></tr> </table>"; $login = "<table align='left' class='fancy' width='40%'> <tr><th align='left' colspan='2'>Login</th></tr> <tr><td align='left' width='30%'>Username :</td><td align='left'><input class='field' type='text' name='lname'></td></tr> <tr><td align='left'>Password :</td><td align='left'><input class='field' type='password' name='lpass'></td></tr> <tr><td> </td><td align='left'><input type='submit' name='lok' value='Login'></td></tr> </table>"; $register = "<table align='left' class='fancy' width='45%'> <tr><th align='left' colspan='2'>Register</th></tr> <tr><td align='left' width='30%'>Username :</td><td align='left'><input class='field' type='text' name='rname'> <font color='red'>*</font></td></tr> <tr><td align='left'>E-mail :</td><td align='left'><input class='field' type='text' name='rmail'> <font color='red'>*</font></td></tr> <tr><td align='left'>Password :</td><td align='left'><input class='field' type='password' name='rpass'> <font color='red'>*</font></td></tr> <tr><td align='left'>Re-Password :</td><td align='left'><input class='field' type='password' name='rrepass'> <font color='red'>*</font></td></tr> <tr><td> </td><td align='left'><input type='submit' name='rok' value='Register'></td></tr> </table>"; $settings = "<table align='left' class='g' width='80%'> <tr><th align='left' colspan='2'>Settings</th></tr> <tr><td width='50%' valign='top'> <table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>My account</th></tr> <tr><td align='left'>E-mail : </td><td align='left'>" .$uemail. "</td></tr> <tr><td align='left'>Servers : </td><td align='left'>" .$uservers. "</td></tr> <tr><td align='left'>Next vote : </td><td align='left'>" .$unextvoted. "</td></tr> <tr><td align='left'>Join date : </td><td align='left'>" .$udate. "</td></tr> </table> </td><td width='50%' valign='top'> <table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Change password</th></tr> <tr><td align='left'>Current password : </td><td align='left'><input type='password' name='cpass'></td></tr> <tr><td align='left'>New password : </td><td align='left'><input type='password' name='cnpass'></td></tr> <tr><td align='left'>New re-password : </td><td align='left'><input type='password' name='cnrepass'></td></tr> <tr><td> </td><td align='left'><input type='submit' name='cok' value='Change'></td></tr> </table> </td></tr> </table>"; $f = fopen("./mine.txt", "r"); while ($line = fgets($f, 9999)) { $minetext .= $line. ""; } fclose($f); $minequery = "<table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>MineQuery</th></tr> <tr><td align='left'> " .$minetext. " </td></tr> </table>"; $f = fopen("./help.txt", "r"); while ($line = fgets($f, 9999)) { $helptext .= $line. ""; } fclose($f); $help = "<table align='left' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Help</th></tr> <tr><td align='left'> " .$helptext. " </td></tr> </table>"; If ($me=='No') { If ($dname=='') { $dname = "<i>none</i>"; } If ($dbanner=='') { $dbanner = "<i>none</i>"; } else { $dbanner = "<img src='" .$dbanner. "' title='Banner' style='width:468px;height:60px'>"; } $details = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Server details</th></tr> <tr><td align='left' width='100px'>Name :</td><td align='left'>" .$dname. "</td></tr> <tr><td align='left'>Banner url :</td><td align='left'>" .$dbanner. "</td></tr> <tr><td align='left'>Description :</td><td align='left'>" .$ddescription. "</td></tr> <tr><td align='left'>Players online :</td><td align='left'>" .$donline. "</td></tr> <tr><td align='left'>IP Address :</td><td align='left'>" .$dip. "</td></tr> <tr><td align='left'>Website :</td><td align='left'>" .$dwebsite. "</td></tr> <tr><td align='left'>Sponsored :</td><td align='left'>" .$dsponsored. "</td></tr> <tr><td align='left'>Votes :</td><td align='left'>" .$dvotes. "</td></tr> <tr><td align='left'>Owner :</td><td align='left'>" .$dusername. "</td></tr> <tr><td align='left'>Added at :</td><td align='left'>" .$ddate. "</td></tr> <tr><td align='left'>Vote link :</td><td align='left'><a class='nav' href='" .$siteurl. "/vote.php?id=" .$did. "' title='Vote link'>" .$siteurl. "/vote.php?id=" .$did. "</td></tr> </table>"; } else { $details = "<table align='center' class='fancy' width='100%'> <tr><th align='left' colspan='2'>Server details</th></tr> <tr><td align='left' width='100px'>Name :</td><td align='left'><input class='field' type='text' name='nname' style='width:700px;' value='" .$dname. "'></td></tr> <tr><td align='left'>Banner url :</td><td align='left'><input class='field' type='text' name='nbanner' style='width:700px;' value='" .$dbanner. "'></td></tr> <tr><td align='left'>Description :</td><td align='left'><textarea class='textarea' name='ndescription'>" .$ddescription. "</textarea></td></tr> <tr><td align='left'>Players online :</td><td align='left'>" .$donline. "</td></tr> <tr><td align='left'>IP Address :</td><td align='left'><input class='field' type='text' name='nip' value='" .$dip. "'></td></tr> <tr><td align='left'>Website :</td><td align='left'><input class='field' type='text' name='nwebsite' value='" .$dwebsite. "'></td></tr> <tr><td align='left'>Vote link :</td><td align='left'><a class='nav' href='" .$siteurl. "/vote.php?id=" .$did. "' title='Vote link'>" .$siteurl. "/vote.php?id=" .$did. "</td></tr> <tr><td> </td><td align='left'><input type='submit' name='dok' value='Update'> <input type='submit' name='delok' value='Delete'></td></tr> </table>"; } //======================================================================== Display echo "<form method='post' action='" .curPageURL(). "' style='margin:0px;'>"; If ($sidebar=="Yes") { echo "<table align='center' width='100%'> <tr><td align='left' width='80%' valign='top'>"; } If ($_GET['act']=='add' || $_GET['act']=='see' || $_GET['act']=='login' || $_GET['act']=='register' || $_GET['act']=='settings' || $_GET['act']=='myservers' || $_GET['act']=='minequery' || $_GET['act']=='help') { If ($_GET['act']=='add') { If (!$_SESSION['user']=='') { echo $addsv; } else { echo $login; } } If ($_GET['act']=='login') { If ($_SESSION['user']=='') { echo $login; } else { echo $servers; } } If ($_GET['act']=='register') { If ($_SESSION['user']=='') { echo $register; } else { echo $servers; } } If ($_GET['act']=='see') { If ($exist=='Yes') { echo $details; } else { echo $servers; } } If ($_GET['act']=='settings') { If ($_SESSION['user']=='') { echo $login; } else { echo $settings; } } If ($_GET['act']=='myservers') { echo $servers; } If ($_GET['act']=='minequery') { echo $minequery; } If ($_GET['act']=='help') { echo $help; } } else { echo $servers; } If ($sidebar=="Yes") { echo "</td><td align='right' width='20%' valign='top'> <table align='center' width='100%' class='fancy'> " .$rsidead. " </table> </td></tr> </table>"; } echo "</form>"; include ("./footer.php"); ?> this is where I tried to put pagination in: If ($_GET['act']=='' || $_GET['act']=='sponsored' || $_GET['act']=='myservers') { $result = mysql_query("SELECT * FROM servers ORDER BY votes DESC") or die (mysql_error()); while($rk_list[] = mysql_fetch_array($result)); If (isSet($username) && $_GET['act']=='myservers') { $result = mysql_query("SELECT * FROM servers WHERE username='$username' ORDER BY id DESC") or die (mysql_error()); } else { If ($_GET['act']=='sponsored') { $result = mysql_query("SELECT * FROM servers WHERE sponsored='Yes' ORDER BY id DESC") or die (mysql_error()); } else { If (isSet($_GET['country'])) { $result = mysql_query("SELECT * FROM servers WHERE country='$_GET[country]' ORDER BY votes DESC") or die (mysql_error()); } else { $result = mysql_query("SELECT * FROM servers ORDER BY $sortby DESC") or die (mysql_error()); } } } $nr = mysql_num_rows($result); If ($nr<='0') { $serverslist = "<tr><td align='center' colspan='6'>There are no servers added yet !</td></tr>"; } else { include ("./minequery.class.php"); $rank = "0"; while($row = mysql_fetch_array($result)){ $data[] = $row; } foreach ($data as $row) { $rank = ($rank + 1); If ($row['banner']=='') { $servername = $row['name']; } else { $servername = "<img src='" .$row['banner']. "' style='width:400px;height:60px' title='Server details'>"; } If ($row['sponsored']=='Yes') { $star = "style='background:url(./images/star.png);background-repeat:no-repeat;'"; } else { $star = ""; } If ($row['mineq']=='Yes') { If (!$row['ip']=='') { $mine = array((Minequery::query($row['ip']))); $onlinep = $mine["0"]["playerCount"]; } else { $onlinep = "<i>n/a</i>"; } } else { $onlinep = "<i>n/a</i>"; } $country = "./flags/" .$row['country']. ".png"; $serverslist .= "<tr><td align='center'>" .(array_search($row, $rk_list) + 1). "</td><td align='center'><a href='./index.php?country=" .$row['country']. "'><img src='" .$country. "' title='" .$row['country']. "' style='width:32px;height:32px;'></a></td><td align='center' valign='middle' style='height:60px;'><a class='nav' href='./index.php?act=see&id=" .$row['id']. "' title='Server details'>" .$servername. "</a></td><td align='center' " .$star. ">" .$row['ip']. "</td><td align='center'>" .$onlinep. "</td><td align='center'>" .$row['votes']. "</td></tr>"; //$serverslist .= "<tr><td align='center'>" .$row['id']. "</td><td align='center' valign='middle' style='height:60px;'><a class='nav' href='./index.php?act=see&id=" .$row['id']. "' title='Server details'>" .$servername. "</a></td><td align='center'><img src='./flags/" .$row['country']. ".ico' title='" .$row['country']. "'> " .$row['ip']. "</td><td align='center'>" .$row['votes']. "</td><td align='center'>" .$row['date']. "</td></tr>"; //$serverslist .= "<tr><td align='center'>" .$row['id']. "</td><td align='center'>" .$servername. "</td><td align='center'>" .country_flag($row['ip']). " " .$row['ip']. "</td><td align='center'>" .$row['votes']. "</td></tr>"; } } } /****** build the pagination links ******/ // range of num links to show $range = 3; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; // echo forward link for lastpage echo " <a href='./{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } // end if /****** end build pagination links ******/ I'm not sure what im doing wrong can anyone help?
  9. Well your idea makes sense but the problem is I am trying to make sure the user puts a valid backlink that has the proper href and innerhtml I dont want them to just put the link and leave the text blank so its a false link.
  10. I know what file_get_contents does, and I already got it working look at the link I provided, I want the output to be plaintext intead it is pulling out a link with the preg_match_all for $link[1]
  11. Hello, i am trying to pull the innerHTML out of this: <a href="(.*?)">(.*?)</a> here is what I have: <?php $html = file_get_contents("http://www.businessinvestingsource.com/blcheck2.html"); preg_match_all('/<a href="(.*?)">(.*?)<\/a>/', $html, $links, PREG_SET_ORDER); foreach ($links as $link) { $linkto = $link[1]; $anchor = $link[0]; echo "<b>Link:</b> ".$linkto."<br /><b>Anchor:</b> ".$anchor."<br /><br /> "; } ?> Now this code works but the innerHTML is coming out as a link I want it to come out as plaintext you can view here: http://businessinvestingsource.com/anchorcheck2.php Can anyone help? Thank you.
  12. Hello, I am trying to get this backlink checker that checks to make sure another website has my link on their website, so far I can check to make sure the "href" link is there and is correct, but I cant get the textContent to prove valid or not it seems to always be proving true even when the textConent is not in the mysql database. The other persons website will have this: <a href="http://businessinvestingsorce.com">Business Investing Source</a> I need to make sure Business Investing Source (the textContent) matches the anchor in the database. Here is my code: <?php function CheckForAnchorMatch($anchortext) { $query = mysql_query("SELECT * FROM allowed_anchor WHERE anchor='$anchortext'"); if(mysql_num_rows($query) != 0) { return true; } return false; } function CheckForTargetUrl($links, $target) { foreach ($links as $link) { if (strpos($link, $target) !== false) { return true; } } return false; } function ExtractHrefLinks($html) { $dom = new DOMDocument; $linkUrls = array(); @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link){ $linkUrls[] = $link->getAttribute('href'); } return $linkUrls; } function ExtractAnchorText($html) { $dom = new DOMDocument; $AnchorTexts = array(); @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link){ $AnchorTexts[] = $link->textContent; } return $AnchorTexts; } function backlink_check($contenturl){ $url = 'businessinvestingsource.com'; $source = $contenturl; $falseFound = false; $html = file_get_contents ( $source ); $links = ExtractHrefLinks($html); if (CheckForTargetUrl($links, $url) === false) { $falseFound = "true"; $reportArray[$source] = 0; } else { $falseFound = "false"; } $html = file_get_contents ( $source ); $anchortext = ExtractAnchorText($html); if (CheckForAnchorMatch($anchortext) === false) { $falseFound = true; } else { $falseFound = false; } return $falseFound; } ?> Help greatly appreciated
  13. i don't think you understand what I mean. What I am checking is if http://example.com/ has a backlink to my site. and both the bolded parts must match: <a href="http://google.com">Google</a> I already have it able to make sure http://google.com matches, but I need to make sure Google Matches whats in the table row(allowed_anchors) so if the word "Google" is one of the anchor(s) in the table then it matches lets say the table looked like this: | id | anchor | | 0 | Google | | 1 | Yahoo | | 2 | Bing | if the backlink on example.com looked like this: <a href="http://google.com">Search</a> then "Search" is not in the table so it doesnt match. So what I need to know is How to check the word "Search" (or whatever it may be) in the backlink to make sure it matches one of the anchor(s) in the table. I Hope this clarifies. Thanks
  14. Hello, I am trying to get this backlink checker to work i have it working so it checks that the link itself matches and is there but this is the harder part that I don't understand. I want to have it also check the nodeValue to make sure that it matches one of the nodeValue's from a mysql table this is the code I have to make it check the href link function CheckForTargetUrl($links, $target) { foreach ($links as $link) { if (strpos($link, $target) !== false) { return true; } } return false; } function ExtractHrefLinks($html) { $dom = new DOMDocument; $linkUrls = array(); @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link){ $linkUrls[] = $link->getAttribute('href'); } return $linkUrls; } function backlink_check($contenturl){ $url = 'businessinvestingsource.com'; $source = $contenturl; $falseFound = false; $html = file_get_contents ( $source ); $links = ExtractHrefLinks($html); if (CheckForTargetUrl($links, $url) === false) { $falseFound = "true"; $reportArray[$source] = 0; } else { $falseFound = "false"; } return $falseFound; } Now this all works fine, I just need it to check the actual nodeValue (anchor text as well) meaning check this: <a href="http://google.com">Google</a> There is a mysql table called "allowed_anchors" with 2 rows "id" and "anchor" I need it to check if the nodeValue matches 1 of the allowed_anchors from the table. If anyone knows how I can do this that would be very great i have been trying to figure it out for hours with no luck. Thanks very much for any help to come.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.