New Hampshire Underground

Please login or register.

Login with username, password and session length
Advanced search  

News:

Please log in on the special "login" page, not on any of these normal pages. Thank you, The Procrastinating Management

"Let them march all they want, as long as they pay their taxes."  --Alexander Haig

Pages: 1 2 3 [4]   Go Down

Author Topic: PLN site getting done  (Read 9381 times)

aries

  • Enemy of the State
  • ******
  • Karma: 141
  • Posts: 2915
Re: PLN site getting done
« Reply #45 on: February 15, 2007, 01:14 AM NHFT »

That's scary.

:p I've got an estimate of 2 hours to go before I figure out how to generate a list of pages.

edit:
OH MY GOD I DID IT
I AM SO HAPPPY.
Pagination has been my enemy ever since I first wrote my tagboard script. I couldn't figure it out. I know most of you guys don't speak PHP but I'm so ecstatic about this I have to share:

I set up the option to view a certian page like this:


//count the number of lines in the database
$count1count(file($entryfile));
if(isset(
$_GET['show'])) {
$show $_GET['show'];
$showst1 $show-$showposts;
$Array array_splice(file($entryfile), $show5);$Array array_reverse($Array); }


Then I had it generate a list of links based on that, at the bottom of the finally generated page:


for ($x=0$x<$count1$x+=$showposts) {
echo 
"<a href=\"".$_SERVER[&#39;PHP_SELF&#39;]."?show=$x\">page $x</a>"; }


That was it. It was so simple. It hit me and I just went like "wait, would that work?" ... and it did... and my heart skipped a beat. Told you guys I love simple solutions.

That's it for tonight. Too much adrenaline for 2 in the morning. I need to take a step back tomrorow. I may actually develop this into a larger-scale, more polished and functional project, and release it.
« Last Edit: February 15, 2007, 01:48 AM NHFT by aries »
Logged

error

  • Guest
Re: PLN site getting done
« Reply #46 on: February 15, 2007, 02:57 AM NHFT »

It works, but it's got potential security problems. Untrusted input and all that.
Logged

aries

  • Enemy of the State
  • ******
  • Karma: 141
  • Posts: 2915
Re: PLN site getting done
« Reply #47 on: February 15, 2007, 03:14 AM NHFT »

It works, but it's got potential security problems. Untrusted input and all that.

I edited out the unimportant bit - if(!is_numeric($show)) { echo "show must be an integer."; }

Other than that I don't see where you could see any security problems with that.
Logged

error

  • Guest
Re: PLN site getting done
« Reply #48 on: February 15, 2007, 03:17 AM NHFT »

It works, but it's got potential security problems. Untrusted input and all that.

I edited out the unimportant bit - if(!is_numeric($show)) { echo "show must be an integer."; }

Other than that I don't see where you could see any security problems with that.

That was the important bit.
Logged

aries

  • Enemy of the State
  • ******
  • Karma: 141
  • Posts: 2915
Re: PLN site getting done
« Reply #49 on: February 15, 2007, 03:29 AM NHFT »

That was the important bit.

:P well for the sake of demonstrating how it works, I left it out because it's nonessential.
Logged

error

  • Guest
Re: PLN site getting done
« Reply #50 on: February 15, 2007, 11:38 AM NHFT »

That was the important bit.

:P well for the sake of demonstrating how it works, I left it out because it's nonessential.

I'm sure everyone else on this board could have done without the colorful -- but completely incomprehensible -- demonstration. ;D
Logged
Pages: 1 2 3 [4]   Go Up