Search Results

Search found 15 results on 1 pages for 'mikey1980'.

Page 1/1 | 1 

  • XML Postback issue

    - by Mikey1980
    I have a script that is designed to parse XML postbacks from Ultracart, right now just dumps it into a MySQL table. The script works fine if I point it to a XML file on my localhost but using 'php://input' it doesn't seem to grabbing anything. My logs show apache returning 200 after the post so I have no idea what could be wrong or how to drill down the issue.. here's the code: $doc = new DOMDocument(); $doc->loadXML($page); $handle = fopen("test2/".time().".xml", "w+"); fwrite($handle,trim($page)); // it doesn't save this either :'( fclose(); require_once('includes/database.php'); $db = new Database('localhost', 'user', 'password', 'db_name'); $data = array(); $exports = $doc->getElementsByTagName("export"); foreach ($exports as $export) { $orders = $export->getElementsByTagName("order"); foreach($orders as $order) { $data['order_id'] = $order->getElementsByTagName("order_id")->item(0)->nodeValue; $data['payment_status'] = $order->getElementsByTagName("payment_status")->item(0)->nodeValue; $date_array = explode(" ",$order->getElementsByTagName("payment_date_time")->item(0)->nodeValue); if ($date_array[1] == 'JAN') { $date_array[1] = '01'; } if ($date_array[1] == 'FEB') { $date_array[1] = '02'; } if ($date_array[1] == 'MAR') { $date_array[1] = '03'; } if ($date_array[1] == 'APR') { $date_array[1] = '04'; } if ($date_array[1] == 'MAY') { $date_array[1] = '05'; } // converts Ultracart date to if ($date_array[1] == 'JUN') { $date_array[1] = '06'; } // MySQL date if ($date_array[1] == 'JUL') { $date_array[1] = '07'; } if ($date_array[1] == 'AUG') { $date_array[1] = '08'; } if ($date_array[1] == 'SEP') { $date_array[1] = '09'; } if ($date_array[1] == 'OCT') { $date_array[1] = '10'; } if ($date_array[1] == 'NOV') { $date_array[1] = '11'; } if ($date_array[1] == 'DEC') { $date_array[1] = '12'; } $data['payment_date'] = $date_array[2]."-".$date_array[1]."-".$date_array[0]; $data['payment_time'] = $date_array[3]; //... we'll skip this, there are 80 some elements $data['discount'] = $order->getElementsByTagName("discount")->item(0)->nodeValue; $data['distribution_center_code'] = $order->getElementsByTagName("distribution_center_code")->item(0)->nodeValue; } } } $db->insert('order_history',$data); } else die('ERROR: Token Check Failed!');

    Read the article

  • Form Validation using Javascript inside PHP

    - by Mikey1980
    I have a simple problem but no matter what I try I can't see to get it to work. I have a form on a php page and I need to validate the qty value on my form so that it doesn't exceed $qty (value pulled from mySQL) and is not less than zero. Sounds easy--hmm wish it were..lol! I had it checking if the value was numeric and in my attempts to make this work I even broke that--not a good morning..lol! Here's a snip of my Java Fn: <script type='text/javascript'> function checkQty(elem){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert("Quantity for RMA must be greater than zero and less than original order!"); elem.focus(); return false; } } </script> The function is called from the submit button, onClick: <input type="submit" name="submit" onclick="checkQty(document.getElementById('qty')";"> I've tried: var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression) || elem.value < 0 || elem.value > <? int($qty) ?>){ No dice....HELP!?!

    Read the article

  • Form Validation using Java inside PHP

    - by Mikey1980
    I have a simple problem but no matter what I try I can't see to get it to work. I have a form on a php page and I need to validate the qty value on my form so that it doesn't exceed $qty (value pulled from mySQL) and is not less than zero. Sounds easy--hmm wish it were..lol! I had it checking if the value was numeric and in my attempts to make this work I even broke that--not a good morning..lol! Here's a snip of my Java Fn: <script type='text/javascript'> function checkQty(elem){ var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression)){ return true; }else{ alert("Quantity for RMA must be greater than zero and less than original order!"); elem.focus(); return false; } } </script> The function is called from the submit button, onClick: <input type="submit" name="submit" onclick="checkQty(document.getElementById('qty')";"> I've tried: var numericExpression = /^[0-9]+$/; if(elem.value.match(numericExpression) || elem.value < 0 || elem.value > <? int($qty) ?>){ No dice....HELP!?!

    Read the article

  • Dump XML Posts from 'php://input' to file

    - by Mikey1980
    I'm trying to write a parser for a xml postback listener, but can't seem to get it to dump the xml for a sample. The API support guy told me to use 'DOMDocument', maybe 'SimpleXML'? Anyways here's the code: (thanks!) <?php $xml_document = file_get_contents('php://input'); $doc = new DOMDocument(); $doc->loadXML($xml_document); $doc->save("test2/".time().".sample.xml").".xml"); ?>

    Read the article

  • PHP-based graphing script recommendation

    - by Mikey1980
    Can anyone recommend a easy to use php-based graphing script? I've been looking at PHPGraphLib but I imagine there tonnes out there. Commercial or GNU, doesn't matter. Only requirement is image based charts as these will be e-mailed/printed. (no flash)

    Read the article

  • Add 'x' 30 mins blocks to time string (javascript)

    - by Mikey1980
    I have a 24 hour time string (ie 16:30) and would like to add x time blocks of 30 mins. For example if x = 4, then 16:30 + 4(30) = 18:30. Is there any easy way to do this with out exploding the string and doing if statements for mins/hours.. etc? Also this is on a php page would it be easier to do this in php then echo it to the javascript? Thanks for the help!

    Read the article

  • Help passing _POST Form Data PHP

    - by Mikey1980
    I apologize in advance, I am a PHP noob! I have form with some hidden fields. I need the values to POST to "submit_rma.php" so that they're not missing from the db--I need $qty, $estmate_id and $rma_type. The rest of the fields are just displaying data for the user and are readonly. Currently I only get value from the qty text field. Is there any easier way to pass these values? URL is out of the question due to security issues. <form method="post" action="submit_rma.php";> <table> <tr> <td> Quantity </td> <td> <input type="text" name="qty" value="<?php echo $qty ?>" size="1"/><br/> </td> </tr> <tr> <td> Part # </td> <td> <input type="text" name="" value="<?php echo $model ?>" size="8" READONLY/><br/> </td> </tr> <tr> <td> Description </td> <td> <input type="text" name="" value="<?php echo $name_EN ?>" size="50" READONLY/><br/> </td> </tr> <tr> <td> Paid Date </td> <td> <input type="text" name="" value="<?php echo $sold_date ?>" size="6" READONLY/><br/> </td> </tr> <tr> <td> Amount Each </td> <td> <input type="text" name="" value="<?php echo $dealer_price ?>" size="8" READONLY/> </td> </tr> </table> <input type="hidden" name="estmate_id" value="<?php echo $estmate_id ?>"> <input type="hidden" name="rma_type" value="Short Shipped"> <input type="submit" name="submit";"> </form>

    Read the article

  • passing string to a AJAX/JSON function

    - by Mikey1980
    I’m having trouble getting a AJAX/JSON function to work correctly. I had this function grabbing value from a drop down box but now I want to use an anchor tag to set it's value. I thought it would be easy to just use the onClick event to pass string to the function I was using for the drop down box but it doesn’t do anything. I’m stumped! Here how I set it up: 1st I add an onClick event… <a href="<?php echo Settings::get('app.webroot'); ?>?view=schedule&action=questions" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('bre','','template/images/schedule/bre_f2.gif',1) onclick="assignCallType('testing')";> 2nd I check main.js.php function assignCallType(type) { alert(type); //just for debugging new Request.JSON({ url: "ajax.php", onSuccess: function(rtndata,txt){ if (rtndata['STATUS'] != 'OK') alert('Error assigning call type to call'); }, onFailure: function (xhr) { alert('Error assigning call type to call'); } }).get({ 'action': 'assignCallType', 'call_type': type }); } 3rd Ajax.php: the variable is back in PHP and values don’t get added to the db, but I also didn’t get the alert from main.js.php if ($_GET['action'] == "assignCallType") { if ($USER->isInsideSales()) { $call_type = $_GET['call_type']; $_SESSION['callinfo']->setCallType($call_type); $_SESSION['callinfo']->save($callid); echo json_encode(array('STATUS'=>'OK')); } else { echo json_encode(array('STATUS'=>'DENIED')); } } Any idea where I am going wrong. The only difference between this and the working drop down is how the function was called, I used onchange="assignCallType(this.value)".

    Read the article

  • JSON onFailure issue

    - by Mikey1980
    I’m having trouble getting a AJAX/JSON function to work correctly. I had this function grabbing value from a drop down box but now I want to use an anchor tag to set it's value. I thought it would be easy to just use the onClick event to pass string to the function I was using for the drop down box but I get the alert in JSON onFailure event even though data gets added to MySQL. I tried removing the alert from onFailure event but then it doesn't add the data. The drop down still continues work work fine, no alerts. (I should note that removing the alert also broke my drop down box) 1st I add an onClick event… <a href="<?php echo Settings::get('app.webroot'); ?>?view=schedule&action=questions" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('bre','','template/images/schedule/bre_f2.gif',1)" onclick="assignCallType('testing')";> 2nd I check main.js.php function assignCallType(type) { alert(type); new Request.JSON({ url: "ajax.php", onSuccess: function(rtndata,txt){ if (rtndata['STATUS'] != 'OK') alert('Status was not okay'); }, onFailure : function () { alert("onFailure") } }).get({ 'action': 'assignCallType', 'call_type': type }); } 3rd Ajax.php: the variable is back in PHP and values get added to MySQL but I get the Alert in the JSON onFailure event if ($_GET['action'] == "assignCallType") { if ($USER->isInsideSales()) { $call_type = $_GET['call_type']; $_SESSION['callinfo']->setCallType($call_type); $_SESSION['callinfo']->save($callid); echo json_encode(array('STATUS'=>'OK')); } else { echo json_encode(array('STATUS'=>'DENIED')); } } Any idea where I am going wrong. The only difference between this and the working drop down is how the function was called, I used onchange="assignCallType(this.value)".

    Read the article

  • suppress error using fread()

    - by Mikey1980
    I wrote a script for screen pops from our soft phone that locates a directory listing for the caller but occasionally they get "Can't read input stream" and the rest of the script quits. Does anyone have any suggestions on how to suppress error the error message and allow the rest of the script to run? Thanks! $i=0; $open = fopen("http://www.411.ca/whitepages/?n=".$_GET['phone'], "r"); $read = fread($open, 9024); fclose($open); eregi("'/(.*)';",$read,$got); $tv = ereg_replace('[[:blank:]]',' ',$got[1]); $url = "http://www.411.ca/".$tv; while ($name=="unknown" && $i < 15) { ## try 15 times before giving up $file = @ fopen($fn=$url,"r") or die ("Can't read input stream"); $text = fread($file,16384); if (preg_match('/"name">(.*?)<\/div>/is',$text,$found)) { $name = $found[1]; } if (preg_match('/"phone">(.*?)<\/div>/is',$text,$found)) { $phone = $found[1]; } if (preg_match('/"address">(.*?)<\/div>/is',$text,$found)) { $address = $found[1]; } fclose($file); $i++; }

    Read the article

  • MOOTOOLS calling sexy.error() from PHP

    - by Mikey1980
    I am very inexperienced with PHP and I've having trouble calling a mootools function. Here's my code: echo '<script language="JavaScript">'; echo "Sexy.error('Test!');"; echo '</script>'; When I try it with a simple alert('test') it works just fine.. I'm confused?!?

    Read the article

  • Searching Arrays, array_search() issue

    - by Mikey1980
    Is there any way I can search an array for a value and return it's key, I tried array_search() with no success... below is an example of my array [0] = Array ( [value] = [text] = All Call Types ) [1] => Array ( [value] => enquiry [text] => Renovation Enquiry ) [2] => Array ( [value] => msg [text] => Message to Pass on ) ... My ultimate goal is to convert value to text. Here's what I tried: $key = array_search($row['call_type'], $type_list); $call_type_name = $type_list[$key]['text']; Thanks!

    Read the article

1