Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Well your host was reviewing your site when I looked. You are seeing this page because the system administrator of 000webhost.com is currently checking this website for malicious content. blah blah. Is quite a curious code you have there. I'm wondering what the values are in the rows. As if are you really getting values. Is your error reporting turned on in php.ini Maybe try to break down the selects and try to echo some of the row results to see what they actually are. I don't think these type lines are gonna work, are they actual image locations? $im = showpet_forum($pet[teenurl]); They should be actual locations to an image, and quoted. And where is $check() coming from? Another thing, the header should come before the display of the image. $image = imagecreatefrompng($im); header('Content-type: image/png'); return imagepng($image); also should destroy the temporary image each time or will run out of memory fast imagedestroy($image); Lets stop there for now, lol. You should try doing basic imagecreatefrom examples first to test the images, then try to place that into your functions the way you want. http://www.php.net/manual/en/book.image.php
  2. Firstly I saw you had a got to page there mistake. I'm guessing you would like the href link displayed? This should work for you. <?php //added these to test them, uncomment one //$result = "Swinging Ship"; //$result = "Roller Coaster"; //$result = "Ice Blast"; if ($result == "Swinging Ship") { $go_to_page = "Swing.php"; } elseif ($result == "Roller Coaster") { $go_to_page = "Roller.php"; } elseif ($result == "Ice Blast") { $go_to_page = "Ice.php"; } else { $go_to_page = "./"; //a default location to go? $result = "HOME"; } echo "<a href='$go_to_page'>$result</a>" ?>
  3. http://tools.pingdom.com/?url=http://dev.subverb.net&treeview=0&column=undefined&order=1&filter=undefined&type=1&save=undefined It seems this file is missing or very slow http://dev.subverb.net/ajax-loader.gif
  4. I made a simpler function exact to your needs. I'm sure can be added or improved upon, but it's a great start for you and works. <?php function getPathOne($new_url) { if ($new_url != '') { $url_parts = explode('/', $new_url); $protocol = strtolower($url_parts[0]); if ($protocol == 'http:' || $protocol == 'https:' || $protocol == 'ftp:' || $protocol == 'feed:') { $protocol = "$protocol//"; } else { $protocol = ""; } $parsed_url = parse_url(trim($new_url)); $parsed_url = trim($parsed_url[host] ? $parsed_url[host] : array_shift(explode('/', $parsed_url[path], 2))); $parsed_url = strtolower($parsed_url); $get_path_parse_url = parse_url($new_url, PHP_URL_PATH); $path_parts = explode("/",$get_path_parse_url); $extract_path_1 = $path_parts[1]; $host_and_path_1 = "$protocol$parsed_url/$extract_path_1"; return $host_and_path_1; } else { return "no url inserted"; } } ?> <?php //usage $url1 = "http://www.phpfreaks.com/forums/php-coding-help/?action=post"; $url2 = "www.phpfreaks.com/forums/php-coding-help/?action=post"; $url3 = "phpfreaks.com/forums/php-coding-help/"; $url4 = "HTTP://WWW.PHPFREAKS.COM/forums/php-coding-help/?action=post"; $example_1 = getPathOne($url1); $example_2 = getPathOne($url2); $example_3 = getPathOne($url3); $example_4 = getPathOne($url4); echo "$example_1<br />$example_2<br />$example_3<br />$example_4<br />"; ?>
  5. Trust me when I say I spent lots of time making this, I even have more code that gets the main parsed host from subdomains, checks for correct http and so on, I tried to simplify it all into the below code so everyone can use what they need from it. <?php $url = "http://www.phpfreaks.com/forums/php-coding-help/?action=post"; function getparsedHost($new_parse_url) { $parsedUrl = parse_url(trim($new_parse_url)); return trim($parsedUrl[host] ? $parsedUrl[host] : array_shift(explode('/', $parsedUrl[path], 2))); } $new_parse_url = $url; $get_parse_url = parse_url($new_parse_url, PHP_URL_HOST); $host_parse_url .= str_replace(array('Www.','WWW.'), '', $get_parse_url); $host_parse_url = strtolower($host_parse_url); $port_parse_url = parse_url($new_parse_url, PHP_URL_PORT); $user_parse_url = parse_url($new_parse_url, PHP_URL_USER); $pass_parse_url = parse_url($new_parse_url, PHP_URL_PASS); $get_path_parse_url = parse_url($new_parse_url, PHP_URL_PATH); $path_parts = explode("/",$get_path_parse_url); $extract_path_1 = $path_parts[1]; $extract_path_2 = $path_parts[2]; $extract_path_3 = $path_parts[3]; $path_parse_url .= str_replace(array('Www.','WWW.'), '', $get_path_parse_url); $query_parse_url = parse_url($new_parse_url, PHP_URL_QUERY); $query_parse_url = "?$query_parse_url"; $query_parse_url = rtrim($query_parse_url, '#'); $fragment_parse_url = parse_url($new_parse_url, PHP_URL_FRAGMENT); $fragment_parse_url = "#$fragment_parse_url"; $hostpath_url = "$host_parse_url$path_parse_url"; $hostpath_url = rtrim($hostpath_url, '?'); $query_parse_url = rtrim($query_parse_url, '?'); $hostpathquery_url = "$host_parse_url$path_parse_url$query_parse_url"; $complete_url = "$host_parse_url$port_parse_url$user_parse_url$pass_parse_url$path_parse_url$query_parse_url$fragment_parse_url"; $complete_url = rtrim($complete_url, '#'); //adding http back to front, can do substr checks in url to suit your needs $complete_url = "http://$complete_url"; $parsed = getparsedHost($new_parse_url); echo "url: $url<br />"; echo "parsed: $parsed <br />"; echo "host parse: $host_parse_url<br />"; echo "path parse: $path_parse_url<br />"; echo "extract path 1: $extract_path_1<br />"; echo "extract path 2: $extract_path_2<br />"; echo "extract path 3: $extract_path_3<br />"; echo "host and path: $hostpath_url<br />"; echo "complete: $complete_url<br />"; ?>
  6. Really should read up some tutorials on read and write to text files, but as for a simple example to add a new line can do this. If you keep visiting the new php file you made you will see it adding the new lines every refresh. <?php //read a file $my_file = "file.txt"; if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total lines: $total<br />"; foreach ($data as $line) { echo "$line<br />"; } //the a+ is add $write = fopen($my_file, 'a+'); $message = "I just added this line\r\n"; fputs($write, $message); fclose($write); /*note the w, this will overwrite the entire contents $write = fopen($my_file, 'w'); $message = "I just added this line\r\n"; fputs($write, $message); fclose($write); */ } else { echo "No file to display"; } ?>
  7. <?php $my_file = "file.txt"; if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total lines: $total<br />"; foreach ($data as $line) { echo "$line<br />"; } } else { echo "No file to display"; } ?>
  8. What type of checks, if alive, response code, maybe something different in data. Then whats it need to send back to you. I just see no point in displaying output to entire pages a hundred times, and that's your main memory hog.
  9. I tried this out. You never close the curl connection. It's doing the exact same url's and displaying their entire pages numerous times. By doing it this way for whatever reason you may have, I'm not sure what trying to accomplish here, but their links won't work when they start with ./ or ../, the link would be relative to your own site. Look into http://simplehtmldom.sourceforge.net/ but can still use curl to resolve the url locations and error handling. I use single curl requests and save url's to text files, I grab the top url, delete from the text file and curl to the site, grab the information if alive, then do a meta refresh and onto the next url in the list. place this end of php code, it'll execute when the php completes echo('<meta http-equiv="refresh" content="1">');
  10. True, I just wrote this up and trying to get it out there. So here is the modified and completed for a while, because I don't need this anything else. Example: http://get.blogdns.com/dynaindex/paginate.php Code: <?php //get the url from the address bar $url = filter_var("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER["QUERY_STRING"])){ $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $url .= "?".$query_string; } echo "<a href='$url'>$url</a><br />"; $posts_per_page = 10;//keep this 10 for now, I never got to doing more calculations for everything yet //check if the starting row variable was passed in the URL or not if (!isset($_GET['page']) or !is_numeric($_GET['page'])) { //we give the value of the starting row to 0 because nothing was found in URL $startrow = 0; } else { //get starting row value from url page bumber and convert $temp_page=mysql_real_escape_string($_GET['page']); $convert = $temp_page * $posts_per_page -$posts_per_page; $startrow = (int)$convert; } $startrow=mysql_real_escape_string($startrow); //conversions of start row for checking and making of pages $prev = $startrow - 10; $prev20 = $startrow - 20; $prev30 = $startrow - 30; $prev40 = $startrow - 40; $prev50 = $startrow - 50; $prev100 = $startrow - 100; $prev1000 = $startrow - 1000; $prev10000 = $startrow - 10000; $prev100000 = $startrow - 100000; $next = $startrow + 10; $next20 = $startrow + 20; $next30 = $startrow + 30; $next40 = $startrow + 40; $next50 = $startrow + 50; $next100 = $startrow + 100; $next1000 = $startrow + 1000; $next10000 = $startrow + 10000; $next100000 = $startrow + 100000; if ($prev20 <= -20){ $prev20 = $prev20 / 10; } if ($prev30 <= -30){ $prev30 = $startrow - 30; } if ($prev40 <= -40){ $prev40 = $startrow - 40; } if ($prev50 <= -50){ $prev50 = $startrow - 50; } if ($prev100 <= -100){ $prev100 = $startrow - 100; } if ($prev1000 <= -1000){ $prev1000 = $startrow - 1000; } if ($prev10000 <= -10000){ $prev10000 = $startrow - 10000; } if ($prev100000 <= -100000){ $prev100000 = $startrow - 100000; } if ($prev1000000 <= -1000000){ $prev1000000 = $startrow - 1000000; } if ($prev10000000 <= -10000000){ $prev10000000 = $startrow - 10000000; } if ($prev100000000 <= -100000000){ $prev100000000 = $startrow - 100000000; } if ($next <= +10){ $next = $startrow + 10; } if ($next20 <= +20){ $next20 = $startrow + 20; } if ($next30 <= +30){ $next30 = $startrow + 30; } if ($next40 <= +40){ $next40 = $startrow + 40; } if ($next50 <= +50){ $next50 = $startrow + 50; } if ($next100 <= +100){ $next100 = $startrow + 100; } if ($next1000 <= +1000){ $next1000 = $startrow + 1000; } if ($next10000 <= +10000){ $next10000 = $startrow + 10000; } if ($next100000 <= +100000){ $next100000 = $startrow + 100000; } if ($next1000000 <= +1000000){ $next1000000 = $startrow + 1000000; } if ($next10000000 <= +10000000){ $next10000000 = $startrow + 10000000; } if ($next100000000 <= +100000000){ $next100000000 = $startrow + 100000000; } $deduct1pages = $prev / 10 +1; $deduct2pages = $prev20 / 10 +1; $deduct3pages = $prev30 / 10 +1; $deduct4pages = $prev40 / 10 +1; $deduct5pages = $prev50 / 10 +1; $deduct10pages = $prev100 / 10 +1; $deduct100pages = $prev1000 / 10 +1; $deduct1000pages = $prev10000 / 10 +1; $deduct10000pages = $prev100000 / 10 +1; $deduct100000pages = $prev1000000 / 10 +1; $deduct1000000pages = $prev10000000 / 10 +1; $deduct10000000pages = $prev100000000 / 10 +1; $add1pages = $next / 10 +1; $add2pages = $next20 / 10 +1; $add3pages = $next30 / 10 +1; $add4pages = $next40 / 10 +1; $add5pages = $next50 / 10 +1; $add10pages = $next100 / 10 +1; $add100pages = $next1000 / 10 +1; $add1000pages = $next10000 / 10 +1; $add10000pages = $next100000 / 10 +1; $add100000pages = $next1000000 / 10 +1; $add1000000pages = $next10000000 / 10 +1; $add10000000pages = $next100000000 / 10 +1; //get the page, if none set defaults to page 1 $nav_get = mysql_real_escape_string($_GET['page']); if (empty($_GET['page'])) { $nav_get = 1; } //the navigation url gets the actual address bar url, then hacks off the get page number value, the navigation itself then replaces the value $navigation_url = filter_var("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); if (!empty($_SERVER["QUERY_STRING"])){ $query_string = filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING); $navigation_url .= "?".$query_string; } if ($url == "./" OR $url == "./index.php"){ //you can change these to your needs $navigation_url = "$navigation_url?&page=1"; } $navigation_url = trim($navigation_url1,$nav_get); $navigation_url ="$navigation_url?page="; //This is where the mysql select would go using the values of LIMIT $startrow,$posts_per_page at end of select statement //lets just echo these to see what is changing echo "From mysql startrow $startrow and a max $posts_per_page posts per page<br />"; //total count would be the total items from the same mysql query but not using any limits $total_count = 345781;//lets just pick some wild number so we can use this with no queries $total_posts = $total_count; //using total posts, convert to pages using the last total_count number $lastposts = $total_posts - $posts_per_page; $nextposts = $total_posts +1; $total_posts_pages = $total_posts / $posts_per_page; list($int,$dec)=explode('.', $total_posts_pages); $int_pages = $int +1; $secondfromlast = $int_pages - 1; $thirdfromlast = $secondfromlast - 1; $fourthfromlast = $thirdfromlast - 1; $fifthfromlast = $fourthfromlast - 1; $page_numbers = $startrow / $posts_per_page; $total_pages = $total_posts / $posts_per_page; $page_number = $startrow / $posts_per_page + 1; if (!$_GET['page']) { $_GET['page'] = 1; } if ($page_number >= $int_pages+1) { $_GET['page'] = $int_pages; echo "<h2>That page number exceeded the max pages this result</h2><br />"; } if ($_GET['page'] <= 0) { $_GET['page'] = 1; } if ($page_number <= 0) { echo "<h2>That page number was lower than the pages this result</h2><br />"; } if ($total_posts == 0){ echo '<h2>No results found.</h2>'; } echo "Page $page_number of $int_pages - $total_posts Results<br />"; //the page navigation hyperlinks echo '[<a href="./index.php?page=1"><b> New Posts</b></a>]'; if ($prev >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1pages.'"><b><<- Previous.. </b></a>]'; } if ($next <= $nextposts){ echo '[<a href="'.$navigation_url.''.$add1pages.'"><b> ..Next ->></b></a>]'; } ?> <br /> <?php if ($int_pages >= 1){ echo '[<a href="'.$navigation_url.'1"> <b> First </b></a>]'; } else { echo "No Resultss Found For That Search, Please Try A Different One."; } if ($int_pages >= 2){ echo '[<a href="'.$navigation_url.'2"> <b> 2 </b></a>]'; } if ($int_pages >= 3){ echo '[<a href="'.$navigation_url.'3"> <b> 3 </b></a>]'; } if ($int_pages >= 4){ echo '[<a href="'.$navigation_url.'4"> <b> 4 </b></a>]'; } if ($int_pages >= 5){ echo '[<a href="'.$navigation_url.'5"> <b> 5 </b></a>]'; } if ($prev >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1pages.'">-1</a>]'; } if ($prev20 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct2pages.'">-2</a>]'; } if ($prev30 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct3pages.'">-3</a>]'; } if ($prev40 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct4pages.'">-4</a>]'; } if ($prev50 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct5pages.'">-5</a>]'; } if ($prev100 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10pages.'">-10</a>]'; } if ($prev1000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct100pages.'">-100</a>]'; } if ($prev10000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1000pages.'">-1000</a>]'; } if ($prev100000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10000pages.'">-10000</a>]'; } if ($prev1000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct100000pages.'">-100000</a>]'; } if ($prev10000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1000000pages.'">-100000</a>]'; } if ($prev100000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10000000pages.'">-1000000</a>]'; } echo '<div align="left">'; if ($next10000000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1000000pages.'">+1000000</a>]'; } if ($next1000000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add100000pages.'">+100000</a>]'; } if ($next100000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add10000pages.'">+10000</a>]'; } if ($next10000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1000pages.'">+1000</a>]'; } if ($next1000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add100pages.'">+100</a>]'; } if ($next100 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add10pages.'">+10</a>]'; } if ($next50 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add5pages.'">+5</a>]'; } if ($next40 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add4pages.'">+4</a>]'; } if ($next30 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add3pages.'">+3</a>]'; } if ($next20 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add2pages.'">+2</a>]'; } if ($next <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1pages.'">+1</a>]'; } if ($int_pages >= 5){ echo '[<a href="'.$navigation_url.''.$fifthfromlast.'"><b>Last5</b></a>]'; } if ($int_pages >= 4){ echo '[<a href="'.$navigation_url.''.$fourthfromlast.'"><b>Last4</b></a>]'; } if ($int_pages >= 3){ echo '[<a href="'.$navigation_url.''.$thirdfromlast.'"><b>Last3</b></a>]'; } if ($int_pages >= 2){ echo '[<a href="'.$navigation_url.''.$secondfromlast.'"><b>Last2</b></a>]'; } if ($int_pages >= $int_pages){ echo '[<a href="'.$navigation_url.''.$int_pages.'"><b>Last</b></a>]'; } echo ''; echo '<br />'; ?> <br /> <form name="input" action="<?php echo $navigation_url; ?>" method="get"> <?php if ($_GET['page'] == 0) { $_GET['page'] = 1; } ?> Page:<input onfocus="this.value=''" size="15" type="text" name="page" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $_GET['page']; ?>"/> <input type="submit" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="Get Page" /> </form>
  11. And to add to that, did you restart so the changes take effect.
  12. Hey sorry, but my browser was saving old views and thought i had this somewhat done. New code that works. <?php //get the url from the address bar $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if (!empty($_SERVER["QUERY_STRING"])) $url .= "?".$_SERVER['QUERY_STRING']; echo "<a href='$url'>$url</a><br />"; $posts_per_page = 10;//keep this 10 for now, I never got to doing more calculations for everything yet //check if the starting row variable was passed in the URL or not if (!isset($_GET['page']) or !is_numeric($_GET['page'])) { //we give the value of the starting row to 0 because nothing was found in URL $startrow = 0; } else { //get starting row value from url page bumber and convert $temp_page=mysql_real_escape_string($_GET['page']); $convert = $temp_page * $posts_per_page -$posts_per_page; $startrow = (int)$convert; } $startrow=mysql_real_escape_string($startrow); //conversions of start row for checking and making of pages $prev = $startrow - 10; $prev20 = $startrow - 20; $prev30 = $startrow - 30; $prev40 = $startrow - 40; $prev50 = $startrow - 50; $prev100 = $startrow - 100; $prev1000 = $startrow - 1000; $prev10000 = $startrow - 10000; $prev100000 = $startrow - 100000; $next = $startrow + 10; $next20 = $startrow + 20; $next30 = $startrow + 30; $next40 = $startrow + 40; $next50 = $startrow + 50; $next100 = $startrow + 100; $next1000 = $startrow + 1000; $next10000 = $startrow + 10000; $next100000 = $startrow + 100000; if ($prev20 <= -20){ $prev20 = $prev20 / 10; } if ($prev30 <= -30){ $prev30 = $startrow - 30; } if ($prev40 <= -40){ $prev40 = $startrow - 40; } if ($prev50 <= -50){ $prev50 = $startrow - 50; } if ($prev100 <= -100){ $prev100 = $startrow - 100; } if ($prev1000 <= -1000){ $prev1000 = $startrow - 1000; } if ($prev10000 <= -10000){ $prev10000 = $startrow - 10000; } if ($prev100000 <= -100000){ $prev100000 = $startrow - 100000; } if ($prev1000000 <= -1000000){ $prev1000000 = $startrow - 1000000; } if ($prev10000000 <= -10000000){ $prev10000000 = $startrow - 10000000; } if ($prev100000000 <= -100000000){ $prev100000000 = $startrow - 100000000; } if ($next <= +10){ $next = $startrow + 10; } if ($next20 <= +20){ $next20 = $startrow + 20; } if ($next30 <= +30){ $next30 = $startrow + 30; } if ($next40 <= +40){ $next40 = $startrow + 40; } if ($next50 <= +50){ $next50 = $startrow + 50; } if ($next100 <= +100){ $next100 = $startrow + 100; } if ($next1000 <= +1000){ $next1000 = $startrow + 1000; } if ($next10000 <= +10000){ $next10000 = $startrow + 10000; } if ($next100000 <= +100000){ $next100000 = $startrow + 100000; } if ($next1000000 <= +1000000){ $next1000000 = $startrow + 1000000; } if ($next10000000 <= +10000000){ $next10000000 = $startrow + 10000000; } if ($next100000000 <= +100000000){ $next100000000 = $startrow + 100000000; } $deduct1pages = $prev / 10 +1; $deduct2pages = $prev20 / 10 +1; $deduct3pages = $prev30 / 10 +1; $deduct4pages = $prev40 / 10 +1; $deduct5pages = $prev50 / 10 +1; $deduct10pages = $prev100 / 10 +1; $deduct100pages = $prev1000 / 10 +1; $deduct1000pages = $prev10000 / 10 +1; $deduct10000pages = $prev100000 / 10 +1; $deduct100000pages = $prev1000000 / 10 +1; $deduct1000000pages = $prev10000000 / 10 +1; $deduct10000000pages = $prev100000000 / 10 +1; $add1pages = $next / 10 +1; $add2pages = $next20 / 10 +1; $add3pages = $next30 / 10 +1; $add4pages = $next40 / 10 +1; $add5pages = $next50 / 10 +1; $add10pages = $next100 / 10 +1; $add100pages = $next1000 / 10 +1; $add1000pages = $next10000 / 10 +1; $add10000pages = $next100000 / 10 +1; $add100000pages = $next1000000 / 10 +1; $add1000000pages = $next10000000 / 10 +1; $add10000000pages = $next100000000 / 10 +1; //get the page, if none set defaults to page 1 $nav_get = mysql_real_escape_string($_GET['page']); if (empty($_GET['page'])) { $nav_get = 1; } //the navigation url gets the actual address bar url, then hacks off the get page number value, the navigation itself then replaces the value $navigation_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if (!empty($_SERVER["QUERY_STRING"])){ $navigation_url .= "?".$_SERVER['QUERY_STRING']; } if ($url == "./" OR $url == "./index.php"){ //you can change these to your needs $navigation_url = "$navigation_url?&page=1"; } $navigation_url = trim($navigation_url1,$nav_get); $navigation_url ="$navigation_url?page="; //This is where the mysql select would go using the values of LIMIT $startrow,$posts_per_page at end of select statement //lets just echo these to see what is changing echo "From mysql startrow $startrow and a max $posts_per_page posts per page<br />"; //total count would be the total items from the same mysql query but not using any limits $total_count = 345781;//lets just pick some wild number so we can use this with no queries $total_posts = $total_count; //using total posts, convert to pages using the last total_count number $lastposts = $total_posts - $posts_per_page; $nextposts = $total_posts +1; $total_posts_pages = $total_posts / $posts_per_page; list($int,$dec)=explode('.', $total_posts_pages); $int_pages = $int +1; $secondfromlast = $int_pages - 1; $thirdfromlast = $secondfromlast - 1; $fourthfromlast = $thirdfromlast - 1; $fifthfromlast = $fourthfromlast - 1; $page_numbers = $startrow / $posts_per_page; $total_pages = $total_posts / $posts_per_page; $page_number = $startrow / $posts_per_page + 1; if (!$_GET['page']) { $_GET['page'] = 1; } if ($page_number >= $int_pages+1) { $_GET['page'] = $int_pages; echo "<h2>That page number exceeded the max pages this result</h2><br />"; } if ($_GET['page'] <= 0) { $_GET['page'] = 1; } if ($page_number <= 0) { echo "<h2>That page number was lower than the pages this result</h2><br />"; } if ($total_posts == 0){ echo '<h2>No results found.</h2>'; } echo "Page $page_number of $int_pages - $total_posts Results<br />"; //the page navigation hyperlinks echo '[<a href="./index.php?page=1"><b> New Posts</b></a>]'; if ($prev >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1pages.'"><b><<- Previous.. </b></a>]'; } if ($next <= $nextposts){ echo '[<a href="'.$navigation_url.''.$add1pages.'"><b> ..Next ->></b></a>]'; } ?> <br /> <?php if ($int_pages >= 1){ echo '[<a href="'.$navigation_url.'1"> <b> First </b></a>]'; } else { echo "No Resultss Found For That Search, Please Try A Different One."; } if ($int_pages >= 2){ echo '[<a href="'.$navigation_url.'2"> <b> 2 </b></a>]'; } if ($int_pages >= 3){ echo '[<a href="'.$navigation_url.'3"> <b> 3 </b></a>]'; } if ($int_pages >= 4){ echo '[<a href="'.$navigation_url.'4"> <b> 4 </b></a>]'; } if ($int_pages >= 5){ echo '[<a href="'.$navigation_url.'5"> <b> 5 </b></a>]'; } if ($prev >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1pages.'">-1</a>]'; } if ($prev20 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct2pages.'">-2</a>]'; } if ($prev30 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct3pages.'">-3</a>]'; } if ($prev40 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct4pages.'">-4</a>]'; } if ($prev50 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct5pages.'">-5</a>]'; } if ($prev100 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10pages.'">-10</a>]'; } if ($prev1000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct100pages.'">-100</a>]'; } if ($prev10000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1000pages.'">-1000</a>]'; } if ($prev100000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10000pages.'">-10000</a>]'; } if ($prev1000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct100000pages.'">-100000</a>]'; } if ($prev10000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1000000pages.'">-100000</a>]'; } if ($prev100000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10000000pages.'">-1000000</a>]'; } echo '<div align="left">'; if ($next10000000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1000000pages.'">+1000000</a>]'; } if ($next1000000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add100000pages.'">+100000</a>]'; } if ($next100000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add10000pages.'">+10000</a>]'; } if ($next10000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1000pages.'">+1000</a>]'; } if ($next1000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add100pages.'">+100</a>]'; } if ($next100 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add10pages.'">+10</a>]'; } if ($next50 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add5pages.'">+5</a>]'; } if ($next40 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add4pages.'">+4</a>]'; } if ($next30 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add3pages.'">+3</a>]'; } if ($next20 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add2pages.'">+2</a>]'; } if ($next <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1pages.'">+1</a>]'; } if ($int_pages >= 5){ echo '[<a href="'.$navigation_url.''.$fifthfromlast.'"><b>Last5</b></a>]'; } if ($int_pages >= 4){ echo '[<a href="'.$navigation_url.''.$fourthfromlast.'"><b>Last4</b></a>]'; } if ($int_pages >= 3){ echo '[<a href="'.$navigation_url.''.$thirdfromlast.'"><b>Last3</b></a>]'; } if ($int_pages >= 2){ echo '[<a href="'.$navigation_url.''.$secondfromlast.'"><b>Last2</b></a>]'; } if ($int_pages >= $int_pages){ echo '[<a href="'.$navigation_url.''.$int_pages.'"><b>Last</b></a>]'; } echo ''; echo '<br />'; ?> <br /> <form name="input" action="<?php echo $navigation_url; ?>" method="get"> <?php if ($_GET['page'] == 0) { $_GET['page'] = 1; } ?> Page:<input onfocus="this.value=''" size="15" type="text" name="page" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $_GET['page']; ?>"/> <input type="submit" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="Get Page" /> </form>
  13. Here is a pagination I came up with. Can see a working example here. http://get.blogdns.com/dynaindex/paginate.php As of right now it limits to 10 per page, never got any further with it because 10 was all I wanted. Maybe can even improve on this, use some idea's from it. And the code. <?php //get the url from the address bar $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if (!empty($_SERVER["QUERY_STRING"])) $url .= "?".$_SERVER['QUERY_STRING']; echo "<a href='$url'>$url</a><br />"; $posts_per_page = 10;//keep this 10 for now, I never got to doing more calculations for everything yet //check if the starting row variable was passed in the URL or not if (!isset($_GET['page']) or !is_numeric($_GET['page'])) { //we give the value of the starting row to 0 because nothing was found in URL $startrow = 0; } else { //get starting row value from url page bumber and convert $temp_page=mysql_real_escape_string($_GET['page']); $convert = $temp_page * $posts_per_page -$posts_per_page; $startrow = (int)$convert; } $startrow=mysql_real_escape_string($startrow); //conversions of start row for checking and making of pages $prev = $startrow - 10; $prev20 = $startrow - 20; $prev30 = $startrow - 30; $prev40 = $startrow - 40; $prev50 = $startrow - 50; $prev100 = $startrow - 100; $prev1000 = $startrow - 1000; $prev10000 = $startrow - 10000; $prev100000 = $startrow - 100000; $next = $startrow + 10; $next20 = $startrow + 20; $next30 = $startrow + 30; $next40 = $startrow + 40; $next50 = $startrow + 50; $next100 = $startrow + 100; $next1000 = $startrow + 1000; $next10000 = $startrow + 10000; $next100000 = $startrow + 100000; if ($prev20 <= -20){ $prev20 = $prev20 / 10; } if ($prev30 <= -30){ $prev30 = $startrow - 30; } if ($prev40 <= -40){ $prev40 = $startrow - 40; } if ($prev50 <= -50){ $prev50 = $startrow - 50; } if ($prev100 <= -100){ $prev100 = $startrow - 100; } if ($prev1000 <= -1000){ $prev1000 = $startrow - 1000; } if ($prev10000 <= -10000){ $prev10000 = $startrow - 10000; } if ($prev100000 <= -100000){ $prev100000 = $startrow - 100000; } if ($prev1000000 <= -1000000){ $prev1000000 = $startrow - 1000000; } if ($prev10000000 <= -10000000){ $prev10000000 = $startrow - 10000000; } if ($prev100000000 <= -100000000){ $prev100000000 = $startrow - 100000000; } if ($next <= +10){ $next = $startrow + 10; } if ($next20 <= +20){ $next20 = $startrow + 20; } if ($next30 <= +30){ $next30 = $startrow + 30; } if ($next40 <= +40){ $next40 = $startrow + 40; } if ($next50 <= +50){ $next50 = $startrow + 50; } if ($next100 <= +100){ $next100 = $startrow + 100; } if ($next1000 <= +1000){ $next1000 = $startrow + 1000; } if ($next10000 <= +10000){ $next10000 = $startrow + 10000; } if ($next100000 <= +100000){ $next100000 = $startrow + 100000; } if ($next1000000 <= +1000000){ $next1000000 = $startrow + 1000000; } if ($next10000000 <= +10000000){ $next10000000 = $startrow + 10000000; } if ($next100000000 <= +100000000){ $next100000000 = $startrow + 100000000; } $deduct1pages = $prev / 10 +1; $deduct2pages = $prev20 / 10 +1; $deduct3pages = $prev30 / 10 +1; $deduct4pages = $prev40 / 10 +1; $deduct5pages = $prev50 / 10 +1; $deduct10pages = $prev100 / 10 +1; $deduct100pages = $prev1000 / 10 +1; $deduct1000pages = $prev10000 / 10 +1; $deduct10000pages = $prev100000 / 10 +1; $deduct100000pages = $prev1000000 / 10 +1; $deduct1000000pages = $prev10000000 / 10 +1; $deduct10000000pages = $prev100000000 / 10 +1; $add1pages = $next / 10 +1; $add2pages = $next20 / 10 +1; $add3pages = $next30 / 10 +1; $add4pages = $next40 / 10 +1; $add5pages = $next50 / 10 +1; $add10pages = $next100 / 10 +1; $add100pages = $next1000 / 10 +1; $add1000pages = $next10000 / 10 +1; $add10000pages = $next100000 / 10 +1; $add100000pages = $next1000000 / 10 +1; $add1000000pages = $next10000000 / 10 +1; $add10000000pages = $next100000000 / 10 +1; //get the page, if none set defaults to page 1 $nav_get = mysql_real_escape_string($_GET['page']); if (empty($_GET['page'])) { $nav_get = 1; } //the navigation url gets the actual address bar url, then hacks off the get page number value, the navigation itself then replaces the value $navigation_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; if (!empty($_SERVER["QUERY_STRING"])){ $navigation_url .= "?".$_SERVER['QUERY_STRING']; } if ($url == "./" OR $url == "./index.php"){ //you can change these to your needs $navigation_url = "$navigation_url?&page=1"; } $navigation_url1 = "$navigation_url"; $navigation_url = trim($navigation_url1,$nav_get); //This is where the mysql select would go using the values of LIMIT $startrow,$posts_per_page at end of select statement //lets just echo these to see what is changing echo "From mysql startrow $startrow and a max $posts_per_page posts per page<br />"; //total count would be the total items from the same mysql query but not using any limits $total_count = 345781;//lets just pick some wild number so we can use this with no queries $total_posts = $total_count; //using total posts, convert to pages using the last total_count number $lastposts = $total_posts - $posts_per_page; $nextposts = $total_posts +1; $total_posts_pages = $total_posts / $posts_per_page; list($int,$dec)=explode('.', $total_posts_pages); $int_pages = $int +1; $secondfromlast = $int_pages - 1; $thirdfromlast = $secondfromlast - 1; $fourthfromlast = $thirdfromlast - 1; $fifthfromlast = $fourthfromlast - 1; $page_numbers = $startrow / $posts_per_page; $total_pages = $total_posts / $posts_per_page; $page_number = $startrow / $posts_per_page + 1; if (!$_GET['page']) { $_GET['page'] = 1; } if ($page_number >= $int_pages+1) { $_GET['page'] = $int_pages; echo "<h2>That page number exceeded the max pages this result</h2><br />"; } if ($_GET['page'] <= 0) { $_GET['page'] = 1; } if ($page_number <= 0) { echo "<h2>That page number was lower than the pages this result</h2><br />"; } if ($total_posts == 0){ echo '<h2>No results found.</h2>'; } echo "Page $page_number of $int_pages - $total_posts Results<br />"; //the page navigation hyperlinks echo '[<a href="./index.php?page=1"><b> New Posts</b></a>]'; if ($prev >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1pages.'"><b><<- Previous.. </b></a>]'; } if ($next <= $nextposts){ echo '[<a href="'.$navigation_url.''.$add1pages.'"><b> ..Next ->></b></a>]'; } ?> <br /> <?php if ($int_pages >= 1){ echo '[<a href="'.$navigation_url.'1"> <b> First </b></a>]'; } else { echo "No Resultss Found For That Search, Please Try A Different One."; } if ($int_pages >= 2){ echo '[<a href="'.$navigation_url.'2"> <b> 2 </b></a>]'; } if ($int_pages >= 3){ echo '[<a href="'.$navigation_url.'3"> <b> 3 </b></a>]'; } if ($int_pages >= 4){ echo '[<a href="'.$navigation_url.'4"> <b> 4 </b></a>]'; } if ($int_pages >= 5){ echo '[<a href="'.$navigation_url.'5"> <b> 5 </b></a>]'; } if ($prev >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1pages.'">-1</a>]'; } if ($prev20 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct2pages.'">-2</a>]'; } if ($prev30 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct3pages.'">-3</a>]'; } if ($prev40 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct4pages.'">-4</a>]'; } if ($prev50 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct5pages.'">-5</a>]'; } if ($prev100 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10pages.'">-10</a>]'; } if ($prev1000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct100pages.'">-100</a>]'; } if ($prev10000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1000pages.'">-1000</a>]'; } if ($prev100000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10000pages.'">-10000</a>]'; } if ($prev1000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct100000pages.'">-100000</a>]'; } if ($prev10000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct1000000pages.'">-100000</a>]'; } if ($prev100000000 >= 0){ echo '[<a href="'.$navigation_url.''.$deduct10000000pages.'">-1000000</a>]'; } echo '<div align="left">'; if ($next10000000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1000000pages.'">+1000000</a>]'; } if ($next1000000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add100000pages.'">+100000</a>]'; } if ($next100000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add10000pages.'">+10000</a>]'; } if ($next10000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1000pages.'">+1000</a>]'; } if ($next1000 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add100pages.'">+100</a>]'; } if ($next100 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add10pages.'">+10</a>]'; } if ($next50 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add5pages.'">+5</a>]'; } if ($next40 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add4pages.'">+4</a>]'; } if ($next30 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add3pages.'">+3</a>]'; } if ($next20 <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add2pages.'">+2</a>]'; } if ($next <= $lastposts){ echo '[<a href="'.$navigation_url.''.$add1pages.'">+1</a>]'; } if ($int_pages >= 5){ echo '[<a href="'.$navigation_url.''.$fifthfromlast.'"><b>Last5</b></a>]'; } if ($int_pages >= 4){ echo '[<a href="'.$navigation_url.''.$fourthfromlast.'"><b>Last4</b></a>]'; } if ($int_pages >= 3){ echo '[<a href="'.$navigation_url.''.$thirdfromlast.'"><b>Last3</b></a>]'; } if ($int_pages >= 2){ echo '[<a href="'.$navigation_url.''.$secondfromlast.'"><b>Last2</b></a>]'; } if ($int_pages >= $int_pages){ echo '[<a href="'.$navigation_url.''.$int_pages.'"><b>Last</b></a>]'; } echo ''; echo '<br />'; ?> <br /> <form name="input" action="<?php echo $navigation_url; ?>" method="get"> <?php if ($_GET['page'] == 0) { $_GET['page'] = 1; } ?> Page:<input onfocus="this.value=''" size="15" type="text" name="page" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="<?php echo $_GET['page']; ?>"/> <input type="submit" style="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #000000;" size="15" value="Get Page" /> </form>
  14. By different content I meant a different category or something, not just a different link. I assume you don't post that often. But anyway, post your code if need help. The way it's usually done is by changing the categoryid or whatever value for the select and making each a unique feed based on that. You can just make copies of your rss.php file and name them rss2.php, rss3.php and so on In your case just LIMIT the select results for each file. so at the end of the select statement would be LIMIT 0,20 LIMIT 20,20 LIMIT 40,20 LIMIT 60,20 LIMIT 80,20
  15. You can also do like this. $file_type = $_FILES['image']["type"]; if ($file_type != "image/jpg" || $file_type != "image/jpeg" || $file_type != "image/pjpg" || $file_type != "image/gif" || $file_type != "image/png" || $file_type != "image/bmp" || $file_type != "image/x-icon") { echo "$file_type not allowed "; exit(); }
  16. Shouldn't you use the || operator(OR) not the and if ($extension != "jpg" || $extension != "jpeg" || $extension != "png" || $extension != "gif") { also, where does $existingimage get it's value from?
  17. see if this helps order deny,allow deny from 10.212.4.0 - 10.212.4.255 allow from 10.212.4 deny from all actually you should put the address of exactly what want to allow for the 10.212.4
  18. But not in the while loop it's not, and that brings you the multiple results from mysql query.
  19. Whats the point in having the 5 pages? Just limit it to 20 results and one feed. Unless have different content for each feed, I really see no point in doing this at all.
  20. $display = "<a href=myphotos.php?pid=".$myrow['pid'].">".$myrow['name']."<br>"; You did not echo the result for display. echo $display;
  21. This would work better because can do returns for each line. <form enctype="multipart/form-data" action="" method="POST"> Upload: <input name="file" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <? $my_file = $_FILES["file"]["tmp_name"]; if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total lines: $total<br />"; foreach ($data as $line) { echo "$line<br />"; } } else { echo "No file to display"; } ?>
  22. Can't just do an include? <form enctype="multipart/form-data" action="" method="POST"> Upload: <input name="file" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <? $my_file = $_FILES["file"]["tmp_name"]; if (file_exists($my_file)) { include($my_file); } else { echo "No file to display"; } ?>
  23. Images: 108 (5236.8KB) Is still many people that do not have the latest greatest technology, are on lesser machines. To load that page for them may be not so pleasant. It reminds me of a blogspot page, all loaded up. If that site ever gets high traffic, you would then see how much bandwidth and resources it would use.
  24. I feel each section should be it's own page and not all loading the main page.
×
×
  • 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.