-
Posts
168 -
Joined
-
Last visited
Never
Everything posted by radi8
-
Thanks for the tips. II will keep that in mind the next time I am doing any type of research.
-
This is a job for Javascript and Ajax! You can setup a timer in JS, then pass the URL of a file that will do this function and have its return value be whatever you want.
-
Also, inthe $sql2 string, you are passing the $password variable, whic is not the md5 value. Try passing in the $has value instead (just a guess since I would expect all passwords to be in the md5 format).
-
I put this in the wrong forum and copied it to this one. I apologize ahead of time for the double post. (quote author=radi8 link=topic=333351.msg1569942#msg1569942 date=1305654626) One more question for you all: We just installed a new Linux Ubuntu V 11.04 server with LAMP (Apache2, PHP 5.3.x, MySQL 5.1.4, etc...) all out of the box stuff. I developed (locally) and app where I am exporting some data from MySQL, putting it into a spreadsheet and then sending the Excel file to the client. This all worked fine in my dev setup. BUT... (you know whats coming next) after deploying the app to the new Web Server, when I attempt to export the data, I am successfully creating the Excel file but rather than opening the download dialogue box, the data is being read and sent to the browser window as text! As I mentioned before, this is a new web server, so there may be something missing on the Apache2 setup, or my code may just be crap. Either way, my head hurts and cannot find out what is happening. Here is my header type configuration: <?php function save($filename, $download=false, $download_filename="") { if (!$download) { return $this->domXML->save($filename); } elseif ($this->domXML->save($filename)) { $realFileInfo = $_SERVER['DOCUMENT_ROOT'].'/truck/admin/export/'.$download_filename; $FileInfo = pathinfo($filename); ob_end_clean(); // fix for IE catching or PHP bug issue header("Pragma: public"); header("Expires: 0"); // set expiration time header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header ("Pragma: no-cache"); //header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); // browser must download file from server instead of cache // force download dialog header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera header("Content-type: application/x-msexcel"); header("Content-Type: application/download"); // use the Content-Disposition header to supply a recommended filename and // force the browser to display the save dialog. if ($download_filename == "")$download_filename = "download.xls"; //header("Content-Disposition: attachment; filename=".$download_filename.";"); header("Content-Disposition: attachment; filename=".$realFileInfo.";"); header("Content-Transfer-Encoding: binary"); //header("Content-Length: ".filesize($filename)); header("Content-Length: ".filesize($realFileInfo)); //@readfile($filename); @readfile($realFileInfo); return true; } return false; } ?> I added a screen cap for you to see the output. Can you see anything wrong? [attachment deleted by admin]
-
Who cares about their certifications. They have good, solid examples of many techniques and it is laid out in a way where you can get answers, especially on those really stupid 'I should know this' stuff. It is ONLY a resource, nothing more. Their AJAX samples are right on the money and the one explaining how to integrate JAVASCRIPT with PHP is really easy to grasp and use.
-
I put this in the wrong forum. I don't even know why I was in the AJAX forum t begin with. Does anyone know how to move this to the 'General Help' board?
-
One more question for you all: We just installed a new Linux Ubuntu V 11.04 server with LAMP (Apache2, PHP 5.3.x, MySQL 5.1.4, etc...) all out of the box stuff. I developed (locally) and app where I am exporting some data from MySQL, putting it into a spreadsheet and then sending the Excel file to the client. This all worked fine in my dev setup. BUT... (you know whats coming next) after deploying the app to the new Web Server, when I attempt to export the data, I am successfully creating the Excel file but rather than opening the download dialogue box, the data is being read and sent to the browser window as text! As I mentioned before, this is a new web server, so there may be something missing on the Apache2 setup, or my code may just be crap. Either way, my head hurts and cannot find out what is happening. Here is my header type configuration: <?php function save($filename, $download=false, $download_filename="") { if (!$download) { return $this->domXML->save($filename); } elseif ($this->domXML->save($filename)) { $realFileInfo = $_SERVER['DOCUMENT_ROOT'].'/truck/admin/export/'.$download_filename; $FileInfo = pathinfo($filename); ob_end_clean(); // fix for IE catching or PHP bug issue header("Pragma: public"); header("Expires: 0"); // set expiration time header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header ("Pragma: no-cache"); //header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); // browser must download file from server instead of cache // force download dialog header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera header("Content-type: application/x-msexcel"); header("Content-Type: application/download"); // use the Content-Disposition header to supply a recommended filename and // force the browser to display the save dialog. if ($download_filename == "")$download_filename = "download.xls"; //header("Content-Disposition: attachment; filename=".$download_filename.";"); header("Content-Disposition: attachment; filename=".$realFileInfo.";"); header("Content-Transfer-Encoding: binary"); //header("Content-Length: ".filesize($filename)); header("Content-Length: ".filesize($realFileInfo)); //@readfile($filename); @readfile($realFileInfo); return true; } return false; } ?> Can you see anything wrong? [attachment deleted by admin]
-
I used this one: http://www.w3schools.com/ajax/default.asp It really worked well and got me rolling on some GREAT dynamic page manipulation
-
It was a permissions issue on the file. This is a new Linux LAMP server and I guess we are still learning. Thanks to all for your help and assistance. As always, you are the best source of help and support.
-
That was a formatting issue I injected on this forum post and not a problem in the actual code page. Sorry for the confusion.
-
I am using a PHP class for a web app that works perfectly well when developing on local machine (PHP 5.2) using the NuSphere IDE. NuSphere sees the class, and when I run the app locally everything seems to work, but when i port the app to the host (Linux Ubuntu with Apache2, PHP 5.3, MySQL 5.1 ), the class is not found (using the remote host debugger). The exact mesage is: Class 'ExcelXML' not found at <line of code>. Here is the code snippet: <?php function setExcelData($sql, $title, $fileName, $idref=0) { $retVal=false; //$fileName=$fileName.'.xml'; $fileName=$fileName.'.xls'; include ('ExcelXML.inc.php'); include_once $_SERVER['DOCUMENT_ROOT'].'/truck/inc/db.inc.php'; $input = ($idref==0?"blank1.xml":"blank.xml"); // create ExcelXML object $xml = new ExcelXML(); // read template file if (!$xml->read($input)) { echo "Failed to open Tempalate Excel XML file<br>"; } ... ?> Here is the class <?php /** * Class ExcelXML * Provide functions to modify the content of file in Excel's XML format. * * REQUIRED: * - An ExcelXML file as template * * FEATURES: * - read, modify, and save Excel's XML file * - create download stream as Excel file format (*.xls) * * CHANGELOG: * 06-08-2008 * - Update setCellValue function * - Fix setCellValue bug * 13-07-2008 * - First created * * * @author Herry Ramli ([email protected]) * @license GPL * @version 0.1.1 * @copyright August 06, 2008 */ class ExcelXML { var $domXML; var $activeWorksheet; function ExcelXML() { } ... ?> The class is in the same folder location as the calling php file. Any ideas? I don't get it.
-
Actually, the solution was to use the following: document.getElementById("carrierMsg2").style.display = "table-cell" instead of: document.getElementById("carrierMsg2").style.display = "block"
-
OK, here is the scenario, In the table in the first code segment below, I have to inner table elements that I will use to tell the user that the update either succeeded or failed (id's carrierMsg1 and carrierMsg2). If I view these elements without hiding them, they span the columns correctly and everything looks great... BUT (and there is always that but), if I hide the elements initially and then use Javascript (second section) to then conditionally show them, the table elements will only display in the first column of the table even though I explicitly tell it to colspan=8. This is definitely an issue with the style.display="bock" command. Can anyone help me get the embedded table to span the entire 8 columns? <table class="reference" width="100%" border="0" align=left> <caption align="top"> Carrier Info for 1st Choice / Barnett Truck </caption> <tr> <th width="7.5%">Number</th> <th width="25%">Name</th> <th width="30%">Email</th> <th width="7.5%">Ship CA</th> <th width="7.5%">Ship FL</th> <th width="7.5%">Ship PA</th> <th width="7.5%">Ship TX</th> <th width="7.5%">Disabled?</th> </tr> <tr> <td align="center">74926</td> <td align="center">1st Choice / Barnett Truck</td> <td align="center"><input type="text" size="40" id="carrierEmail" value="[email protected]"></td> <td align="center"><input type="checkbox" name="shipCA" id="shipCA" value=1 checked></td> <td align="center"><input type="checkbox" name="shipFL" id="shipFL" value=1 checked></td> <td align="center"><input type="checkbox" name="shipPA" id="shipPA" value=1 checked></td> <td align="center"><input type="checkbox" name="shipTX" id="shipTX" value=1 ></td> <td align="center"><input type="checkbox" name="carrierDisabled" id="carrierDisabled" value=1 ></td> </tr> <tr> <th colspan=8> <input type="button" name="updateBase" id="updateBase" value="Update Base Carrier Info" onClick="doBase(74926)"> </th> </tr> <tr> <th colspan=8 style="display:none" id="carrierMsg1"> <table class="reference" width = "100%" align="center"> <tr class="success"> <th>SUCCESS</th> </tr> <tr> <th>Carrier Data was successfully updated</th> </tr> </table></th> </tr> <tr> <th colspan=8 style="display:none" id="carrierMsg2"> <table class="reference" width = "100%" align="center"> <tr class="error"> <th>AN ERROR OCCURRED DURING UPDATE</th> </tr> <tr> <th>Carrier Data was NOT updated!!</th> </tr> </table></th> </tr> </table> java script: function doBase(carrierNbr){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState>=3 && xmlhttp.status==200) { var txt = xmlhttp.responseText; if(isNaN(txt)){ document.getElementById("carrierMsg2").style.display = "block"; //document.getElementById("carrierMsg2").cells.colspan=8; } else{ var txtVal = parseInt(txt); if(txtVal==0){ document.getElementById("carrierMsg1").style.display = "block"; // document.getElementById("carrierMsg1").cells.colspan=8; } else { document.getElementById("carrierMsg2").style.display = "block"; //document.getElementById("carrierMsg2").cells.colspan=8; } } } } document.getElementById("carrierMsg1").style.display = "none"; document.getElementById("carrierMsg2").style.display = "none"; var email = document.getElementById('carrierEmail').value; var ca = document.getElementById('shipCA').checked?1:0; var fl = document.getElementById('shipFL').checked?1:0; var pa = document.getElementById('shipPA').checked?1:0; var tx = document.getElementById('shipTX').checked?1:0; var dis = document.getElementById('carrierDisabled').checked?1:0; xmlhttp.open("GET","<?php print 'http://'.$_SERVER['HTTP_HOST'].'/webServices/updateCarrier.inc.php';?>?carrierNbr="+carrierNbr+"&carrierEmail="+email+"&shipCA="+ca+"&shipFL="+fl+"&shipPA="+pa+"&shipTX="+tx+"&disabled="+dis,true); xmlhttp.send(); }