Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 9th, 2004, 10:09 AM
Vasilis6669 Vasilis6669 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Vasilis6669 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
BUG found on FAQ create dynamic drop down menu

Hi
I found this bug when running the download example for creating the multiple dynamic drop down menus.
It was found that the program was running when i had the register_globals =on. I have tried on another machine with register_globalls = off and it was not working as it should.
Is it possible to give a suggestion how to convert the program without having register_globals =on?
thanks

Reply With Quote
  #2  
Old September 9th, 2004, 11:35 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: BUG found on FAQ create dynamic drop down menu

link, code?

Reply With Quote
  #3  
Old September 9th, 2004, 11:39 AM
Vasilis6669 Vasilis6669 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Vasilis6669 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: BUG found on FAQ create dynamic drop down menu

here is the link
http://www.ashleyit.com/rs/jsrs/select/php/select.php

you can download the code from there

this is the forum link
http://codewalkers.com/faq/10/33.html

Reply With Quote
  #4  
Old September 9th, 2004, 11:49 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: BUG found on FAQ create dynamic drop down menu

i checked out that code, and it looks like it was written so that it would work with register_globals off. What doesnt work about it since you made the switch?

Reply With Quote
  #5  
Old September 9th, 2004, 11:56 AM
Vasilis6669 Vasilis6669 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Vasilis6669 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: BUG found on FAQ create dynamic drop down menu

