![]() |
php question
I am using this code to display a page included in another:
Code:
<?php include('<?echo "$id";?>'); ?> www.mysite.com/?id=1 How do I make links on the page to advance 1 or decrease 1? Code:
<a href="http://www.mysite.com/<?echo "$id+1";?> |
I'm dumb. But I like to post sometimes. That, and I'm unsure what you're trying to include. However,
<a href="http://www.mysite.com/<?PHP ($_GET["id"] + 1) ?>"> might work (other than bad quote escaping I might have). Also, are you using some URL rewriting or are your files really named www.mysite.com/1 , www.mysite.com/2 , www.mysite.com/[x] ? blah blah blah... here's a bump since I'm dumb :) |
Quote:
|
if(isset($_GET['id']))
{ $id = $_GET['id'];; } echo myshit $id |
this was posted on another board
Code:
<?php |
Quote:
echo "myshit ".(isset($_GET["id"]) ? $_GET["id"] : " is exit only"); sorry... i'll take my meds now and go to sleep. :( |
Quote:
its pretty basic sweety |
Quote:
Gimme time. Just a few more *fwap fwap fwap*s. |
Quote:
|
php is hell
|
Quote:
But in reply to "php is hell"..... I was a "liberal arts" major, so my take on web development is based on my "flipper" post, so the following will probably offend the CS degree'ers: 1. After HTML, javascript and that client-side shit, the next thing I started to learn was PHP. 2. Then I took up some java. Wrote a couple of stand-alone apps, played with spring and struts frameworks and hated the xml configurations and getters and setters and all the wiring in, even if the IDE helped hook that up. 3. Tried ruby on rails for a bit. Gheyest fucking moniker ever, "Ruby on Rails". What dickhead made that up? Probably the same assholes who monikered "Gusty Gibbon" . Yet, as ghey as saying "yea, I did this in 'ruby on rails', it was a great framework for prototyping web projects. Then, one day, I read a post on GFY about coding by banging franks'n'beans on the keyboard. The poster never monikered that process, but I've perfected it. So, long story short of no one asking for a story is.... what the fuck was I posting about? |
[QUOTE=Wolfy;13283820]I am using this code to display a page included in another:
Code:
<?php include('<?echo "$id";?>'); ?> Code:
<?php include("$id"); ?> Code:
<a href="http://www.mysite.com/<?echo "$id+1";?> Code:
<a href="http://www.mysite.com/<?echo $id-1;?>" /> |
Quote:
PHP is HELL ! HELL ! |
you think php is more efficient then ruby... okee dokkeeeee
|
i like smarty. I just think just straight hard coding shit is always a waste in most situations. anything that can save you time is god.
|
Out of all of them, Ben's is the safest, because he forces the .html extension, tests for a numeric, and greps out full URLs..however he loses points for not checking for directory trans.
See me after class, all of you. |
Part two: It's better to use fpassthru/file_get_contents/etc to include if you don't actually need it to be parsed by PHP.
|
Quote:
Between PHP and Ruby all I've read and have tried : 1. LAMP + some framework "[smarty / symphony / blah blah blah] 2. Linux, mysql, apache + mod_proxy, mongrel + RoR. If I could focus on 1 or 2, I'd go number 2 as it's a pretty savage framework (i've bailed on java for some reason... don't know why thought). Lately, even for PHP projects my stupid table names and schematas are created around the RoR naming conventions. Unfortunately, if I went with RoR sometimes, finding reasonably priced help might be an issue along with scalability issues if there are any (yea, in either case, throw a couple of more servers and mongrel processes in the mix) but... from what I've found in my latest client it's more of a support issue than anything else. Everyone knows PHP. Not everyone knows Ruby. And then you have "flipper" boy writing funky shit... so if "flipper" boy is writing funky shit, it might as well be in a script that's more well-known than another. or some crap like that. |
Quote:
Quote:
|
They're fucking with me subliminally
Quote:
|
Quote:
|
i used to give a shit until I realized something.
Im makeing someone else $$$ fuck that do whatcha like :) I guess you still are as an affiliate but ... |
If register globals turned on, you shouldn't write this:
<?php include('<?echo "$id";?>'); ?> as it has a vulnerability flaw. Just set ?id=/etc/passwd or ?id=/etc/shadow and will get any file you want which is stored at the server. |
Quote:
And if anything I posted was taken as such, my apologies; nothing I posted in this thread was meant as "bad". Other threads toward other poster might be a different story. |
Quote:
This looks kinda nice Ben - covers a few contingencies :thumbsup |
Quote:
|
thanks for the info!
|
not sure if I should be surprised or not surprised, but the better way to do this is probably with .htaccess and ReWrites.
that way, you just rewrite site.com/X [where X is a digit] to sitefiles/pages/x.html or whatever you want. No PHP, no exploits, and no overhead. |
All times are GMT -7. The time now is 08:07 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc