Jump to content
xisto Community

iGuest

Members
  • Content Count

    72,093
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by iGuest

  1. Firefox. Only use IE for windowsupdate.
  2. when your displaying multiple rows from a database, its a good idea to page them, i.e. so that you dont have a huge list of 100 rows from mysql on one page - rather, 10 on 10 pages, or 5 on 20 pages. This script allows you to create a flexible version of this. It can be shown in action here: http://forums.xisto.com/no_longer_exists/ an example of the way it works: http://forums.xisto.com/no_longer_exists/&pt=10&order=desc this shows page one, with 10 on each page, in descending order. http://forums.xisto.com/no_longer_exists/&pmit=5&order=asc this shows page 2, 5 on each page, in ascending order. p.s. if you like to fiddle you may find it doesnt work for big numbers - thats not a fault of the script, but simply that at the time of writing i only have 10 entries in my table. you may also notice that my layout is a bit dodgy - but dont worry about that, thats cos i mucked up the way my css loads by trying to be clever just adjust the links on your page to show the data however you want it ^simple Anywhere you need action or to take note there is writing in CAPITAL LETTERS First create a mysql table with an id column and anythign else you wish ....e.g. a title, author, date, - as long as it has an auto incrementing ID this should work. If you use this, Please link back to my site at http://forums.xisto.com/no_longer_exists/, as this system took me a lot of time to make /*----------------------------------news---------------------------------*/include 'db.php'///connect to db - file shown below INSERT YOUR MYSQL LOGIN DETAILS TO IT $table = '';////SET THE ABOVE VALUE TO THE NAME OF YOUR TABLE$order = $_GET['order'];$a = $_GET['$a'];if (!$a) {/*-------This sets which way up the data is shown - there may be a quicker way but this works ----------------------*/if ($order == asc) {$order = asc;$order_news = desc;$ord = Descending;/*--------------------------------*/} else {$order = desc;$order_news = asc;$ord = Ascending;}/////DEFAULT IS DESCENDING - CHANGE ABOVEprint "<a href="?page=$page&order=$order_news">Order $ord</a><br> n"; // get the pager input values $pagenum = $_GET['pagenum'];if(empty($pagenum)) {$pagenum = 1;}///the above gets the page number from the url/////DEFAULT IS 1 $limit = $_GET['limit'];if(empty($limit)) {$limit = 5;}///the above gets the number per page from the url/////DEFAULT IS 5 - CHANGE ABOVE$result = mysql_query("SELECT id FROM $table");$total = mysql_num_rows($result);///how many rows are there in total? (above)$pages = ceil($total / $limit);$offset = ($pagenum -1) * $limit;/* divide the total rows by the amount per page and use the ceil function to round the value to the next highest integer e.g. 97 items on 10 pages would be 9.7 rounded up to 10 pages */ if ($pagenum == 1) { echo "Previous"; } else { echo "<a href="?page=$page&pagenum=".($pagenum -1)."&limit=$limit&order=$order">Previous</a>"; echo " | "; }/* if the current page is 1, then there is no previous page - so dont link to a previous page. otherwise link to it. */ $i = 1; while ($i <= $pages) { echo "<a href="?page=$page&pagenum=$i&limit=$limit&order=$order">Page $i</a>"; $i++; echo " | "; } /* while a value is below the total number of pages, starting at 1, link to the intermediate pages */ if ($pagenum == $pages) { echo "Next"; } else { echo "<a href="?page=$page&pagenum=" . ($pagenum + 1) . "&limit=$limit&order=$order">Next</a>"; }///next page - using same logic as 'previous page' /* THE FOLLOWING IS THE 'display items' bit of the script - the previous is the page link script - ALL YOU NEED is $table adjusted (earlier) to match a table in your database which has some items in it *//* (below) select all items from the specified table that satisfy the conditions set by the url.*/$result = mysql_query("SELECT * FROM $table ORDER BY id $order LIMIT $offset, $limit");/* OUTPUT each article that satisfys the conditions of the url - i.e. all items on the selected page (below) */while($news=mysql_fetch_array($result)) {require "template.php";/* require the layout of the news item - script it as you wish, my version is shown below, e.g. you could replace "require "template.php";" with "print $news['title'].'<br>';" to show the title field's for each required item on a separate line*/} }/*----------------------------------news---------------------------------*/ template.php, this is an edited version of mine, id recommend using your own - but you should already have one if you have enough items to page. even if each item is a few words and its just to print each item on a separate line - that will suffice. <!--template start--><style type="text/css"><!--td,border { border-width:1px; padding: 4px;}--></style> <tr> <td width="100%" height="21" valign="top" bgcolor="#777799"> <font color=#ffffff> <b> <b> <? echo $news['title'] ?> </b> </font> </td> </tr> <tr> <td height="119" valign="top" bgcolor="#FFFFFF"><p> <font class="main"> <a name="<? echo $news['id'] ?>"></a> <br><? echo stripslashes($news['text']);?> <p> <font class="comment"> <font class="author">posted by <a href="mailto:<? echo $news['email'] ?>"><? echo $news['name'] ?> </a> |</font> <font class="time"> <a href=""><? echo $news['time'] ?> </a> </font> </font> <p> </td></tr><!--template end--> db.php <?//set database connection variables$hostname='localhost';$uname='';$password='';$database='';//establish database connection$connect = mysql_connect($hostname,$uname,$password);//display error if connection failsif ($connect==FALSE) { print 'Unable to connect to database: '.mysql_error();} else {//select databasemysql_select_db($database);}?>
  3. Nice, I will see if I can edit this to view users on my IRC Server! -Fatality
  4. This is a script to search through items quickly... <?php include 'db.php';/* you will need to connect to the database ENTER LOG IN in the included file below :) */$page = $_GET['page'];/*--$page currently refers to the database table name - adjust as neccessary --*/$field1 = '';$field2 = '';/* ADJUST the above 2 values to be 2 columns in the mysql database you want to search */ if(empty($c)) { ?><form action="?page=<? echo $page; ?>&c=1" method=POST><b>Find Results with: </b><br>Any of these words: <input type="text" length=40 name="any"> <br>All of these words: <input type="text" length=40 name="all"> <br>None of these words: <input type="text" length=40 name="none"> <br><input type="submit" value="Search"></form><? } else if($c) { if((!$all) || ($all == "")) { $all = ""; } else { $all = "+(".$all.")"; } if((!$any) || ($any == "")) { $any = ""; } if((!$none) || ($none == "")) { $none = ""; } else { $none = "-(".$none.")"; } $query = " SELECT *, MATCH($field1, $field2) AGAINST ('$all $none $any' IN BOOLEAN MODE) AS score FROM $page WHERE MATCH($field1, $field2) AGAINST ('$all $none $any' IN BOOLEAN MODE)"; $artm1 = MySQL_query($query); if(!$artm1) { echo MySQL_error()."<br>$query<br>"; } echo "<b>Article Matches</b><br>"; if(MySQL_num_rows($artm1) > 0) { echo "<table>"; echo "<tr><td>Score </td><td>$field1 </td><td> $field2</td></tr>"; while($artm2 = MySQL_fetch_array($artm1)) { $val = round($artm2['score'], 3); $val = $val*100; echo "<tr><td>$val</td>"; echo "<td>{$artm2['field1']}</td>"; echo "<td>{$artm2['field2']}</td></tr>";/*ADJUST ABOVE - the 2 lines above assumes the data is coming form columns in the mysql database named field1 and field2 - so adjust to suit you. Also, $val is the score for returned items. The above is essentially the way the script is shown for returned values. */ } echo "</table>"; } else { echo "No Results were found in this category.<br>"; } echo "<br>"; }?> db.php is shown below ENTER LOG IN: <?//set database connection variables$hostname='localhost';$uname='';$password='';$database='';//establish database connection$connect = mysql_connect($hostname,$uname,$password);//display error if connection failsif ($connect==FALSE) { print 'Unable to connect to database: '.mysql_error();} else {//select databasemysql_select_db($database);}?>
  5. Yes, because I have been grounded, I have not yet had a chance, Modnay I will be ungrounded! Then I will take the time to do it!-Fatal-Fatality
  6. Simple 'User Online' script If you use this, Please link back to my site at http://forums.xisto.com/no_longer_exists/ /* First create/edit the user the table with at least these fields: */CREATE TABLE user ( `id` int(11) NOT NULL auto_increment, 'username' varchar(40) NOT NULL, 'last_login' varchar(100) NOT NULL, PRIMARY KEY (last_login), ); <?///////////////////////* next write the script to retrieve online userscan be adjusted to appear anywhere on any page by copying the bit between //copy// and //end copy// to anywhere you wish. Without copying ti will show up when the url is file.php?page=usersonline assuming a name of file.php for this file */$page = $_GET['page'];if($page == usersonline) {/////COPY//////$useronlinetable = user;$server = "localhost"; $db_user = "username"; $db_pass = "password"; $database = "database"; /// INSERT basic info for db connectmysql_connect($server, $db_user, $db_pass); $timeout = 120;/* ADJUST how long after a user has refreshed a page that user is said to be offline. Currently 2 minutes. Value in seconds. */ $date=time();$date = $date+18000;$date = $date - $timeout;$sql_useron = mysql_query("SELECT * FROM users WHERE last_login > FROM_UNIXTIME($date)");$users_row = mysql_num_rows($sql_useron);if ($users_row == 1) {$userp = "user";$areis = "is";} else {$userp = "users";$areis = "are";}print "There $areis $users_row $userp currently online<br><br>";/* the following will display on page*/while($row=mysql_fetch_array($sql_useron)) {print $row["username"].'<br>';}/* end display on page*//////// END COPY/////}?> Final Bit... <?/*somewhere on the page you need to update the last login on page refreshmy website has this all linked to an IM system that ive posted on here - and you can adapt it however you want*/if (isset($_SESSION['username'])) { $date=time();$date = $date+18000; $sql = mysql_query("UPDATE users SET last_login=FROM_UNIXTIME($date) WHERE id='$userid'");}?>
  7. OK, i think yous should have an automatic sign up for free/paid plans. This is how you would do that. Their is this forum code downlaod thing that will change your rank by how many posts they have. And what yous could do is make that certain rank, that if you get 50posts for example your name would be good membr(or whatever you want) and make a room with an automatic sign up sheet for the cpanel, thatonly allows that rank member to join. This will help you guys out alot, and also save you some time. The only thing you have to do is check the IP's f the people and make sure they arent creating multiple accounts. Oh yea.. and when i was talking about the rank above, yous would have to creat another rank, and then so on, to whatever i said. Another thing i forgot to say. The code doesnt come with the automatic form thing i will personally have to look for that i know it exists though. If yous wil take this into consideration then i will try to find the code. Yous could try it for a week if yous want to see how it goes. considering yous are ovrwheelmed with requests.-Thanks
  8. i use opera because i download alot BRTURBO links.
  9. I have the link to download the NFSU2 full game, but not sure if i am allowed to post it here.If i am allowed i will post it please, tell me.
  10. The second one is pretty cool, but drop the first and third, they are just silly to watch.
  11. zoneedit is free dns hosting not a free domain
  12. IE because firefox runs slow on my computer :?:
  13. Ah hell no! There's too much text in those sigs, but the animations are funny
  14. iGuest

    My Site

    Ok thanks a lot for that info - what internet exploring device are you using?
  15. Remove those illegal files!!Since the server is in the USA this is illeagal!This is a final warning before your account will be deleted!
  16. You mean there other things besides firefox? :wink: P.S. Firefox.
  17. It'll make your explorer's windows go to 800x800 pixels..
  18. iGuest

    My Site

    there are some "bugs" in your site.the buttons on the top page"general", "the band", "mutimedia".they apear for a second then disapear. :?
  19. i found this script in you webpage while looking at your source.<!--// This will resize the window when it is opened or// refresh/reload is clicked to a width and height of 500 x 500// with is placed first, height is placed secondwindow.resizeTo(800,800)-->does that make it so everyone see's the website at the same size, no matter wat their resolution is set to :?:
  20. hi , your site is looking profesional altough it is your first site.best of luck
  21. #1 thnx i will fix that broken link.(guestbook?!?!) i dont have a guestbook yet.#2 the site is big because your resolution is 800x600 and mine is 1200xsomething...i dont know. my resolution is more than yours so the page will look really big for u. im going to have an intro were u can pick your resolution.#3 i will try to make my main website match my forum colors.#4 software share programs and p2p are not illegal in Canada, which is were i am, and even if i wasnt in Canada, im alowed to post music for people to listen to as long as im not letting them download it.so as long as you dont have a download manager, and as long as you do paste the urls below then click the "start" button or "download" button its not illegal.
  22. Here breasts are amazing! They can change instantly! http://www.anomalies-unlimited.com/Britney.html
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.