Jump to content

Greywacke

Members
  • Posts

    510
  • Joined

  • Last visited

Everything posted by Greywacke

  1. ok, after some research into loading bitmap data from a lloader into a sprite, i came up with the following code. import flash.events.Event;import flash.net.URLLoader;import flash.net.URLRequest;import flash.display.Loader;import flash.utils.Timer;import flash.events.TimerEvent;import flash.display.Sprite;import flash.display.Bitmap;import flash.display.BitmapData;var imagesXML:XML;var xmlLoader:URLLoader = new URLLoader();var imageLoader:Loader = new Loader();imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showImage);var imageHolder = new Array();var imageTimer:Timer;var img = new Array();var delay:uint;var n:uint;var d:uint;xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);xmlLoader.load(new URLRequest("img.xml"));function xmlLoaded(e:Event = null):void { imagesXML = new XML(xmlLoader.data); n = imagesXML.pic.length() - 1; trace((uint(n)+1) + " images detected"); for (var i:uint = 0; i < imagesXML.pic.length(); i++) { img[i] = imagesXML.pic[i].@path; trace(img[i] + " noted"); } imageLoader.load(new URLRequest(img[d])); delay = uint(imagesXML.delay[0].@len); imageTimer = new Timer(delay*1000); trace(delay + " seconds interval"); imageTimer.addEventListener(TimerEvent.TIMER, nextImage);}function showImage(e:Event = null):void { var tempBitmap:Bitmap = e.target.content; var tempBitmapData:BitmapData = tempBitmap.bitmapData; imageHolder[d] = new Sprite(); var loadBitmap:Bitmap = new Bitmap(tempBitmapData); imageHolder[d].addChild(loadBitmap); trace(img[d] + " loaded"); d++; if (d == img.length) { imageTimer.start(); nextImage(); } else { imageLoader.load(new URLRequest(img[d])); }}function nextImage(e:TimerEvent = null):void { if (n >= imageHolder.count) { n = 0; loader_mc.visible = false; } else { n++; } for (var i:uint = 0; i < imageHolder.length; i++) { if (i == n) { imageHolder[i].visible = true; } else { imageHolder[i].visible = false; } }}stop(); however - it now spits out the following in output: 16 images detected000.jpg noted001.jpg noted002.jpg noted003.jpg noted004.jpg noted005.jpg noted006.jpg noted007.jpg noted008.jpg noted009.jpg noted010.jpg noted011.jpg noted012.jpg noted013.jpg noted014.jpg noted015.jpg noted5 seconds interval000.jpg loaded001.jpg loaded002.jpg loaded003.jpg loaded004.jpg loaded005.jpg loaded006.jpg loaded007.jpg loaded008.jpg loaded009.jpg loaded010.jpg loaded011.jpg loaded012.jpg loaded013.jpg loaded014.jpg loaded015.jpg loaded no compiler errors nor errors in output :/
  2. sighs... somebody please help here? :Si have updated the code as follows - but now there are no errors and the following is traced: import flash.events.Event;import flash.net.URLLoader;import flash.net.URLRequest;import flash.display.Loader;import flash.utils.Timer;import flash.events.TimerEvent;import flash.display.Sprite;var imagesXML:XML;var xmlLoader:URLLoader = new URLLoader();var imageLoader = new Array();var imageHolder = new Array();var imageTimer:Timer;var n:uint;xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);xmlLoader.load(new URLRequest("img.xml"));function xmlLoaded(e:Event):void { imagesXML = new XML(xmlLoader.data); n = imagesXML.pic.length() - 1; trace((uint(n)+1) + " images detected"); for (var i:uint = 0; i < imagesXML.pic.length(); i++) { imageLoader[i] = new Loader(); imageLoader[i].x = 0; imageLoader[i].y = 0; imageLoader[i].width = 378; imageLoader[i].height = 231; imageHolder[i] = new Sprite(); imageHolder[i].x = 13; imageHolder[i].y = 0; imageHolder[i].width = 378; imageHolder[i].height = 231; if (i == n) { imageLoader[i].contentLoaderInfo.addEventListener(Event.COMPLETE, showImage); } imageLoader[i].load(new URLRequest(imagesXML.pic[i].@path)); imageLoader[i].visible = true; addChild(imageHolder[i]); imageHolder[i].addChild(imageLoader[i]); imageHolder[i].visible = true; setChildIndex(imageHolder[i],i+2); trace(imagesXML.pic[i].@path + " loaded"); } imageTimer = new Timer(uint(imagesXML.delay[0].@len)*1000); trace(imagesXML.delay[0].@len + " second interval"); imageTimer.addEventListener(TimerEvent.TIMER, nextImage);}function showImage(e:Event = null) { imageTimer.start(); nextImage();}function nextImage(e:TimerEvent = null):void { loader_mc.visible = false; if (n >= imageHolder.count) { n = 0; } else { n++; } for (var i:uint = 0; i < imageHolder.length; i++) { if (i == n) { imageHolder[i].visible = true; } else { imageHolder[i].visible = false; } }}stop(); 16 images detected000.jpg loaded001.jpg loaded002.jpg loaded003.jpg loaded004.jpg loaded005.jpg loaded006.jpg loaded007.jpg loaded008.jpg loaded009.jpg loaded010.jpg loaded011.jpg loaded012.jpg loaded013.jpg loaded014.jpg loaded015.jpg loaded5 seconds interval what's more is that it refuses to display any images! 0oi am in dire straits here, could somebody please lend me their clarity?
  3. hi there,i have created the following actionscript to load the images and slideshow info from an xml document and it is located on frame 1 in one of the layers: import flash.events.Event;import flash.net.URLLoader;import flash.net.URLRequest;import flash.display.Loader;import flash.utils.Timer;import flash.events.TimerEvent;import flash.display.Sprite;var imagesXML:XML;var xmlLoader:URLLoader = new URLLoader();var imageLoader = new Array();var imageHolder = new Array();var imageTimer:Timer;var n:uint;xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);xmlLoader.load(new URLRequest("img.xml"));function xmlLoaded(e:Event):void { imagesXML = new XML(xmlLoader.data); n = imagesXML.pic.length() - 1; trace((uint(n)+1) + " images detected"); for (var i:uint = 0; i < imagesXML.pic.length(); i++) { imageLoader[i] = new Loader(); imageHolder[i] = new Sprite(); imageLoader[i].contentLoaderInfo.addEventListener(Event.COMPLETE, showImage); imageLoader[i].load(new URLRequest(imagesXML.pic[i].@path)); imageLoader[i].x = 0; imageLoader[i].y = 0; imageLoader[i].width = 378; imageLoader[i].height = 231; imageHolder[i].addChild(imageLoader[i]); imageLoader[i].visible = true; imageHolder[i].x = 13; imageHolder[i].y = 0; imageHolder[i].width = 378; imageHolder[i].height = 231; addChild(imageHolder[i]); imageHolder[i].visible = true; setChildIndex(imageHolder[i],i+1); trace(imagesXML.pic[i].@path + " loaded"); } imageTimer = new Timer(uint(imagesXML.delay[0].@len)*1000); trace(imagesXML.delay[0].@len + " seconds"); imageTimer.addEventListener(TimerEvent.TIMER, nextImage);}function showImage(e:Event = null) { nextImage(); imageTimer.start();}function nextImage(e:TimerEvent = null):void { //loader_mc.visible = false; if (n >= imageHolder.count) { n = 0; } else { n++; } for (var i:uint = 0; i < imageLoader.length; i++) { if (i == n) { imageHolder[i].visible = true; } else { imageHolder[i].visible = false; } }}stop(); the xml that is loaded is as follows: <pics> <delay len="5"/> <pic path="000.jpg"/> <pic path="001.jpg"/> <pic path="002.jpg"/> <pic path="003.jpg"/> <pic path="004.jpg"/> <pic path="005.jpg"/> <pic path="006.jpg"/> <pic path="007.jpg"/> <pic path="008.jpg"/> <pic path="009.jpg"/> <pic path="010.jpg"/> <pic path="011.jpg"/> <pic path="012.jpg"/> <pic path="013.jpg"/> <pic path="014.jpg"/> <pic path="015.jpg"/></pics> and the trace output is as follows: 16 images: 000.jpg 001.jpg 002.jpg 003.jpg 004.jpg 005.jpg 006.jpg 007.jpg 008.jpg 009.jpg 010.jpg 011.jpg 012.jpg 013.jpg 014.jpg 015.jpg5 seconds delayTypeError: Error #1010: A term is undefined and has no properties. at slideshow_fla::MainTimeline/nextImage() at slideshow_fla::MainTimeline/xmlLoaded() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() can anyone see what i am missing here? where does my clarity need to focus? this needs to be completed soon!
  4. for some reason it is not printing the $input array either, within the latepost function... :/
  5. hi there,can't seem to find much relative reference for using php_replace_callback to replace strings within an array of strings...here are the functions used and the line that is used later in the code, after the system variables are populated. // functions usedfunction latepost($input) { print_r($input); foreach ($input as $in) { return newpost($in); }}function newpost($key) { if (strstr($key,"\$")!==false) { $syskey = str_replace("\$","",$key); return $GLOBALS[$syskey]; } else { if ($_POST[$key]=="") { return $GLOBALS["dynarr"][$key]; } else { return $_POST[$key]; } }}// only later once the variables have been created, is it indended to populate them.$sysarr = preg_replace_callback("/%([^%]+)%/",latepost,$sysarr); and here is the array that needs replacing. only two matches in the array, mind you! yet this array is returned as it is sent to be parsed, and i do not understand why... Array( [service_id] => 1 [ZipCode] => 99501 [Name] => Pierre du Toit [City] => Anchorage, 99501 [Phone] => 072-915-4799 [County] => Anchorage [Email] => pierre@canopyxchange.za.net [state] => Alaska [iM] => Skype: greywacke_2k7 [Make] => FORD [Condition] => NEW [Model] => RANGER [Function] => Commercial Deluxe [Year] => 1998-LATEST [Product] => Aluminum [CabSize] => REGULARCAB [Color] => COLORCODED [bedSize] => SHORTBOX [budget] => $1,750 plus [Comments] => testing dynamic handler - black cap. [Fitment] => Not within next 3 months [$duplicates] => %$duplicates% [$space] => [l360firstname] => Pierre du Toit (%$duplicates%) [$leadid] => %$leadid% [$formname] => TruckCapXchange [l360makemodel] => FORD RANGER [l360other] => REGULARCAB SHORTBOX Commercial Deluxe NEW [$hash] => # [l360leadid] => #%$leadid% [$obracket] => ( [$cbracket] => )) with this logic, %$leadid% and %$duplicates% should be replaced - but do not get... would someone please be so kind as to point out or even nudge me in the direction of finding the flaw in my logic! :S
  6. hi there, attempted modifying this in the D_Calendar.js file where this function is called and unfortunately then - the calendar does not render! have an idea they will settle for the 7 line calendar then...just this other issue that is left ( http://w3schools.invisionzone.com/index.ph...st&p=198670 ) then done
  7. hi there,another issue with joomla 1.5 using the D Calendar module... i have styled the module, but one last thing is not fixed. the other A tags were given a 29% padding, though if i make it 30% or bigger, it makes the active pseudo-class show as underlined and all pseudo-classes as malformed. Firebug 1.6.1 has shown me that it inherits this underline from a LI tag selector in the main stylesheet when set to these widths... 0o how could this be possible? how can the a:active pseudo-class selector either be made not to inherit or the base style be made not to propagate beyond links in articles and modules other than ones part of the design?the website for these issues is PArktown Boys' High School. .day>a { background: transparent url("/templates/parktownboys2aa/images/calday_date.jpg") center center repeat-x; width: 100% !important; height: 100% !important; text-align: center !important; vertical-align: middle !important; padding: 29%; color: #444444 !important; text-decoration: none !important; overflow: hidden;}.day a:link, .today a:link { width: 100% !important; height: 100% !important; text-align: center !important; vertical-align: middle !important; padding: 29%; color: #444444 !important; text-decoration: none !important; overflow: hidden;}.day a:visited, .today a:visited { width: 100% !important; height: 100% !important; text-align: center !important; vertical-align: middle !important; padding: 29%; color: #444444 !important; text-decoration: none !important; overflow: hidden;}.day a:hover, .today a:hover { width: 100% !important; height: 100% !important; text-align: center !important; vertical-align: middle !important; padding: 29%; color: #444444 !important; text-decoration: none !important; overflow: hidden;}.day a:active, .today a:active { width: 100% !important; height: 100% !important; text-align: center !important; vertical-align: middle !important; padding: 29%; color: #444444 !important; text-decoration: none !important; overflow: hidden;} the excerpt from the li that is inherited: a, .art-post li a { color: #1A1A1A; text-decoration: underline;}
  8. nevermind, have resized the components to encompass the size :)issue is now resolved :)ps: will change to 6 if the client wants that... another line 145 and 197, and i am sure more also use the number 7 that would possibly impact the script...
  9. hi there,the following function is part of the mod_D_Calendar module in the Joomla installation for Parktown Boys' High School. the issue is with the module generating 7 rows for the calendar months... i am struggling a bit to resolve this issue.would anybody mind helping with a bit of direction and clarity here? i am usually well versed with javascript.thanks in advance!
  10. hi again - and thanks, though it just removes the html formatting and not the line breaks... :/ don't suppose there is a way to remove them? had a look around google but couldnt seem to find anything... :/
  11. i was correct (not at first though) - the issue was with the translation if statement.if there is no translation Array( [Make] => FORD [Model] => EXPLORER [Year] => 2007-2010 [CabSize] => CREWCAB [bedSize] => SHORTBOX [Condition] => NEW [Function] => LIFESTYLE DELUXE [Product] => ALUMINUM [Color] => COLORCODED [budget] => $1,750 PLUS [Fitment] => NOT WITHIN NEXT 3 MONTHS)<br /><br />Array( [bigint_ServiceID] => 1 [bigint_ConsumerRegion] => 99501 [text_ConsumerCity] => ANCHORAGE, 99501 [text_ConsumerCounty] => ANCHORAGE [text_ConsumerState] => ALASKA [text_ConsumerName] => PIERRE DU TOIT [text_ConsumerPhone] => 072-915-4799 [text_ConsumerE-Mail] => PIERRE@CANOPYXCHANGE.ZA.NET [text_ConsumerIM] => SKYPE: GREYWACKE_2K7 [text_LeadMessage] => TESTING DYNAMIC HANDLER)<br /><br />Array( [service_id] => 1 [ZipCode] => 99501 [Name] => Pierre du Toit [City] => Anchorage, 99501 [Phone] => 072-915-4799 [County] => Anchorage [Email] => pierre@canopyxchange.za.net [state] => Alaska [iM] => Skype: greywacke_2k7 [Make] => FORD [Condition] => NEW [Model] => EXPLORER [Function] => Lifestyle Deluxe [Year] => 2007-2010 [Product] => Aluminum [CabSize] => CREWCAB [Color] => COLORCODED [bedSize] => SHORTBOX [budget] => $1,750 plus [Comments] => testing dynamic handler [Fitment] => Not within next 3 months [$duplicates] => [$space] => [l360firstname] => [$leadid] => [$formname] => TruckCapXchange [l360makemodel] => [l360other] => [$hash] => # [l360leadid] => [$obracket] => ( [$cbracket] => )) i would suffice it to say ISSUE RESOLVED!!! this was the issue from the start but thanks to everyone for assisting me in finding other lesser bugs and resolving them too! :)thank you all again
  12. ok yay! the dns is up again - but the form is still not working... i printed just before the if statement as follows: case 1: // attributes //reset($_POST); //echo $val[0]."\n"; //print_r($_POST); //echo "\n"; foreach ($_POST as $key => $value) { if ($trans!="") { $key = translate($key,1); $value = translate($value,0); } [b]echo $key." = ".$val[0]."\n";[/b] if ($key == $val[0]) { if (str_in_array($val[0],$attribsarr,0)) { $attribsarr[$val[0]] .= ", ".casing($value,$val[2]); } else { $attribsarr[$val[0]] = casing($value,$val[2]); } } } break; case 2: // users //reset($_POST); //echo $val[0]."\n"; //print_r($_POST); //echo "\n"; foreach ($_POST as $key => $value) { if ($trans!="") { $key = translate($key,1); $value = translate($value,0); } [b]echo $key." = ".$val[0]."\n";[/b] if ($key == $val[0]) { if (str_in_array($val[3],$userarr,0)) { $userarr[$val[3]] .= ", ".casing($value,$val[2]); } else { $userarr[$val[3]] = casing($value,$val[2]); } } } break; and the result was: = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = service_id = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = ZipCode = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = City = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = County = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = State = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Name = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Phone = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = Email = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = IM = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Make = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Model = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = Year = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = CabSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = BedSize = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Comments = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Condition = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Function = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Product = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Color = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Budget = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment = Fitment thus for some reason, $key is blank. i am going to test the value of $test if !== to "".
  13. believe i have found the solution! am trying to test, but unfortunately getting dns errors to http://www.truckcapxchange.com/index2.html so it's currently not available on my connection. it is just doing the default case because it is checking $val[1] against cases 1, 2 and 3 i should be checking intval($val[1]) instead!!!
  14. what does the processed page's html source look like?
  15. i am attempting to create a dynamic form handler which is configurable in the database as to which fields it should request and what it should do with them (where to put them). "$key" is the same as $key though, it is in string compilation. i believe this $ could be the key as to why another part would not be working - perhaps i should escape the $ when checking if there is a $ in the field name from the database! thankyou birbal though, for focusing my attention to another bug :)eg - the following updated newpost function should resolve this minor problem function newpost($key) { if (strstr($key,"\$")!==false) { $syskey = str_replace("\$","",$key); return $GLOBALS[$syskey]; } else { return $_POST[$key]; }} previously it was looking for "$" not " \$" in the string... therefore replacing $ with "" because there is no variable named $ in that functions scope :)unfortunately this does not relieve anything major though and make it work as expected...
  16. ok, it printed each expected key from the database and the post array as expected, with each case within the database resultset loop. but it does not seem to enter the if statements or populate $attribsarr and $userarr what have i overlooked?it might be prudent to share the function which seeks for a value in an array, either as key/index or value. have edited it as follows. it will only allow multiple form elements with the same name to be collected into the same array element though. function str_in_array($needle, $haystack, $sw = 1) { foreach ($haystack as $value[0] => $value[1]) { if ($value[$sw]==$needle) { return true; } } return false;} $value is supposed to be an array, with index 0 as the key and index 1 as the value of each element of the array.also, it still does not show $attribsarr and $userarr being populated, as per the array printout after the variable grabbing section in the previous posts... Array()<br /><br />Array()<br /><br />Array( [service_id] => 1 [ZipCode] => 99501 [Name] => Pierre du Toit [City] => Anchorage, 99501 [Phone] => 072-915-4799 [County] => Anchorage [Email] => pierre@canopyxchange.za.net [State] => Alaska [IM] => Skype: greywacke_2k7 [Make] => FORD [Condition] => NEW [Model] => EXPLORER [Function] => Lifestyle Deluxe [Year] => 2007-2010 [Product] => Aluminum [CabSize] => CREWCAB [Color] => COLORCODED [BedSize] => SHORTBOX [Budget] => $1,750 plus [Comments] => testing dynamic handler [Fitment] => Not within next 3 months [$duplicates] => [$space] => [l360firstname] => [$leadid] => [$formname] => TruckCapXchange [l360makemodel] => [l360other] => [$hash] => # [l360leadid] => [$obracket] => ( [$cbracket] => ))
  17. sighs, i am at wits end here... resetting the $_POST arrays before parsing them does not seem to help. let me try printing it in those two places in bold below... (printing showed the expected values, but the behaviour is not as expected) case 1: // attributes [b]//reset($_POST); //echo $val[0]."\n"; //print_r($_POST); //echo "\n";[/b] foreach ($_POST as $key => $value) { if ($trans!="") { $key = translate($key,1); $value = translate($value,0); } if ($key == $val[0]) { if (str_in_array($val[0],$attribsarr,0)) { $attribsarr[$val[0]] .= ", ".casing($value,$val[2]); } else { $attribsarr[$val[0]] = casing($value,$val[2]); } } } break; case 2: // users [b]//reset($_POST); //echo $val[0]."\n"; //print_r($_POST); //echo "\n";[/b] foreach ($_POST as $key => $value) { if ($trans!="") { $key = translate($key,1); $value = translate($value,0); } if ($key == $val[0]) { if (str_in_array($val[3],$userarr,0)) { $userarr[$val[3]] .= ", ".casing($value,$val[2]); } else { $userarr[$val[3]] = casing($value,$val[2]); } } } break;
  18. there is however, still the issue of the $attribsarr and $userarr arrays not being populated despite successfully parsing the $_POST array... here is the code sofar, followed by the arrays printed: function array_flatten($array, $return=array()) { foreach ($array as $key => $value) { if (is_array($value)) { $return = array_flatten($value,$return); } else { if ($value) { $return[$key] = $value; } } } return $return;}function newpost($key) { if (strstr($key,"$")!==false) { $syskey = str_replace("$","",$key); return $GLOBALS[$syskey]; } else { return $_POST[$key]; }}/*END FUNCTION DECLERATIONBEGIN VARIABLE DECLERATION*/// identify form$referer = $_SERVER["HTTP_REFERER"];$tsql0 = "SELECT * FROM 32_webformconfigs WHERE text_FormWebLocation LIKE \"".$referer."%\";";$tresult0 = mysql_query_errors($tsql0, $conn, __FILE__ , __LINE__ , true );$trow0 = mysql_fetch_array($tresult0);$formid = $trow0["bigint_FormID"];$formname = $trow0["text_FormName"];$pmail = $trow0["text_FormMailerFromAddress"];$tsql1 = "SELECT * FROM 33_webformdetails WHERE bigint_FormID = ".$formid." AND text_DetailDescription = \"TRANS\";";$tresult1 = mysql_query_errors($tsql1, $conn, __FILE__ , __LINE__ , true );//$trow1 = mysql_fetch_array($tresult1);$trans = explode(";",$trow1["text_DetailValue"],7);$tsql2 = "SELECT * FROM 33_webformdetails WHERE bigint_FormID = ".$formid." AND text_DetailDescription = \"VTIGR\";";$tresult2 = mysql_query_errors($tsql2, $conn, __FILE__ , __LINE__ , true );$trow2 = mysql_fetch_array($tresult2);$incl_vtiger = $trow2["text_DetailValue"];$mailadds = array();$mailaddp = array();$mailaddl = array();$attribids = array();$suppliers = array();$supplierp = array();$attribsarr = array();$userarr = array();$errmsg = array();$failure = 0;$success = 0;$ffail = 0;$fsucc = 0;$space = " ";$hash = "#";$obracket = "(";$cbracket = ")";//print_r($_POST);//echo "<br />\n<br />\n";$_POST = array_flatten($_POST,array());//print_r($_POST);//echo "<br />\n<br />\n";$dynarr = $_POST;$tsql6 = "SELECT * FROM 33_webformdetails WHERE bigint_FormID = ".$formid." AND text_DetailDescription = \"FIELD\" ORDER BY bigint_DetailID ASC;";$tresult6 = mysql_query_errors($tsql6, $conn, __FILE__ , __LINE__ , true );if ($tresult6) { while ($trow6 = mysql_fetch_array($tresult6)) { $val = explode(";",$trow6["text_DetailValue"]); switch ($val[1]) { case 1: // attributes foreach ($_POST as $key => $value) { if ($trans!="") { $key = translate($key,1); $value = translate($value,0); } if ($key == $val[0]) { if (str_in_array($key,$attribsarr,0)) { $attribsarr[$key] .= ", ".casing($value,$val[2]); } else { $attribsarr[$key] = casing($value,$val[2]); } } } break; case 2: // users foreach ($_POST as $key => $value) { if ($trans!="") { $key = translate($key,1); $value = translate($value,0); } if ($key == $val[0]) { if (str_in_array($val[3],$userarr,0)) { $userarr[$val[3]] .= ", ".casing($value,$val[2]); } else { $userarr[$val[3]] = casing($value,$val[2]); } } } break; case 3: // concat for ($i = 2; $i < count($val); $i++) { $dynarr[$val[0]] .= newpost($val[$i]); } break; default: $dynarr[$val[0]] = newpost($val[0]); } $dynarr[$val[0]] = newpost($val[0]); }}print_r($attribsarr);echo "<br />\n<br />\n";print_r($userarr);echo "<br />\n<br />\n";print_r($dynarr);echo "<br />\n<br />\n"; the arrays are supposed to be set in cases 1 and 2 of val[1] for these fields... maybe reset the pointer before looping through $_POST?
  19. and i had a thought to inspect the array before it is passed through that function flatten_array, and here it is: here is the array_flatten function that is messing me around... 0ofunction array_flatten($array, $return=array()) { foreach ($array as $key => $value) { if (is_array($value)) { $return = array_flatten($value,$return); } else { if ($value) { [b]$return[] = $value;[/b] } } } return $return;} had a look at the function with better clarity this morning, and the line in bold is what needs to change to the following in order to maintain keys. $return[$key] = $value;
  20. nono, i do not want to turn them off though - i will look into Ingolme's suggestion further, thank you!
  21. or you could just go ahead and use the file ( string $filename [, int $flags = 0 [, resource $context ]] ) function just remember to use the same FILE_USE_INCLUDE_PATH flag as with file_get_contents :)as such: $imagearray = file('backgrounds.inc.php', FILE_USE_INCLUDE_PATH | FILE_IGNORE_NEW_LINES); remember to reference the path to the file to retrieve contents from correctly! :)AND add the FILE_IGNORE_NEW_LINES flag too, unless you want to add an rtrim ( string $str [, string $charlist ] ) function to the array elements printed they WOULD have a new line ending the individual elements of the array otherwise...use print_r($imagearray); after setting the variable, if you need to inspect the contents of an array too.
  22. oh i should probably have shown the database selection: [b]bigint_DetailID bigint_FormID text_DetailDescription text_DetailValue[/b]1 1 FIELD service_id;2;Default Casing;bigint_ServiceID2 1 FIELD ZipCode;2;Default Casing;bigint_ConsumerRegion3 1 FIELD City;2;Default Casing;text_ConsumerCity4 1 FIELD County;2;Default Casing;text_ConsumerCounty5 1 FIELD State;2;Default Casing;text_ConsumerState6 1 FIELD Name;2;Name Casing;text_ConsumerName7 1 FIELD Phone;2;Default Casing;text_ConsumerPhone8 1 FIELD Email;2;lower casing;text_ConsumerE-Mail9 1 FIELD IM;2;Default Casing;text_ConsumerIM10 1 FIELD Make;1;Default Casing11 1 FIELD Model;1;Default Casing12 1 FIELD Year;1;Default Casing13 1 FIELD CabSize;1;Default Casing14 1 FIELD BedSize;1;Default Casing15 1 FIELD Comments;2;Sentence casing;text_LeadMessage16 1 FIELD Condition;1;Default Casing17 1 FIELD Function;1;Default Casing18 1 FIELD Product;1;Default Casing19 1 FIELD Color;1;Default Casing20 1 FIELD Budget;1;Default Casing21 1 FIELD Fitment;1;Default Casing34 1 FIELD $duplicates;035 1 FIELD $space;036 1 FIELD l360firstname;3;Name;$space;$obracket;$duplicates;$cbracket37 1 FIELD $leadid;041 1 FIELD $formname;051 1 FIELD l360makemodel;3;Make;$space;Model55 1 FIELD l360other;3;CabSize;$space;BedSize;$space;Function;$space;Condition60 1 FIELD $hash;061 1 FIELD l360leadid;3;$hash;$leadid62 1 FIELD $obracket;063 1 FIELD $cbracket;0 in all the cases, val[0] would be a string and not a digit (even if in a string). the print out of the flattened array (which $_POST is set to, directly after setting it) is as follows: now i know - better than assuming but still wonder why...
  23. well i was referring to them with keys as associative (strings) and indexes as indexed (numbers). maybe my question would be clearer put as what do i need to do to ensure parsing the array as associative and not indexed.i'm taking a leap and guessing $_POST is both an associative and indexed array (eg can access the values posted either by key or index). i guess the real question would be why is the flatten_array function parsing just the indexed digits and not the associative keys...
×
×
  • Create New...