wierd variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    wierd variables

    ok, i'm trying to install a script i coded on hostgator... Script works great on other hosts, but for some reason on hostgator i find its not reading any $_GET's, so i'm like wtf, n then just by chance, i try $_REQUEST n it works, so I quickly run mreplace on script replacing all $_GET for $_REQUEST and upload script again...

    It works perfectly mn I'm like yay!!! then turn my head back to screen only to see its not reading $_REQUEST now... so i check $_GET n it's reading, i'm thinking wtf as i mreplace script to revert to original $_GET, n upload... halfway through uploading it switches back n starts only reading variables via $_REQUEST again...

    To cut a long boring repetetive story short, I been at this for hours back n forth ftp n re ftp, n chatting to online support, etc but they can't find problem in logs nor do they seem to understand what $_GET is, lol... So I decided to to try asking here, n the reason I posted in coding is cause I'm currently trying to figure out how to code a switch that will check n swap $_GET n $_REQUEST so the site works for longer than 30 seconds... But everything I try has failed... So far I'm back to:

    if (isset($_REQUEST['action']))
    {
    $action = $_REQUEST['action'];
    }
    else
    {
    $action = $_GET['action'];
    }

    but even this just throws blanks... WTF is going on?
    C3 Themes: http://c3themes.wen.ru/index.html
    Find Files: http://mystarter.tk/?goto=X-search

    #2

    Comment


      #3
      similar, but my problem is the server keeps swapping and one moment $_GET returns something, next moment $_REQUEST, almost as if when i change script between them it triggers the server to disable the one i change code to...

      First time I put a script on hostgator, i think they ared crap... Script runs fine on every other server i used... Just hostgator got something funky going on... Cause it shouldn't be needing to be modified every 30 seconds if that makes sense...
      C3 Themes: http://c3themes.wen.ru/index.html
      Find Files: http://mystarter.tk/?goto=X-search

      Comment


        #4
        try putting this at top of script to see if it solves the GET problem:
        PHP Code:
        if(isset($_GET)){foreach($_GET as $key=>$value){$_GET[$key]=mysql_escape_string($value);}} 
        if it does you have same problem as me

        Comment


          #5
          nope, server doesn't read $_GET still, and if i change script to $_REQUEST then that stops working, and it starts reading the $_GET. wierd...
          C3 Themes: http://c3themes.wen.ru/index.html
          Find Files: http://mystarter.tk/?goto=X-search

          Comment


            #6
            what if you upload 2 pages at same time:
            index_request.php
            index_get.php ?
            probably a stupid suggestion ^

            try
            PHP Code:
             print_r($_GET); 
            Last edited by something else; 02.04.12, 19:00.

            Comment


              #7
              Hi bro, long time no see.

              But why you canceling REQUEST? Its GET and POST (in that order). So or do like this:

              PHP Code:
              $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''
              Or:

              PHP Code:
              if (isset($_POST['action']))
               {
               
              $action $_POST['action'];
               }
               else
               {
               
              $action $_GET['action'];
               } 
              In fact, this last one to be precise:

              PHP Code:
              if (isset($_POST['action'])) 
               { 
               
              $action $_POST['action']; 
               } 
               else 
               { 
              if (isset(
              $_GET['action'])) 
              {
               
              $action $_GET['action']; 
              } else {
               
              $action '';
              }
               } 
              This is why is ternary really good. ;)

              PHP Code:
              $action = isset($_GET['action']) ? $_GET['action'
              : (isset(
              $_POST['action']) ? $_POST['action'] : ''); 
              This is like $_REQUEST['action'], more or less.
              Last edited by arnage; 02.04.12, 20:16.
              <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

              Comment


                #8
                Just out of interest what script editor are you using?

                Comment


                  #9
                  Me? Just Notepad++ in Total Commander.

                  When i mentioning ternary, it relay can be interesting.
                  Here was some grabber script, i can't remember in what topic but it name was xxx2. This is how i retrieved title for pages.

                  PHP Code:
                  $title = empty($_GET['dir']) ? (empty($_GET['file'])
                   
                      ? 
                  'Home' : (empty($_GET['name'])
                   
                      ? 
                  '' : (mb_strlen(base64_decode($_GET['name']), 'UTF-8') > 15
                   
                      
                  htmlentities(capsfirst(str_replace('_'' 'mb_substr(base64_decode($_GET['name']), 015'UTF-8').'...')), ENT_QUOTES'UTF-8')
                   
                      : 
                  htmlentities(capsfirst(str_replace('_'' 'base64_decode($_GET['name']))), ENT_QUOTES'UTF-8'))))
                   
                      : 
                  htmlentities(capsfirst(str_replace(array('tags/''/'), ''$_GET['dir'])), ENT_QUOTES'UTF-8'); 
                  Last edited by arnage; 02.04.12, 20:31.
                  <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                  Comment


                    #10
                    Originally posted by arnage View Post
                    Me? Just Notepad++ in Total Commander.
                    na was at pmbguy .... i normally use notepad++
                    but just realized i used dreamweaver for editing script that i have got problems with....
                    so i was thinking maybe a problem with "$" symbol and dreamweaver .....
                    (dreamweaver caused me a problem with a symbol before a few years ago but i cant remember what it was)

                    eg typing $_GET once works fine when you type it in manually
                    but using replace all could be changing the character encoding on the "$" symbol therefor making the $_GET invalid

                    ^ this is a guess and not a fact

                    Comment


                      #11
                      Ooops.

                      Well Notepad knows to change encoding also where are no utf8, so i set it to UTF8 without BOM and write comment on top of pages:
                      PHP Code:
                      <?php
                      /* šđžćč */
                      // ...
                      <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                      Comment


                        #12
                        Ok, i'm using a PHP editor, n the code in srcipt is fine, if you look at YFCASA thats working fine, if it picks up if $_GET['action']=="mobile" n runs... it's gotr browser detect to divert between mobile n PC, now on hostgator $_GET['action'] returns blank, but $_REQUEST['action'] returns mobile or main or pc etc... if I change script using mreplace (this app works too, used it millions of times, in fact pretty much everything i put on coding-talk most likely been mreplaced a few times in coding), anyhow if I change my $_GET's to $_REQUESTS, then suddenly $_GET starts giving variables, n $_REQUEST stops returning variables... Like I did this back n forth all day yesterday for hours, n its like the serve keeps disabling whichever one i put in the code, thats the only way i can explain this... The script works 100% just not reading action= or loguser= or logpass or sid or anything, therefore the script returns else action or says invalid username, etc...
                        C3 Themes: http://c3themes.wen.ru/index.html
                        Find Files: http://mystarter.tk/?goto=X-search

                        Comment


                          #13
                          But there is no point switching between $_REQUEST and $_GET, $_GET is in $_REQUEST, thats the problem.
                          PHP: $_REQUEST - Manual
                          <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

                          Comment


                            #14
                            Originally posted by pmbguy View Post
                            Ok, i'm using a PHP editor, n the code in srcipt is fine, if you look at YFCASA thats working fine, if it picks up if $_GET['action']=="mobile" n runs... it's gotr browser detect to divert between mobile n PC, now on hostgator $_GET['action'] returns blank, but $_REQUEST['action'] returns mobile or main or pc etc... if I change script using mreplace (this app works too, used it millions of times, in fact pretty much everything i put on coding-talk most likely been mreplaced a few times in coding), anyhow if I change my $_GET's to $_REQUESTS, then suddenly $_GET starts giving variables, n $_REQUEST stops returning variables... Like I did this back n forth all day yesterday for hours, n its like the serve keeps disabling whichever one i put in the code, thats the only way i can explain this... The script works 100% just not reading action= or loguser= or logpass or sid or anything, therefore the script returns else action or says invalid username, etc...
                            Try this..... if it works then its your php editor ..... if not then get your money back from hostgator
                            Attached Files

                            Comment

                            Working...
                            X