PHP people... Quick question on why this no longer works...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • V_RocKs
    Damn Right I Kiss Ass!
    • Nov 2003
    • 32451

    #1

    PHP people... Quick question on why this no longer works...

    This code used to work... Then my host upgraded my PHP and now it lo longer works... Pooh pooh!

    Code:
    if ($cmd == 'go' && ($url && $title && $blogs && $types))

    The variables $url, $title, $blogs and $types all are arrays.

    Again, this used to work yesterday.... Now it doesn't.

    PHP was 5.2.5 and is now 5.2.9.
  • HorseShit
    Too lazy to set a custom title
    • Dec 2004
    • 17513

    #2
    how is your blog network doing?

    Comment

    • Deej
      I make pixels work
      • Jun 2005
      • 24386

      #3
      After their upgrade, did they get apache up and running properly?

      A simple upgrade 'shouldnt' effect an already working script

      Deej's Designs n' What Not
      Hit me up for Design, CSS & Photo Retouching


      Icq#30096880

      Comment

      • V_RocKs
        Damn Right I Kiss Ass!
        • Nov 2003
        • 32451

        #4
        After upgrade everything else worked... except for this particular script. For some reason it doesn't return TRUE anymore. I believe it has something to do with the variables being arrays...

        Blog network is going good.

        Comment

        • Babaganoosh
          ♥♥♥ Likes Hugs ♥♥♥
          • Nov 2001
          • 15841

          #5
          Did they enable safe mode when they upgraded?
          I like pie.

          Comment

          • woj
            <&(©¿©)&>
            • Jul 2002
            • 47880

            #6
            they probably disabled register_globals
            Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
            Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
            Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

            Comment

            • V_RocKs
              Damn Right I Kiss Ass!
              • Nov 2003
              • 32451

              #7
              Ah... was a globals problem.

              Comment

              • gornyhuy
                Chafed.
                • May 2002
                • 18041

                #8
                In case anyone is keyword searching, there actually is a backward-INcompatible change from PHP4.X to php5.X involving arrays.

                In php5 If you don't explicitly declare a variable as an array and then later you try to use certain array functions on it (slice, splice, etc), it will not work.

                I learned this the hard way when I upgraded a dedicated box with a bunch of legacy php code on it.

                icq:159548293

                Comment

                • V_RocKs
                  Damn Right I Kiss Ass!
                  • Nov 2003
                  • 32451

                  #9
                  Originally posted by gornyhuy
                  In case anyone is keyword searching, there actually is a backward-INcompatible change from PHP4.X to php5.X involving arrays.

                  In php5 If you don't explicitly declare a variable as an array and then later you try to use certain array functions on it (slice, splice, etc), it will not work.

                  I learned this the hard way when I upgraded a dedicated box with a bunch of legacy php code on it.
                  Thanks for the heads up!

                  Comment

                  • Tempest
                    Too lazy to set a custom title
                    • May 2004
                    • 10217

                    #10
                    Originally posted by V_RocKs
                    This code used to work... Then my host upgraded my PHP and now it lo longer works... Pooh pooh!

                    Code:
                    if ($cmd == 'go' && ($url && $title && $blogs && $types))

                    The variables $url, $title, $blogs and $types all are arrays.

                    Again, this used to work yesterday.... Now it doesn't.

                    PHP was 5.2.5 and is now 5.2.9.
                    You should also write the code cleaner by using things like isset($url) instead of the way you're doing it.. Doing it the way you're doing it is going to be throwing a lot of errors you just don't see (unless you set the error reporting higher) but that could very well be being logged to the server error log. I learned that the hard way when I had a log filling up my disk space on a small virtual acount.

                    By the way.. If you ever want to source out your programming, I'd be interested in doing some of your stuff..

                    Comment

                    • 2012
                      So Fucking What
                      • Jul 2006
                      • 17189

                      #11
                      coding the phps

                      ($url && $title && $blogs && $types)

                      that must be returning true

                      why not maybe change to

                      if($cmd == 'go' ){
                      if($url==true && $title==true && $blogs==true && $types==true){}
                      }
                      ?
                      Last edited by 2012; 03-23-2009, 05:26 PM. Reason: i no know
                      best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                      Comment

                      • calmlikeabomb
                        Confirmed User
                        • May 2004
                        • 1323

                        #12
                        This thread makes my balls hurts.

                        If they are arrays you should first check to make sure that's indeed what they are.

                        http://php.net/is_array

                        Also, try using a switch instead of a null else or long ass if-elseif-else chain.

                        http://php.net/switch

                        I'm happy the code you posted here fails
                        subarus.

                        Comment

                        • 2012
                          So Fucking What
                          • Jul 2006
                          • 17189

                          #13
                          echo 'help me' . '<BR>' ;
                          echo 'help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' ;
                          best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                          Comment

                          • 2012
                            So Fucking What
                            • Jul 2006
                            • 17189

                            #14
                            Originally posted by calmlikeabomb

                            I'm happy the code you posted here fails
                            how nice of you
                            best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                            Comment

                            • Tempest
                              Too lazy to set a custom title
                              • May 2004
                              • 10217

                              #15
                              Originally posted by calmlikeabomb
                              This thread makes my balls hurts.

                              If they are arrays you should first check to make sure that's indeed what they are.

                              http://php.net/is_array

                              Also, try using a switch instead of a null else or long ass if-elseif-else chain.

                              http://php.net/switch

                              I'm happy the code you posted here fails
                              switch is for pussies... you're not a real programmer unless your code is unreadable.

                              Comment

                              • 2012
                                So Fucking What
                                • Jul 2006
                                • 17189

                                #16
                                Originally posted by Tempest
                                switch is for pussies... you're not a real programmer unless your code is unreadable.
                                no shit homie, don't you know they just re-instated the "goto" statement. Get with the times loser Your point in mute
                                best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                Comment

                                • Killswitch - BANNED FOR LIFE

                                  #17
                                  if ($_GET['cmd'] == 'go' && (($_GET['url'] && $_GET['title']) && ($_GET['blogs'] && $_GET['types'])))

                                  Win.

                                  Comment

                                  • calmlikeabomb
                                    Confirmed User
                                    • May 2004
                                    • 1323

                                    #18
                                    ^ That's a fail, because it'd require the array to be passed via the url.

                                    Unless you're assigning an array to $_GET, which in case would also be a fail.

                                    Plus you're still not checking to see if the variables are arrays. Wouldn't you want to do that before any processing occurs?
                                    Last edited by calmlikeabomb; 03-23-2009, 06:02 PM.
                                    subarus.

                                    Comment

                                    • calmlikeabomb
                                      Confirmed User
                                      • May 2004
                                      • 1323

                                      #19
                                      I want to know what url, title, blogs, and types variable are part of so i can see the big picture. Wtf, does your script do.
                                      subarus.

                                      Comment

                                      • 2012
                                        So Fucking What
                                        • Jul 2006
                                        • 17189

                                        #20
                                        Originally posted by Killswitch
                                        if ($_GET['cmd'] == 'go' && (($_GET['url'] && $_GET['title']) && ($_GET['blogs'] && $_GET['types'])))

                                        Win.
                                        Originally posted by calmlikeabomb
                                        ^ That's a fail, because it'd require the array to be passed via the url.

                                        Unless you're assigning an array to $_GET, which in case would also be a fail.

                                        Plus you're still not checking to see if the variables are arrays. Wouldn't you want to do that before any processing occurs?
                                        Originally posted by calmlikeabomb
                                        I want to know what url, title, blogs, and types variable are part of so i can see the big picture. Wtf, does your script do.
                                        http://www.gofuckyourself.com/showpo...00&postcount=9
                                        best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

                                        Comment

                                        • Tempest
                                          Too lazy to set a custom title
                                          • May 2004
                                          • 10217

                                          #21
                                          Originally posted by fartfly
                                          no shit homie, don't you know they just re-instated the "goto" statement. Get with the times loser Your point in mute
                                          When I heard that I was exstatic... almost ended up with a cum stain...

                                          Comment

                                          • Voodoo
                                            ♥ ♦ ♣ ♠
                                            • Sep 2002
                                            • 10600

                                            #22
                                            This works. I'm not sure if it's proper for what you're doing or not, but maybe it helps.
                                            Code:
                                            $cmd=$_GET['cmd'];
                                            $url=$_GET['url'];
                                            $title=$_GET['title'];
                                            $blogs=$_GET['blogs'];
                                            $types=$_GET['types'];
                                            $check=is_string($url)&&($title)&&($blogs)&&($types);
                                            
                                            if(($cmd=='go')&&($check != FALSE)){
                                            	echo "YAY!";
                                            }else{
                                            	echo "BOOO!";
                                            }

                                            "I'm selflessly supporting the common good, but only coincidentally looking out for No.1."

                                            Comment

                                            • Why
                                              MFBA
                                              • Mar 2003
                                              • 7230

                                              #23
                                              VooDoo, wtf you been up to lately man? good to see your still kickin.

                                              Comment

                                              • NaughtyRob
                                                Two fresh affiliate progs
                                                • Nov 2004
                                                • 29602

                                                #24
                                                Fucking geeks....



                                                J/K I wish I knew php

                                                Last edited by NaughtyRob; 03-23-2009, 07:51 PM.
                                                [email protected]
                                                Skype: 17026955414
                                                Vacares Web Hosting - Protect Your Ass with Included Daily Backups

                                                Comment

                                                • uno
                                                  RIP Dodger. BEST.CAT.EVER
                                                  • Dec 2002
                                                  • 18450

                                                  #25
                                                  Originally posted by fartfly
                                                  no shit homie, don't you know they just re-instated the "goto" statement. Get with the times loser Your point in mute
                                                  I'm on a grammar kick. Moot, not mute.
                                                  -uno
                                                  icq: 111-914
                                                  CrazyBabe.com - porn art
                                                  MojoHost - For all your hosting needs, present and future. Tell them I sent ya!

                                                  Comment

                                                  Working...