well, on the jsrsServer.php in function
function jsrsDispatch($validFuncs )
{
it tries to build the functions to load the data from the database
$func = jsrsBuildFunc($validFuncs);
This is not executed and the
"function +builds +as+ empty +string" error message appears when i run the program.
I am using php v5.0.1

Reply With Quote
  #6  
Old September 9th, 2004, 12:16 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: BUG found on FAQ create dynamic drop down menu

I think i see where the problem is. jsrsDispatch() calls jsrsBuildFunc(), which needs a global value $F. If $F is not present, it will return an empty string. I dont see it defined anywhere. Anyone else familiar with this and knows where $F comes from?
php Code:
Original - php Code
  1.  
  2. function jsrsDispatch($validFuncs ){
  3.   $func = jsrsBuildFunc($validFuncs);
  4.  
  5.   if ($func != ""){
  6.     $retval = "";
  7.    
  8.     eval("$retval =  " . $func . ";");
  9.    
  10.     if (strlen($retval)>0){
  11.       jsrsReturn($retval."");
  12.     } else {
  13.       jsrsReturn("");
  14.     }
  15.   } else {
  16.     jsrsReturnError("function builds as empty string");
  17.   }
  18. }
  19.  
  20. function jsrsBuildFunc($validFuncs) {
  21.  global $F;
  22.  
  23.  $func = "";
  24.  
  25.  if ($F != "") {
  26.   $func = $F;
  27.  
  28.      
  29.   // make sure it's in the dispatch list
  30.   if (strpos(strtoupper($validFuncs),strtoupper($func))  ===false)
  31.      jsrsReturnError($func . " is not a valid function" );
  32.    
  33.    $func .= "(";
  34.    $i = 0;
  35.    
  36.    //--- To optimize ! ---
  37.    eval("global $P$i;");
  38.    $Ptmp = "P". $i;
  39.      
  40.    while ($$Ptmp!="") {
  41.     $parm = $$Ptmp;
  42.     $parm = substr($parm,1,strlen($parm)-2);
  43.     $func .= """ . $parm . "",";
  44.     $i++;
  45.     eval("global $P$i;");
  46.     $Ptmp = "P". $i;
  47.    }
  48.    
  49.    if (substr($func,strlen($func)-1,1)==",") 
  50.     $func = substr($func,0,strlen($func)-1);
  51.  
  52.     $func .= ")";
  53.   }
  54.  
  55.  return $func;
  56. }

Reply With Quote
  #7  
Old September 9th, 2004, 12:40 PM
Vasilis6669 Vasilis6669 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Vasilis6669 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: BUG found on FAQ create dynamic drop down menu

I understand what you are trying to say. Can I have some more help?
<script language = javascript>
function contextPOST( rsPage, func, parms ){

var d = new Date();
var unique = d.getTime() + '' + Math.floor(1000 * Math.random());
var doc = (jsrsBrowser == "IE" ) ? this.container.document : this.container.contentDocument;
doc.open();
doc.write('<html><body>');
doc.write('<form name="jsrsForm" method="post" target="" ');
doc.write(' action="' + rsPage + '?U=' + unique + '">');
doc.write('<input type="hidden" name="C" value="' + this.id + '">');

// func and parms are optional
if (func != null){
doc.write('<input type="hidden" name="F" value="' + func + '">');

if (parms != null){
if (typeof(parms) == "string"){
// single parameter
doc.write( '<input type="hidden" name="P0" '
+ 'value="[' + jsrsEscapeQQ(parms) + ']">');
} else {
// assume parms is array of strings
for( var i=0; i < parms.length; i++ ){
doc.write( '<input type="hidden" name="P' + i + '" '
+ 'value="[' + jsrsEscapeQQ(parms[i]) + ']">');
}
} // parm type
} // parms
} // func

doc.write('</form></body></html>');
doc.close();
doc.forms['jsrsForm'].submit();
}
</script>
This is jsrsClient.js function contextPOST and has a hidden type F name.

Reply With Quote
  #8  
Old September 9th, 2004, 04:40 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: BUG found on FAQ create dynamic drop down menu

k
easy.

Go into that function for jsrsBuildFunc()

and change:

global $F;

to

global $_POST['F'];

you may just be able to get away with $_POST['F'] (as a matter of fact, im pretty sure you can because its in a super global array.) Give it a shot.

Reply With Quote
  #9  
Old September 13th, 2004, 06:43 AM
Vasilis6669 Vasilis6669 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 Vasilis6669 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: BUG found on FAQ create dynamic drop down menu

ok what you have told me i have changed it and work fine but there is another problem i cannot figure it out.
This is the function
php Code:
Original - php Code
  1.  
  2. function jsrsBuildFunc($validFuncs) {
  3.  global $F;
  4.  $F= $_POST['F'];
  5.  $func = "";
  6.  
  7.  if ($F != "")
  8.  {
  9.       $func = $F;
  10.         //echo("<script language=javascript>alert('xxx $func');<script>");
  11.       // make sure it's in the dispatch list
  12.       if (strpos(strtoupper($validFuncs),strtoupper($func))  ===false)
  13.          jsrsReturnError($func . " is not a valid function" );
  14.       
  15.        $func .= "(";
  16.        $i = 0;
  17.        
  18.        //--- To optimize ! ---
  19.        eval("global $P$i;");
  20.        $P = $_POST['P'.$i];
  21.         echo("<script language=javascript>alert('P is $P$i');</script>");
  22.        $Ptmp = "P". $i;
  23.        $Ptmp = $_POST['P'. $i];
  24.         //$Ptmp = $_POST['PO'];
  25.       
  26.        echo("<script language=javascript>alert('Ptmp is $Ptmp and pptmp is $$Ptmp');</script>");
  27.       
  28.        while ($$Ptmp!="")
  29.        {
  30.          echo("<script language=javascript>alert('Hello ');</script>");
  31.         $parm = $$Ptmp;
  32.         $parm = substr($parm,2,strlen($parm)-2);
  33.         $func .= """ . $parm . "",";
  34.        
  35.         $i++;
  36.         eval("global $P$i;");
  37.         $Ptmp = "P". $i;
  38.        
  39.       }
  40.    
  41.    if (substr($func,strlen($func)-1,1)==",") 
  42.    
  43.     $func = substr($func,0,strlen($func)-1);
  44.    
  45.     $func .= ")";
  46.      echo("<script language=javascript>alert('function $func P is $P');</script>");
  47.   }
  48. //echo("<script language=javascript>alert('xxx $func');<script>");
  49.  return $func;
  50. }


So $F = $_POST['F'] works fine, the first option list loads perfect, on the second time it reads the first option parameter but it does not pass it into the method. The problem that i have found was that the $$Ptmp has a value and does not enter the while loop. Any help please?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > BUG of FAQ Dynamic drop down


<
Thread Tools  Search this Thread