Jump to content

Greywacke

Members
  • Posts

    510
  • Joined

  • Last visited

Posts posted by Greywacke

  1. Hi, I am having a very hard time debugging & running the following query from a cell on php or pma.

    $sql = "UPDATE crypto SET crypto_openssl_recommendation = 1 WHERE (\"%ECB%\" OR \"%RC2%\" OR \"%RC4%\" OR \"%DES%\" OR \"%3DES%\" OR \"%MD5%\") LIKE UPPER(crypto_descr);";

    The table is meant to keep track of OpenSSL encryption methods, and their availability and recommendation over CryptoJS wether used in Javascript, or JScript. This query is meant to update the recommendation, but the quality of my MySQL querying has wilted a bit in the past four years.

  2. Hi, the error log says that the executing document has an unexpected quotation mark in line 32, however - the lines following the http 500 error from the php error_log - come from  crypto_methods.php and are printed below...  (all sensitive information has been replaced with *****)

    [05-Feb-2019 19:20:58 UTC] PHP Parse error:  syntax error, unexpected '"' in /home/*****/public_html/crypto_methods.php on line 32
    31. foreach ($ciphers as $key => $value) {
    32.     $sql = "INSERT INTO crypto (crypto_no, crypto_descr) VALUES (" . $key . ", /"" . $value . "/");";
    33.     $result = $conn->query($sql);
    34. }
  3. Ah yeah, *facepalms* lol

    Still though, 

    [31-Jan-2019 13:40:55 UTC] PHP Fatal error:  Call to a member function format() on boolean in /home/dwtnfwfv/public_html/default.php on lince 91

    Which has to do with the following portion of code, the winning answer at expertsexchange:

                    $monthNum  = $row["month"];
                    $dateObj   = DateTime::createFromFormat('!m', $monthNum);
                    $monthName = $dateObj->format('F'); // eg. January - December
                    print "Month:  " . $monthName . "<br />\r\n";
  4. Ah yeah, *facepalms* lol

    Still though, 

    [31-Jan-2019 13:40:55 UTC] PHP Fatal error:  Call to a member function format() on boolean in /home/dwtnfwfv/public_html/default.php on line 91

    Which has to do with the following portion of code, the winning answer at expertsexchange:

    placeholder

  5. Hi again, moved the topic to a new one because it no longer uses PCRE.  I have the physical problem of having lost my dev pc and 24" screens, now having to make do with android on a 3.5" touchscreen.

    So the issue i have encountered is again a likeness of this time a bit more physically - "not being able to see the forest for the trees", as my viewing area has been greatly diminished.  The code is below, with the php error_log thereafter.

     <?php
    $t = intval($_GET["t"]);
    switch ($t) {
    	case 1:
    	 	header('Content-Type: Text/XML');
    	 	break;
    	case 2:
    	 	header('Content-Type: Text/JavaScript');
    	 	break;
    	case else:
    	 	header('Content-Type: Text/HTML5');
    ?><!DOCTYPE html>
    <html lang="en-za">
    <head>
    <meta charset="UTF-8">
    <title>*** Test Page</title>
    </head>
    
    <body>
    <p><a href="http://***.com/default.php?t=0&u=Sof00207&f=c&r=45">*** Test Page</a></p><br />
    <p>
    <pre><?
    /* Initiate Variables for URL:
    http://***.com/default.php?t=0&u=Sof00207&f=c&r=45
    1. Key Field:  C
    2. Key Row:  45 
    3. Account Number:  Sof00207
    4. Month:  G
    5. Number Of Licenses:  5
    6. Active:  Y/N:  J
    7. Licences Used:  3
    8. Year:  J
    9. Module 1:  A
    10. Module 2:  1
    11. Module 3:  B
    12. Module 4:  0
    */
    
    $f = strtoupper($_GET["f"]);
    $r = intval($_GET["r"]);
    
    $f = dirname(__FILE__) . "/RegUploads/" . $_GET["u"] . "#" . $f .  $r . ".xml";
    print $f . "\r\n\r\n";
    if (file_exists($f)) {
    	 $ret = file_get_contents($f);
    	 print htmlentities($ret);
    }
    
    $servername = "localhost";
    $username = "***";
    $password = "***";
    $dbname = "***";
    
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    // echo "Connected successfully";
    
    $q = intval($_GET["q"]);
    switch ($q) {
    	case 0:	// Return Encryption Key by Field A/B/C/D & Row ID
    	 	// Define SQL String
    	 	$sql = "SELECT * FROM `Sleutels` WHERE `ID` = " . $r . ";";
    	 	$result = $conn->query($sql);
    	 	if ($result->num_rows > 0) {
    			print "\"" . $sql . "\"<br />\r\n";
    			// output data of each row
    			while($row = $result->fetch_assoc()) {
    				print "Key:  " . htmlencode($row[$f]). "<br />\r\n";
    			};
    		} else {
    		 	print "\"" . $sql . "\"<br />\r\n";
    			print "0 results<br />\r\n";
    		};
    	 	break;
        case 1:
            echo "q equals 1";
            break;
        case 2:
            echo "q equals 2";
            break;
    };
    ?></pre>
    </p>
    </body>
    
    </html><?
    };
    $conn->close();
    ?>

    [30-Jan-2019 19:42:33 UTC] PHP Parse error:  syntax error, unexpected 'else' (T_ELSE) in /home/dwtnfwfv/public_html/default.php on line 11

  6. ok i tried testing the regex on https://www.regextester.com/ and they say:

    ERROR:  Invalid target or quantifier.

    over the red and bold portion of the regex string in line 19 of the code(how the heck do i fix it??? that portion is intended to select the number after the preceding 0's.

    $p = '^([A-D]|[a-d]|[1-4])0*({1,100})\#([^\#*])\#([^\@])\@([.*])$';
  7. ok i have now attempted to do this by urlencoding that whole string and making it http://verifyreg.com/default.php?q=e0078%23Sof00207%23G5J3!J%40A1B0

    still however, i am getting the seemingly irrational HTTP 500 error... -_-

    i have even tried with or without the urldecode() function around the $_GET["q"] but to now avail... -_-

    anybody - who can see this forest for the trees, please help!!!

    <?php
    
    /* Initiate Variables for URL:
    http://verifyreg.com/default.php?q=e0078%23Sof00207%23G5J3!J%40A1B0
    1. Key Field:  E
    2. Key Row:  78
    3. Account Number:  Sof00207
    4. Month:  G
    5. Number Of Licenses:  5
    6. Active:  Y/N:  J
    7. Licences Used:  3
    8. Year:  J
    9. Module 1:  A
    10.Module 2:  1
    11.Module 3:  B
    12.Module 4:  0 */
    
    var $ret, $p, $q, $m;
    $p = '^([A-D]|[a-d]|[1-4])0*({1,100})\#([^\#*])\#([^\@])\@([.*])$';
    $q = $_GET["q"];
    $m = new Array();
    var_dump($p."\rn");
    var_dump($q."\rn");
    var_dump($m."\rn");
    
    /*
    $ret = preg_match($p,$q,$m);
    var_dump($m."\rn");
    var_dump($ret."\rn");
    
    $k = new Array(2);
    $k[0] = $m[0][0];
    if (is_numeric($k[0])) {
        $k[0] = ($k[0]<1)?1:($k[0]>4)?4:4;
        switch ($k[0]) {
            case 1:  // Convert to A
                $k[0] = "A";
                break;
            case 2:  // Convert to B
                $k[0] = "B";
                break;
            case 3:  // Convert to C
                $k[0] = "C";
                break;
            case 4:  // Convert to D
                $k[0] = "D";
                break;
            case else:
                $k[0] = ucase($k[0]);
        }
    }
    $k[1] = $m[0][1];
    	$servername = "localhost";
    $username = "dwtnfwfv";
    $password = "ECp2yc20p7";
    $dbname = "dwtnfwfv_SoftoitRegs";
    	// Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    	// Check connection
    if ($conn->connect_error) {
        die("<!-- Connection failed: ".$conn->connect_error." -->");
    }
    echo "<!-- Connected successfully -->";
    	// Define SQL String
    $sql = "SELECT `".$k[0]."` FROM `Sleutels` WHERE `ID` = `".$k[1]."`;";
    $result = $conn->query($sql);
    	switch ($m) {
        case 0:    // Return Key by $k <Field A-D & Row ID
            if ($result->num_rows > 0) {
                // output data of each row
                while($row = $result->fetch_assoc()) {
                    echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
                }
            } else {
                echo "0 results";
            }
            break;
        case 1:
            echo "i equals 1";
            break;
        case 2:
            echo "i equals 2";
            break;
    }
    If ($m == `0`) Then
        Response.MimeType = `Text/HTML5`;
    Else If (Request.QueryString(`m`) == `1`) Then
        Response.MimeType = `WebGL/SVG`);
    Else If (Request.QueryString(`m`) == `2`) Then
        Response.MimeType = `Text/JavaScript`);
    End If
    $conn->close();
    */
    ?>
  8. Have decided to go with preg_match instead of preg_match_all but i still get the same HTTP 500 error... what's up with that???

    The top pcre code has changed as follows:

    <?php
    	/* Initiate Variables
    1. Key Field
    2. Key Row
    */
    	$p = '/(A-Da-d1-4)0*(1-100)\#(^\#)\#(^\@)\@(*)/';
    $q = $_SERVER["QUERY_STRING"];
    $m = new Array();
    $ret = preg_match($p,$q,$m);
    if ($ret !== false && $ret > 0) {
        print_r($m.$ret);
    	}
    	...

    Will test and see if escaping them helps.

  9. Thanks justsomeguy; will take that under advisory...

    (please note however, that the key I mention has nothing to do with a traditional key/value pair but is rather a reference as to where the chosen encryption key is located in the database.)

    However i still receive the HTTP 500 error - any idea why? Here's the code:

    	<?php
    	/* Initiate Variables
    1. Key Field
    2. Key Row
    */
    	$p = "|(A-Da-d1-4)0*(1-100)#(^#)#(^@)@(*)|U";
    $q = $_SERVER["QUERY_STRING"];
    $m = new Array();
    $ret = preg_match_all($p,$q,$m);
    if ($ret !== false && $ret > 0) {
        print_r($m.$ret);
    }
    	/*
    $k = new Array(2);
    $k[0] = $m[0][0];
    if (is_numeric($k[0])) {
    $k[0] = ($k[0]<1)?1:($k[0]>4)?4:4;
    switch ($k[0]) {
    case 1:  // Convert to A
    $k[0] = "A";
    break;
    case 2:  // Convert to B
    $k[0] = "B";
    break;
    case 3:  // Convert to C
    $k[0] = "C";
    break;
    case 4:  // Convert to D
    $k[0] = "D";
    break;
    case else:
    $k[0] = ucase($k[0]);
    }
    }
    $k[1] = $m[0][1];
    	$servername = "localhost";
    $username = "dwtnfwfv";
    $password = "ECp2yc20p7";
    $dbname = "dwtnfwfv_SoftoitRegs";
    	// Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    	// Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    // echo "Connected successfully";
    	// Define SQL String
    $sql = "SELECT `$k[0]` FROM `Sleutels` WHERE `ID` = `$k[1]`";
    $result = $conn->query($sql);
    	switch ($m) {
        case 0:    // Return Key by $k <Field A-D & Row ID
            if ($result->num_rows > 0) {
            // output data of each row
            while($row = $result->fetch_assoc()) {
            echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
            }
        } else {
            echo "0 results";
        }
            break;
        case 1:
            echo "i equals 1";
            break;
        case 2:
            echo "i equals 2";
            break;
    }
    	If ($m == `0`) Then
         Response.MimeType = `Text/HTML5`;
    Else If (Request.QueryString(`m`) == `1`) Then
         Response.MimeType = `WebGL/SVG`);
    Else If (Request.QueryString(`m`) == `2`) Then
         Response.MimeType = `Text/JavaScript`);
    End If
    	$conn->close();
    */
    ?>

    Will include .htaccess conntents too if that may bring some clarity?

    	
    RewriteEngine on
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php56” package as the default “PHP” programming language.
    <IfModule mime_module>
      AddType application/x-httpd-ea-php56 .php .php5 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
    
  10. hi all, long time no see... ;)

    i have a php document which needs to test the entire querystring such as follows:

    http://verifyreg.com/?c0078#Sof00207#G5J3!J@A1B0

    now to process this querystring without variables... i have the following code:

    // Initiate Variables
    1. Key Field
    2. Key Row
    $p = `|(A-Da-d1-4)0*(1-100)#(^#)#(^@)@(*)|U`;
    $q = $_GET;
    $m = new Array();
    $ret = preg_match_all($p,$q,$m);
    if ($ret !== false && $ret > 0) {
        print_r($m.$ret);
    }
    


    however the part after the first # will all be encoded eventually...

    the first part is to define the field to select the key from, the second part is the row, for the current session.  the key will be used on the serverside to encrypt the rest of the querystring after the first #.

  11. ok this issue is now solved thanks to Jubin Kurian, The Support Desk Manager at XYZScripts.com ;)

    if(!function_exists('php_post_form')){	function php_post_form() {		if (				!empty($_POST['post_title']) &&				!empty($_POST['post_content']) &&				!empty($_POST['post_category_name[]']) &&				!empty($_POST['submit'])			 ) {			echo '<pre>[article submission code]</pre>'."rn";		}		echo '<form action="" method="post">'."rn".			 '<div style="float:left; width:20%;">Post Title:  </div><div style="float:right; width:80%;"><input type="text" name="post_title" value="" style="width:100%;"/></div>'."rn".			 '<p style="clear:both;"></p>'."rn".			 '<div style="float:left; width:20%;">Post Content:  </div><div style="float:right; width:80%;"><textarea rows="20" cols="50" name="post_content" style="text-align: justify; width:100%;"></textarea></div>'."rn".			'<p style="clear:both;"></p>'."rn".			'<div style="float:left; width:20%;">Post Categories:  </div><div style="float:right; width:80%;">'."rn";		$args = array(		  'orderby' => 'name',		  'order' => 'ASC'		);		$categories = get_categories($args);		foreach($categories as $category) {			$term_id = $category->term_id;			$name = $category->name;			$count = $category->count;		echo '<label for="cat_<?=$term_id?>" style="overflow:visible;"><input type="checkbox" name="post_category_name[]" id="cat_'.$term_id.'" value="'.$term_id.'" '.		((strtolower($name)=='uncategorized')?' checked="checked"':'').		' />'.$name.' ('.$count.')</label><br/>';		}		echo '</div>'."rn".			 '<p style="clear:both;"></p>'."rn".			 '<div style="float:left; width:20%;">Submit:  </div><div style="float:right; width:80%;"><input type="submit" value="Submit Form" style="width: auto;" /></div>'."rn".			 '<p style="clear:both;> </p>'."rn".			 '</form>'."rn";	}}add_filter( 'php_post_form','',10,2); 

    i had to convert it all to a function and insert it in the plugin's xyz-functions,php file now working 100% thanks ;)

  12. hmmm - overflowing out of an 80% width div? i'll check out the chrome developers tools then...

    the inline style of the container div is:

    float:right; width:80%;

    yet the other form elements are 100% ok... so now I have set the style to be the same as on http://wp.geekout.co.za/submit-post/, where the label is not yet defined. as here it displays within the div it's supposed to.

    continuing to edit and make sure the css is the same as on this page.

     

    edit: ok done that - they are exactly the same yet it still happens... seems the issue is in the wordpress plugin - will break up the script as is done on wp.geekout.co.za/submit-post and see what happens...

     

    edit: am now using superglobals in the form of the following script which is run with the individual lines of php converted to XYZ-Scripting Insert PHP Code Snippets.

    [xyz-ips snippet="global-printr-debug-function"][insert data if posted]<form action="" method="post">    <div style="float:left; width:20%;">Post Title:  </div><div style="float:right; width:80%;"><input type="text" name="post_title" value="" style="width:100%;"/></div>    <p style="clear:both;"></p>    <div style="float:left; width:20%;">Post Content:  </div><div style="float:right; width:80%;"><textarea rows="20" cols="50" name="post_content" style="text-align: justify; width:100%;"></textarea></div>    <p style="clear:both;"></p>    <div style="float:left; width:20%;">Post Categories:  </div><div style="float:right; width:80%;">[xyz-ips snippet="global-set-args-parameter-and-call-getcategories"][xyz-ips snippet="global-foreach-category-open-loop-and-set-variables"]<label for="cat_[xyz-ips snippet="global-category-term-id"]" style="overflow:visible;"><input type="checkbox" name="post_category_name[]" id="cat_[xyz-ips snippet="global-category-term-id"]" value="[xyz-ips snippet="global-category-term-id"]" [xyz-ips snippet="global-is-checked"]>[xyz-ips snippet="global-category-name"] ([xyz-ips snippet="global-category-count"])</label>[xyz-ips snippet="global-foreach-category-close-loop"]</div>    <p style="clear:both;"></p>    <div style="float:left; width:20%;">Submit:  </div><div style="float:right; width:80%;"><input type="submit" value="Submit Form" style="width: auto;" /></div>    <p style="clear:both;> </p></form>

    which is tantamount to executing the following php page:

    <?php$GLOBALS['printr'] = function ($data, $exit = TRUE) {   if ($data) {    print '<pre>';    print_r($data);    print '</pre>';  }  if ($exit) {    exit;  }};?>[insert data if posted]<form action="" method="post">    <div style="float:left; width:20%;">Post Title:  </div><div style="float:right; width:80%;"><input type="text" name="post_title" value="" style="width:100%;"/></div>    <p style="clear:both;"></p>    <div style="float:left; width:20%;">Post Content:  </div><div style="float:right; width:80%;"><textarea rows="20" cols="50" name="post_content" style="text-align: justify; width:100%;"></textarea></div>    <p style="clear:both;"></p>    <div style="float:left; width:20%;">Post Categories:  </div><div style="float:right; width:80%;"><?php$GLOBALS['args'] = array(  'orderby' => 'name',  'order' => 'ASC'  );$GLOBALS['categories'] = get_categories($GLOBALS['args']);?><?phpforeach($GLOBALS['categories'] as $GLOBALS['category']) {    $GLOBALS['term_id'] = $GLOBALS['category']->term_id;    $GLOBALS['name'] = $GLOBALS['category']->name;    $GLOBALS['count'] = $GLOBALS['category']->count;?><label for="cat_<?phpecho $GLOBALS['term_id'];?>" style="overflow:visible;"><input type="checkbox" name="post_category_name[]" id="cat_<?phpecho $GLOBALS['term_id'];?>" value="<?phpecho $GLOBALS['term_id'];?>" <?phpecho $GLOBALS['name'];?> (<?phpecho $GLOBALS['count'];?>)</label><?php}?></div>    <p style="clear:both;"></p>    <div style="float:left; width:20%;">Submit:  </div><div style="float:right; width:80%;"><input type="submit" value="Submit Form" style="width: auto;" /></div>    <p style="clear:both;> </p></form> 

    i truly hope it works this time around, otherwise how the heck do i set public variables rather than superglobals, without using a class? 0o

     

    damnit - superglobals seem to be disabled within XYZ-Scripting's Insert PHP Code Snippets :@

  13. Hi there,

     

    I'm having some trouble developing a self-handling, public form for wordpress 4.0.1 in xhtml 1.0 - my issue (visually) is that the <label> tag and it's contents (a checkbox <input> tag), both dynamically written using XYZ-Scripts' Insert PHP Code Snippet plugin - keep popping out of the designated <div> tag when combining the scripts into one 0o...

    here is the portion of code written to the div to display category checkbox options:

    $printr = function ($data, $exit = TRUE) {   if ($data) {    print '<pre>';    print_r($data);    print '</pre>';  }  if ($exit) {    exit;  }};$args = array(  'orderby' => 'name',  'order' => 'ASC'  );$categories = get_categories($args);foreach($categories as $category) {     echo '<label for="cat_'.$category->term_id.'">'.	'<input type="checkbox" name="post_category_'.	'name[]" id="cat_'.	$category->term_id.'" value="'.	$category->term_id.'"'.	    (($category->name=='Uncategorized')?	    ' checked="checked"':	    '').	'>'.$category->name.    ' ('.$category->count.')'.    '</label><br/>	';}

    then this is called using shortcode, from the following page (which the results of can be seen at http://gp.geekout.co.za/submit-post/):

    <!--[insert data into database if posted]--><form action="" method="post">    <div style="float:left; overflow:visible;">Post Title:  </div><div style="float:right; width:80%;"><input type="text" name="post_title" value="" style="width:100%;"/></div>    <p><br style="clear:both;"/></p>    <div style="float:left; overflow:visible;">Post Content:  </div><div style="float:right; width:80%;"><textarea rows="20" cols="50" name="post_content" style="text-align: justify; width:100%;"></textarea></div>    <p><br style="clear:both;"/></p>    <div style="float:left; overflow:visible;">Post Categories:  </div><div style="float:right; width:80%;">[xyz-ips snippet="print-categories"]</div>    <p><br style="clear:both;"/></p>    <div style="float:left; overflow:visible;">Submit:  </div><div style="float:right;"><input type="submit" value="Submit Form" style="width: auto;" /></div>    <p><br style="clear:both;"/> </p></form>

    now I'm perplexed to find out what style is causing this issue!!!

     

    edit: it does not seem to be the style (CSS) at all - but rather a php priority issue regarding the script snippets being called and writing before the wordpress rendering takes place.

     

    also, a bit further dow, you will see that i have changed the way the scripts are used - thus causing the problem to be with sharing variables between snippets by making them superglobals.

     

    thanks in advance for the help - it will be sincerely appreciated! ;)

  14. ok success at last! :D

    i've managed to get the scvript working by modifying it as follows:

    // top level variablesvar service = -1;var ajaxloading = 0;var sid = 0;// javascript xml reading sectionvar services = xmldoc.getElementsByTagName("service");var arr10 = new Array();servicearr = new Array();for (var x = 0; x < services.length; x++) {	if (services[x].attributes.getNamedItem("sid") && services[x].attributes.getNamedItem("desc") && services[x].attributes.getNamedItem("selected") && indexOf.call(servicearr,services[x].attributes.getNamedItem("sid").nodeValue)==-1) {		var arr = new Array();		var aa = 0;		var arr1 = new Array();		arr[0] = services[x].attributes.getNamedItem("sid").nodeValue;		arr[1] = services[x].attributes.getNamedItem("desc").nodeValue;		arr[2] = services[x].attributes.getNamedItem("selected").nodeValue;		var i = 1;		for (var c = 0; c < services[x].childNodes.length; c++) {			if (services[x].childNodes[c].nodeName == "attribute" && services[x].childNodes[c].attributes.getNamedItem("id").nodeValue != undefined) {				var arr2 = new Array();				arr2[0] = services[x].childNodes[c].attributes.getNamedItem("id").nodeValue;				arr2[1] = services[x].childNodes[c].attributes.getNamedItem("desc").nodeValue;				arr2[2] = services[x].childNodes[c].attributes.getNamedItem("val").nodeValue;				arr2[3] = services[x].childNodes[c].attributes.getNamedItem("ord").nodeValue;				arr2[4] = (services[x].childNodes[c].attributes.getNamedItem("ptr").nodeValue!="")?services[x].childNodes[c].attributes.getNamedItem("ptr").nodeValue:"";				arr1[aa] = arr2.join(";;;");				aa++;			}		}		arr[3] = arr1.join(";.;");	// service attributes		//salert(arr);		if (arr.length) {			addrecord("menu_services", arr);			if (arr[2]!="") document.getElementById("menu_services").selectedIndex = service;			servicearr.push(arr[0]);			svc = true;		}	}}// populating functionfunction addrecord(id, arr) {	//salert(id);	//salert(arr);	var opt0 = document.createElement("option");	opt0.text = arr[1];								// value 1 text service name	opt0.value = arr[0] + "|;|" +					// value 0 service id				 arr[2] + "|;|" + 					// save selection flag ("selected" or "")				 arr[3];							// save the value 3 attribute keys/values/order array string	var sel = document.getElementById(id);			// get the select element	try {		sel.add(opt0, null); 						// standards compliant; doesn't work in IE	}	catch(ex) {		sel.add(opt0); 								// IE only	}	if (arr[2]!="") {		sid = parseInt(arr[0]);		service = sel.options.length - 1;	}}

    as can be seen, the function sets the service top level variable to the index to be marked as selected. once the dropdown is populated by the options in the xml reader, it sets the selectedIndex if the current options arr[2] value was noticed to != "" ;)

    thanks for the help in refining the script justsomeguy! :D

  15. the data does populate in the select box, for some reason it just does not want to set the selectedIndex or selected = true attribute of the options as i add them in the script...

    function addrecord(id, arr) {	//salert(id);	//salert(arr);	var opt0 = document.createElement("option");	opt0.text = arr[1];								// value 1 text service name	opt0.value = arr[0] + "|;|" +					// value 0 service id				 arr[2] + "|;|" + 					// save selection flag ("selected" or "")				 arr[3];							// save the value 3 attribute keys/values/order array string	if (arr[2]=="selected") opt0.selected = true;	var sel = document.getElementById(id);	try {		sel.add(opt0, null); 						// standards compliant; doesn't work in IE	}	catch(ex) {		sel.add(opt0); 								// IE only	}	//if (arr[2]=="selected") sel.selectedIndex = sel.options.length - 1;} 

    neither the option will get set to selected, nor setting the selected option by changing the selectedIndex property of the dropdown select works - i am at my wits ends right now...

    - Pierre "Greywacke" du Toit

  16. in an ongoing attempt to resolve this on my own while i await generous assistance from the other javascripting forum users - the ajax_attributes.js portions get updated continuously, the xml is perfect. selecting the xml and attributes is perfect. handling it in javascript is not... *facepalms*

    the script has sofar been updated as follows...

    // top level "global" variables set at top of scriptvar sid = 0;var servicearr = new Array();// plannned future top level variables for reading and storing the attribute "ancestrees"var pss = "0";var ddcnt = 0;var keys = new Array(new Array(),new Array()); // parse servicesvar services = xmldoc.getElementsByTagName("service");var arr10 = new Array();servicearr = new Array();for (var x = 0; x < services.length; x++) {	if (services[x].attributes.getNamedItem("sid") && services[x].attributes.getNamedItem("desc") && services[x].attributes.getNamedItem("selected") && indexOf.call(servicearr,services[x].attributes.getNamedItem("sid").nodeValue)==-1) {		var arr = new Array();		var aa = 0;		var arr1 = new Array();		arr[0] = services[x].attributes.getNamedItem("sid").nodeValue;		arr[1] = services[x].attributes.getNamedItem("desc").nodeValue;		arr[2] = services[x].attributes.getNamedItem("selected").nodeValue;		var i = 1;		for (var c = 0; c < services[x].childNodes.length; c++) {			if (services[x].childNodes[c].nodeName == "attribute" && services[x].childNodes[c].attributes.getNamedItem("id").nodeValue != undefined) {				var arr2 = new Array();							arr2[0] = services[x].childNodes[c].attributes.getNamedItem("id").nodeValue;				arr2[1] = services[x].childNodes[c].attributes.getNamedItem("desc").nodeValue;				arr2[2] = services[x].childNodes[c].attributes.getNamedItem("val").nodeValue;				arr2[3] = services[x].childNodes[c].attributes.getNamedItem("ord").nodeValue;				arr2[4] = (services[x].childNodes[c].attributes.getNamedItem("ptr").nodeValue!="")?services[x].childNodes[c].attributes.getNamedItem("ptr").nodeValue:"";				arr1[aa] = arr2.join(";;;");				aa++;			}		}		arr[3] = arr1.join(";.;");	// service attributes		//salert(arr);		if (arr.length) {			addrecord("menu_services", arr);			servicearr.push(arr[0]);			svc = true;		}	}} 

    as for the xml - it is still without errors, and is still generated as follows.

    <root><service sid="10" desc="Accounting Bookkeeping" selected="">...</service><service sid="1" desc="Bakkie Canopy" selected="selected">...</service><service sid="3" desc="Bakkie Canopy Accessories" selected=""></service><service sid="2" desc="Bakkie Linings & Rubberizing" selected=""></service><service sid="15" desc="Broadband Internet" selected="">...</service><service sid="5" desc="Business Phone Systems" selected="">...</service><service sid="9" desc="Company Registrations" selected="">...</service><service sid="11" desc="Conference Venues" selected="">...</service><service sid="8" desc="Debt Collection Agencies" selected="">...</service><service sid="17" desc="Office Coffee" selected="">...</service><service sid="7" desc="Office Colour Printers" selected="">...</service><service sid="12" desc="Office Furniture" selected="">...</service><service sid="13" desc="Office Movers" selected="">...</service><service sid="14" desc="Office Network Cabling" selected="">...</service><service sid="6" desc="Office Printers & Copiers" selected="">...</service><service sid="16" desc="Office Water" selected="">...</service><service sid="4" desc="Placeholder" selected=""></service><sql/></root>  

    obviously, this abbreviated excerpt comes from google chrome's view of the file, which has the following header info:

    <?xml version="1.0" encoding="utf-8"?> 

    if nobody wants to help then i guess it's also fine - i am getting there as fast as possible under the current circuimstances sleep.png

     

    can anyone see why the services dropdown, does not want to select the single service which has the selected="selected" attribute?

     

    sincerely - Pierre "Greywacke" du Toit.

  17. thanks dsoneuk! it helped alot! ;) i've got the total css now as follows (did not want to lose the colour styling):

    /* define height and width of scrollable area. Add 16px to width for scrollbar          *//* allow WinIE to scale 100% width of browser by not defining a width                   *//* WARNING: applying a background here may cause problems with scrolling in WinIE 5.x   */div.tableContainer {	clear: both;	border: 1px outset #808080;	height: 500px;	overflow: auto;	width: 97%;}html div.tableContainer/* */ {	padding: 0 16px 0 0;}html>body div.tableContainer {	width: 97%;	height: 467px;	padding: 0;}head:first-child+body div[class].tableContainer {	width: 97%;	height: 467px;	overflow: hidden;}div.tableContainer table {	float: left;	width: 100%}html div.tableContainer table/* */ {	margin: 0 -16px 0 0;	width: 100%;}html>body div.tableContainer table {	float: none;	margin: 0;	width: 100%;}head:first-child+body div[class].tableContainer table {	width: 100%;}thead.fixedHeader tr {	position: relative;	width: 100%;	top: expression(document.getElementById("tableContainer").scrollTop+"px");}                                              */head:first-child+body thead[class].fixedHeader tr {	display: block;	width: 100%;}thead.fixedHeader th {	background: #d8d8d8;	font-weight: normal;	padding: 4px 3px;	text-align: left;}head:first-child+body tbody[class].scrollContent {	display: block;	width: 100%;	width: expression((document.getElementById("fixedHeader").offsetWidth-16)+"px");	height: 400px;	overflow: auto;}tbody.scrollContent td, tbody.scrollContent tr.normalRow td {	background-color: #f8f8f8;	border-bottom: none;	border-left: none;	border-right: 1px solid #d8d8d8;	border-top: none;	padding: 2px 3px 2px 3px;	width: 16.666%;}tbody.scrollContent tr.normalRow td + td + td + td + td + td {	background-color: #f8f8f8;	border-bottom: none;	border-left: none;	border-right: none;	border-top: none;	padding: 2px 3px 2px 3px;	width: 16.667%;}tbody.scrollContent tr.alternateRow td {	background-color: #d8d8d8;	border-bottom: none;	border-left: none;	border-right: 1px solid #f8f8f8;	border-top: none;	padding: 2px 3px 2px 3px;	width: 16.666%;}tbody.scrollContent tr.alternateRow td + td + td + td + td + td {	background-color: #d8d8d8;	border-bottom: none;	border-left: none;	border-right: none;	border-top: none;	padding: 2px 3px 2px 3px;	width: 16.667%;}head:first-child+body thead[class].fixedHeader th {	border-right: none;	padding: 2px 4px 2px 4px;}head:first-child+body thead[class].fixedHeader th[title=EXECUTE], head:first-child+body thead[class].fixedHeader th[title=RESET] {	width: 50%;};head:first-child+body tbody[class].scrollContent td {	border-right: none;	padding: 2px 4px 2px 4px;	width: 100%;}#form_services thead.fixedHead {	margin-top: 2px;	margin-bottom: 2px;	width: 100%;	border-top: 1px solid #f8f8f8;	border-left: 1px solid #f8f8f8;	border-right: 1px solid #b8b8b8;	border-bottom: 1px solid #b8b8b8;}#form_services tbody.scrollContent {	height: 350px;	overflow-y: scroll;	background: #d8d8d8;	width: 100%;}#form_services tbody.scrollContent {    background: none repeat scroll 0 0 #D8D8D8;    height: 350px;    left: 0;    overflow-y: scroll;    position: absolute;    right: 0;    width: 100%;}head:first-child + body tbody.scrollContent[class] {    display: inline;}.normalRow, .alternateRow {	width: 100%;}tbody.scrollContent td#cntf, tbody.scrollContent tr.normalRow td#cntf {	width: 100% !important;	whitespace: nowrap !important;}tbody.scrollContent td, tbody.scrollContent tr.normalRow td {	width: 17.439% !important !important;	whitespace: nowrap !important;}tbody.scrollContent td td, tbody.scrollContent tr.normalRow td td {	width: 9.492% !important !important;	whitespace: nowrap !important;}tbody.scrollContent td td td, tbody.scrollContent tr.normalRow td td td {	width: 23.179% !important !important;	whitespace: nowrap !important;}tbody.scrollContent td td td td, tbody.scrollContent tr.normalRow td td td td {	width: 31.788% !important !important;	whitespace: nowrap !important;}tbody.scrollContent td td td td td, tbody.scrollContent tr.normalRow td td td td td {	width: 7.726% !important !important;	whitespace: nowrap !important;}tbody.scrollContent td td td td td td, tbody.scrollContent tr.normalRow td td td td td td {	width: 10.375% !important !important;	whitespace: nowrap !important;}head:first-child + body div.tableContainer[class] table {    width: 100%;}html > body div.tableContainer table {    float: none;    margin: 0;    position: relative;}

    but... the widths still do not align to the header's widths (which is needed to have the content not wrap over to the next line, similar width to the header dropdowns...) -_-

    you will notice attempts at giving a % width relative to the header's, but seems i might have to use a javascript with inline styles to update these td's upon population?

    the widths need to be relative % as follows on the table body columns:

    percentage: 17.439% 9.492% 23.179% 31.789% 7.726% 10.375%td width's: 237px   129px  315px   432px   105px  141pxtr width's: 1359px  1359px 1359px  1359px  1359px 1359px

    please let me know what you think...

  18.  

     

    You have two stray closing divs, and the only way i can get it to 100% is remove display; block; from in FF that is.

    if i do this, then it throws away the scrollbar.

    ii need it 100%-16px for the scrollbar to be visible...

    no - it is possible, was working when i started but a css element was modified that unfortunately messed up the displayWidth in getting the other styles sorted...

    that was for google chrome, firefox, internet explorer, opera and safari though...

  19. hi there, i have implemented a scrolling tbody for a css loaded dynamic table. the results i have saved - can be viewed at http://www.performatix.co/Customer%20Counts.htm, but what descriptors need to be added to the css to stretch the scrollable tbody as wide as the thead? (100%)

     

    the css used sofar is as follows:

    /* define height and width of scrollable area. Add 16px to width for scrollbar          *//* allow WinIE to scale 100% width of browser by not defining a width                   *//* WARNING: applying a background here may cause problems with scrolling in WinIE 5.x   */div.tableContainer {	clear: both;	border: 1px outset #808080;	height: 500px;	overflow: auto;	width: 100%;}html div.tableContainer/* */ {	padding: 0 16px 0 0;	width: 100%;}html>body div.tableContainer {	height: 467px;	padding: 0;}head:first-child+body div[class].tableContainer {	width: 97%;	height: 467px;	overflow: hidden;}div.tableContainer table {	float: left;	width: 100%}html div.tableContainer table/* */ {	margin: 0 -16px 0 0;}html>body div.tableContainer table {	float: none;	margin: 0;	width: 100%;}head:first-child+body div[class].tableContainer table {	width: 100%;}thead.fixedHeader tr {	position: relative;	width: 100%;	top: expression(document.getElementById("tableContainer").scrollTop);}                                              */head:first-child+body thead[class].fixedHeader tr {	display: block;	width: 100%;}thead.fixedHeader th {	background: #d8d8d8;	font-weight: normal;	padding: 4px 3px;	text-align: left;}head:first-child+body tbody[class].scrollContent {	display: block;	width: 100%;	height: 400px;	overflow: auto;}tbody.scrollContent td, tbody.scrollContent tr.normalRow td {	background-color: #f8f8f8;	border-bottom: none;	border-left: none;	border-right: 1px solid #d8d8d8;	border-top: none;	padding: 2px 3px 2px 3px;}tbody.scrollContent tr.normalRow td + td + td + td + td + td {	background-color: #f8f8f8;	border-bottom: none;	border-left: none;	border-right: none;	border-top: none;	padding: 2px 3px 2px 3px;}tbody.scrollContent tr.alternateRow td {	background-color: #d8d8d8;	border-bottom: none;	border-left: none;	border-right: 1px solid #f8f8f8;	border-top: none;	padding: 2px 3px 2px 3px;}tbody.scrollContent tr.alternateRow td + td + td + td + td + td {	background-color: #d8d8d8;	border-bottom: none;	border-left: none;	border-right: none;	border-top: none;	padding: 2px 3px 2px 3px;}head:first-child+body thead[class].fixedHeader th {	border-right: none;	padding: 2px 4px 2px 4px;}head:first-child+body thead[class].fixedHeader th[title=EXECUTE], head:first-child+body thead[class].fixedHeader th[title=RESET] {	width: 50%;};head:first-child+body tbody[class].scrollContent td {	border-right: none;	padding: 2px 4px 2px 4px;}#form_services thead.fixedHead {	margin-top: 2px;	margin-bottom: 2px;	width: 100%;}#form_services tbody.scrollContent {	width: 100%;	height: 350px;	overflow-y: scroll;	background: #d8d8d8;}#form_transactions input[type="button"]#button_preview, #form_transactions input[type="button"]#button_sendcontact, #form_transactions input[type="button"]#button_sendaccmgr, #form_transactions input[type="button"]#button_sendsvcmgr, #form_transactions input[type="button"]#button_refresh {	width: 19.22%;}#form_services input[type="button"]#title_service, #form_services input[type="button"]#title_country, #form_services input[type="button"]#title_region, #form_services input[type="button"]#title_supplier, #form_services input[type="button"]#title_status, #form_services input[type="button"]#title_primattval, #form_services input[type="button"]#group_service, #form_services input[type="button"]#group_country, #form_services input[type="button"]#group_region, #form_services input[type="button"]#group_supplier, #form_services input[type="button"]#group_status, #form_services input[type="button"]#group_primattval, #form_services input[type="button"]#execute_query, #form_services input[type="button"]#reset_query  {	width: 100%;}#form_services select#where_service, #form_services select#where_country, #form_services select#where_region, #form_services select#where_supplier, #form_services select#where_status, #form_services select#where_primattval  {	width: 98%;	margin-top: 1px;	margin-left: 1%;}

    the html is an excerpt of the dhtml populated mysql table from a select. my last two posts (one and more accurately two) were on this functionality. this is highly important to resolve, got lots of other php work to do! -_-

×
×
  • Create New...