X
xeelee

  • Aug 29, 2006
  • Joined Jan 23, 2003
  • thanks for all the replies guys..

    currently using str_replace to replace all the " " with "+".. so far it works..but still think its not the right way to solve this..

    ee.. nope not using urlencode() on the string..will try that..

    as the string is an encrypted string using M_CRYPT .. so it is a random string with all kinds of funny characters..eg.."+","/"..

    any idea if its some option of php or the apache server that is stripping out the "+" from the url ?

    • Hi guys

      my web host just did some kind of upgrade..

      now when i Get a variable the "+" plus sign is automatically strip out..

      page1


      http://www.domain.com/page2.php?q=xxxx+yyyy

      when i pass the variable to page 2:

      page2


      echo $_GET['q'];

      when i echo q..
      it would display xxxx yyyyy

      without the "+" plus sign..

      by right when i echo q it should display "xxxx+yyyy"

      any idea how to prevent it from stripping out the plus sign ?

      as i am passing an encrypted string from one page to another page..
      by stripping out the "+" sign.. the encoded string is corrupted and i can't decrypt it anymore..

      TIA xeelee 🙂

      • funny thing is... when i tried uploading the file up to the server using filezilla ftp.. it aways go through quite fast...

        Zend was working fine...then one day it decided to stop working...crimson have some problems saving file...sometimes saving a blank file up...overwriting the original file...a definite no...no...Dreamweaver also have that problem...the last time i used it..

        • hi guys..

          been searching for the elusive php editor with a decent enough built-in FTP client...

          as i can't live with not having ctrl-s and have the file saved directly onto the server...

          tried Zend...crimson...pspad...
          but all seems to take forever to load the file from ftp...and save to ftp...

          anyone can recommend a php editor with a robust ftp client?

          Tia xeelee

          • not sure if this is what u looking for...
            below is a script to grab the title of a webpage

            
            $url = "http://www.yahoo.com";
            $pt = parsetitle($url);
            echo "Title: " . $pt;
            
            function parsetitle($url) {
            	$file = @fopen($url, 'r');
            
            if($file) {
            	while (!feof($file)){
            	   $line = @fgets($file, 1024);
            	   # you can effectively get any value from a webpage if you know
            	   # the pattern surrounding the value u want
            	   if (eregi('<title>(.*)</title>', $line, $out)) {
            		 $content = $out[1];
            		 break;
            	   }
            	 }
            	//empty($content) ? print '' : print $content; 
            	return rawurldecode($content);
            
            	@fclose($file);
            } else {
            	return "Cannot find what u looking for sorry";
            }
            }
            
            

            xeelee

            • Thanks for the reply
              majik-sheff 🙂

              page_A.html

              1. Check to see if a session exists for the request.
              2. If it does, stop processing
              3. If it doesn't, create it and then do your processing.

              let's say if i do the above for page_A.html...
              it would prevent all but the first iframe from loading...

              but if you reload page_A.html...the session will still exist right?... so no iframe will be shown at all on the reload...

              any suggestions guys ?

              thanks alot!

              • Hi 🙂

                I have a code for users to copy and paste into their site. that creates an iframe within their site.

                sample code:

                <iframe src="http://www.domain.net/show.php?user=siteroute&aw=125&ah=125" width=125 height=125 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling="no"></iframe>
                

                The tricky thing is...if they paste the above code 2 times...2 iframe will appear in their page.

                How do you allow only one iframe to display...and the other duplicates iframe to display blank or not appear at all?

                can't seem to figure how to do it...need some experts to advice...
                thanks!
                xeelee🙂

                • Thanks LordShryku 🙂

                  think will be using your code from now on...

                  • 
                    $qid = db_query("
                           SELECT
                                   aid
                           FROM clog
                           WHERE (ip ='$ip')
                    ");
                    
                    $i=1;
                    while ($row = mysql_fetch_row($qid)) {
                           $p[$i] = $row[0];
                           $i++;
                    }
                    
                    print_r($p);
                    
                    

                    Is there any better way to store a set of sql results into a php array?

                    xeelee😃

                    • Thanks sidney!

                      it works like a charm!🙂

                      • When using this encryption function i get the error:

                        Notice: Use of undefined constant blowfish - assumed 'blowfish' in /home/w3stuff/public_html/lib/stdlib.php on line 216

                        anyone know how to solve this?

                        
                        function encrypt($input,$key){
                        /* Encrypt - note $key must be supplied */
                        
                          $iv = mcrypt_create_iv (mcrypt_get_iv_size (blowfish, MCRYPT_MODE_ECB), MCRYPT_RAND);
                          $encrypted = mcrypt_encrypt (blowfish, $key, $input, MCRYPT_MODE_ECB, $iv);
                          $encrypted = base64_encode($encrypted);
                          return $encrypted;
                        } 
                        
                        
                        function decrypt($input,$key){
                        /* decrypt - $key must be same when encrypting to decrypt */
                        
                          $decrypted = base64_decode($input);
                          $iv = mcrypt_create_iv (mcrypt_get_iv_size (blowfish, MCRYPT_MODE_ECB), MCRYPT_RAND);
                          $decrypted = mcrypt_decrypt (blowfish, $key, $decrypted, MCRYPT_MODE_ECB, $iv);
                          return $decrypted;
                        }
                        

                        xeelee thanks

                        • hello...

                          Can zend studio synchronise localhost files with those on the server?

                          Think dreamweaver MX got this function...

                          Or is there any proggies that can do this?

                          thanks!

                          xeelee

                          • 
                            /* start up sessions  */
                            ini_set("session.name", "mycart");
                            session_start();
                            
                            

                            i know there's some reason...but....

                            why do you want to set the session.name?

                            isn't it easier to leave session name set to default?

                            xeelee ;p

                            • wow...thanks ahundiak!

                              never crossed my mind...

                              think its a good practice to use huh 😃

                              • <?php

                                / define a generic object /
                                class boop {};

                                //create new object from class boop
                                $obj = new boop;

                                $obj->dbhost = "localhost";

                                / connect to the database /
                                db_connect($obj->dbhost);

                                ?>

                                why would any one create an empty class like this?
                                actually this a short example from a more complex site...

                                i can;t figure out wats the purpose of an empty class boop...

                                any idea wats the advantage of doing this?

                                • <?php
                                  if (!isset($SERVER['PHP_AUTH_USER'])) {
                                  header('WWW-Authenticate: Basic realm="My Realm"');
                                  header('HTTP/1.0 401 Unauthorized');
                                  echo 'Text to send if user hits Cancel button';
                                  exit;
                                  } else {
                                  echo "<p>Hello {$
                                  SERVER['PHP_AUTH_USER']}.</p>";
                                  echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
                                  }
                                  ?>

                                  help! can't seem to capture the Password and userid...
                                  whats wrong??

                                  • dunno why but it only work for me without the 'userid' ??

                                    link001.php

                                    <a Href="link002.php?userid=ABC">ABC</a></br> 
                                    <a Href="link002.php?userid=EFG">EFG</a>
                                    

                                    link002.php

                                    <? echo $_GET[userid]; ?>
                                    
                                    • thanks guys! for those that reply 🙂

                                      finally got it to work after some adjustments

                                      page 001.php

                                      <A href="page003.php?imageid=001">click for image 1</a><br>
                                      <A href="page003.php?imageid=002">click for image 2</a><br>
                                      <A href="page003.php">click for image 3</a>
                                      

                                      page003.php

                                      <?php
                                        $image = $_GET[imageid];
                                      
                                      // test to see if image id is pass
                                      if (isset($image)) {
                                          echo "<IMG SRC= \"./$image.jpg\">";
                                        }
                                      else  {
                                          echo "no image specified.";
                                        }
                                      
                                      ?>
                                      

                                      this forum's great!

                                      • scoppc!!!
                                        thanks!!!

                                        I had the same @%##@% sympton too...
                                        after reading ur posts...problem solved!!

                                        thanks again😃

                                        • i am testing on Apache on Windows...does apache has any setting to prevent write to file??

                                          <?php
                                          
                                          $filename = 'file.txt';
                                          $fp = fopen($filename, "a");
                                          $text = "can write???";
                                          $write = fputs($fp, $text);
                                          fclose($fp);
                                          
                                          ?>
                                          

                                          but i run another write script ...its able to write to the file...its when i add in the form
                                          ...it will just stare blankly at me ..AAARGGhh :p