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:
  #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 8 m 12 sec
Reputation Power: 5
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 8 m 12 sec
Reputation Power: 5
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 8 m 12 sec
Reputation Power: 5
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 8 m 12 sec
Reputation Power: 5
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 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek