php question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfy
    Confirmed User
    • Dec 2003
    • 3574

    #1

    php question

    I am using this code to display a page included in another:

    Code:
    <?php include('<?echo "$id";?>'); ?>
    So I link this way:

    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";?>
    
    or
    
    <a href="http://www.mysite.com/<?echo "$id-1";?>
  • psili
    Confirmed User
    • Apr 2003
    • 5526

    #2
    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
    Your post count means nothing.

    Comment

    • papill0n
      Unregistered Abuser
      • Oct 2007
      • 15547

      #3
      Originally posted by psili
      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
      haha dont be so hard on yourself dude - that code should work perfectly

      Comment

      • 2012
        So Fucking What
        • Jul 2006
        • 17189

        #4
        if(isset($_GET['id']))
        {
        $id = $_GET['id'];;
        }

        echo myshit $id
        best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

        Comment

        • papill0n
          Unregistered Abuser
          • Oct 2007
          • 15547

          #5
          this was posted on another board

          Code:
          <?php
          if ( !eregi('http', $_GET['id']) && is_numeric($_GET['id']) && file_exists($_GET['id'].'.html') )
          {
              include( $_GET['id'].'.html';
              $next_page_id = $_GET['id'] + 1;
              $prev_page_id = $_GET['id'] - 1;
          }
          else 
          {
              echo "error";
          }
          ?>

          Comment

          • psili
            Confirmed User
            • Apr 2003
            • 5526

            #6
            Originally posted by fartfly
            if(isset($_GET['id']))
            {
            $id = $_GET['id'];;
            }

            echo myshit $id
            Fuck that shit, motherfucker...

            echo "myshit ".(isset($_GET["id"]) ? $_GET["id"] : " is exit only");

            sorry... i'll take my meds now and go to sleep.
            Your post count means nothing.

            Comment

            • 2012
              So Fucking What
              • Jul 2006
              • 17189

              #7
              Originally posted by psili
              Fuck that shit, motherfucker...

              echo "myshit ".(isset($_GET["id"]) ? $_GET["id"] : " is exit only");

              sorry... i'll take my meds now and go to sleep.


              its pretty basic sweety
              best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

              Comment

              • psili
                Confirmed User
                • Apr 2003
                • 5526

                #8
                Originally posted by fartfly


                its pretty basic sweety
                I was born with flippers for hands and I still haven't mastered dolphin ninja code yet.
                Gimme time.
                Just a few more *fwap fwap fwap*s.
                Your post count means nothing.

                Comment

                • 2012
                  So Fucking What
                  • Jul 2006
                  • 17189

                  #9
                  Originally posted by psili
                  I was born with flippers for hands and I still haven't mastered dolphin ninja code yet.
                  Gimme time.
                  Just a few more *fwap fwap fwap*s.
                  best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                  Comment

                  • 2012
                    So Fucking What
                    • Jul 2006
                    • 17189

                    #10
                    php is hell
                    best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                    Comment

                    • psili
                      Confirmed User
                      • Apr 2003
                      • 5526

                      #11
                      Originally posted by fartfly
                      php is hell
                      Sorry Wolfy, to go all personal on your thread....

                      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?
                      Your post count means nothing.

                      Comment

                      • xroach
                        Confirmed User
                        • Feb 2002
                        • 963

                        #12
                        [QUOTE=Wolfy;13283820]I am using this code to display a page included in another:

                        Code:
                        <?php include('<?echo "$id";?>'); ?>
                        should be

                        Code:
                        <?php include("$id"); ?>




                        Code:
                        <a href="http://www.mysite.com/<?echo "$id+1";?>
                        
                        or
                        
                        <a href="http://www.mysite.com/<?echo "$id-1";?>
                        Code:
                        <a href="http://www.mysite.com/<?echo $id-1;?>" />

                        Comment

                        • 2012
                          So Fucking What
                          • Jul 2006
                          • 17189

                          #13
                          Originally posted by psili
                          Sorry Wolfy, to go all personal on your thread....

                          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?
                          im smart like the professor on Gilligan's island ... it must be my name

                          PHP is HELL !
                          HELL !
                          Last edited by 2012; 10-24-2007, 09:18 PM.
                          best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                          Comment

                          • 2012
                            So Fucking What
                            • Jul 2006
                            • 17189

                            #14
                            you think php is more efficient then ruby... okee dokkeeeee
                            Last edited by 2012; 10-24-2007, 09:22 PM.
                            best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                            Comment

                            • 2012
                              So Fucking What
                              • Jul 2006
                              • 17189

                              #15
                              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.
                              best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                              Comment

                              • GrouchyAdmin
                                Now choke yourself!
                                • Apr 2006
                                • 12085

                                #16
                                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.

                                Comment

                                • GrouchyAdmin
                                  Now choke yourself!
                                  • Apr 2006
                                  • 12085

                                  #17
                                  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.

                                  Comment

                                  • psili
                                    Confirmed User
                                    • Apr 2003
                                    • 5526

                                    #18
                                    Originally posted by fartfly
                                    you think php is more efficient then ruby... okee dokkeeeee
                                    I'm not a computer science person and I don't develop compiled code as an occupation, so when you get down to whatever's interpreting the script, I can't tell you if PHP or RoR is faster. That, and I like to write endless "while" statements for fun. But...

                                    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.
                                    Your post count means nothing.

                                    Comment

                                    • psili
                                      Confirmed User
                                      • Apr 2003
                                      • 5526

                                      #19
                                      Originally posted by fartfly
                                      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.
                                      BTW, your nick reminded me of this bash.org quote:

                                      <kerushixx> dude, i just saw a moth fart!
                                      <tulam> 0_o
                                      <tulam> how do you know it farted?
                                      <kerushixx> it flew in a straight line
                                      anyway...
                                      Your post count means nothing.

                                      Comment

                                      • 2012
                                        So Fucking What
                                        • Jul 2006
                                        • 17189

                                        #20
                                        They're fucking with me subliminally

                                        Originally posted by psili
                                        I'm not a computer science person and I don't develop compiled code as an occupation, so when you get down to whatever's interpreting the script, I can't tell you if PHP or RoR is faster. That, and I like to write endless "while" statements for fun. But...

                                        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.
                                        flipper is always writing shit in any language. Your right, if you are going to develop something do it in php so you can sell it. That shit gets old after awhile though ... you're always supporting bullshit
                                        best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                        Comment

                                        • 2012
                                          So Fucking What
                                          • Jul 2006
                                          • 17189

                                          #21
                                          Originally posted by psili
                                          BTW, your nick reminded me of this bash.org quote:



                                          anyway...
                                          moths fart. good for you. help find its way outside
                                          best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                          Comment

                                          • 2012
                                            So Fucking What
                                            • Jul 2006
                                            • 17189

                                            #22
                                            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 ...
                                            Last edited by 2012; 10-24-2007, 10:25 PM. Reason: were no man has gone before
                                            best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                            Comment

                                            • Chariott
                                              Confirmed User
                                              • Nov 2006
                                              • 361

                                              #23
                                              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.

                                              UUGallery v3.37 builder plugin for Wordpress!
                                              Now it builds FLV VIDEO Galleries! It grabs galleries from FHG's, generates thumbnails, resizes originals,
                                              arranges within your template and posts a gallery within 1 click!
                                              Start making money right now!
                                              ICQ# 475-719-552, Email+MSN: msnaddress[-~at~-]uusoftware.com

                                              Comment

                                              • psili
                                                Confirmed User
                                                • Apr 2003
                                                • 5526

                                                #24
                                                Originally posted by fartfly
                                                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 this post was directed my way, I had no intention of offense.
                                                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.
                                                Your post count means nothing.

                                                Comment

                                                • GreyWolf
                                                  So Fucking Banned
                                                  • Jun 2007
                                                  • 2036

                                                  #25
                                                  Originally posted by RageCash-Ben
                                                  this was posted on another board

                                                  Code:
                                                  <?php
                                                  if ( !eregi('http', $_GET['id']) && is_numeric($_GET['id']) && file_exists($_GET['id'].'.html') )
                                                  {
                                                      include( $_GET['id'].'.html';
                                                      $next_page_id = $_GET['id'] + 1;
                                                      $prev_page_id = $_GET['id'] - 1;
                                                  }
                                                  else 
                                                  {
                                                      echo "error";
                                                  }
                                                  ?>

                                                  This looks kinda nice Ben - covers a few contingencies

                                                  Comment

                                                  • 2012
                                                    So Fucking What
                                                    • Jul 2006
                                                    • 17189

                                                    #26
                                                    Originally posted by psili
                                                    If this post was directed my way, I had no intention of offense.
                                                    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.
                                                    no way
                                                    best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                                    Comment

                                                    • divine116
                                                      Confirmed User
                                                      • May 2007
                                                      • 1152

                                                      #27
                                                      thanks for the info!
                                                      Sexy Woman Upskirt Voyeur Web Developing Affordable SEO Services

                                                      Comment

                                                      • quantum-x
                                                        Confirmed User
                                                        • Feb 2002
                                                        • 6863

                                                        #28
                                                        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.
                                                        PrettyInCash.com - BoozedGFs.com - TeenGFs.com - JizzGFs.com- MilfUploads.com -

                                                        Comment

                                                        Working...