Jump to content

fmpros

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by fmpros

  1. This worked! I very much appreciate your time and assistance! Thanks again!
  2. This is a huge help. Thank you! I'm going to give this a shot and will report back with my findings.
  3. I think you're right...calling $request[0], etc, makes more sense. I'm new to arrays and having them nested is throwing me off. Do you have a snippet or example you could show me by chance? Not sure how to translate what I have into the proper format. Thanks!!!!
  4. Good Afternoon! I would really appreciate some help with this array issue. This code works when I statically assign the $query array values as shown below. Requests however, can vary in quantity, so I need the $query array values to be dynamic. Can someone more experienced than myself help me solve the issue? $n = 0; foreach($complete_req as $myItem ){ ${'request' . $n }['_kf_personnel'] = $_POST['uid']; ${'request' . $n }['_kf_requirementP'] = $complete_req[$n]; #${'request' . $n }['request'] = 'request'.$n; #$set .= '$request'.$n.', ' ; $n = $n + 1; } $query = array ($request0, $request1 , $request2); //Statically assigned array values but needs to be dynamic
  5. Ok, I feel a bit silly but at least I caught it. Cookies were disabled on the offending iOS devices and yes, I realize that this was not an OS issue . Thanks.
  6. Thanks Porl, I'll give that a try. It gets more peculiar. I've tested this on three iOS devices. It works on my fiance's iPhone, but not on the other two. iOS version is the same I believe. Maybe there is a setting? IDK, I'm an android guy myself. I'll tinker and see what I can find out.
  7. Hi Guys, I've got a login script that works fine on my desktop browsers and android phone but it does not work on iOS. More specifically, the session variables are not saved. All of my pages after the login script start with: if(!session_id()) session_start(); When I echo the variables on the page, they are empty when using iOS. Any ideas would be greatly appreciated! Thanks, John
  8. Hi Folks, I'm creating an equipment reservation system for a client. Every reservation has an equipmentID, ReservationDate, StartTime, EndTime. So, basically my script searches existing records for a given date and EquipmentID. I'm having trouble with how best to approach validation on new reservations to ensure there are no conflicts. Lets say two existing reservations for a given date/equipment are found. One reservation has a startTime of 8AM and endTime of 9AM. The second has a startTime of 12PM and endTime of 3PM. Is there a simple way to check if the user's submitted values for StartTime and EndTime conflict with existing reservations? Any input would be greatly appreciated! Thanks! -John
  9. I figured out the problem. I hope this helps someone down the line. Adding "ob_clean();" corrected the problem! See below: header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: " . $type); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=\"" . $header_file . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($file_real)); ob_clean(); readfile($file_real); Requinix - Thanks lending a hand!
  10. The file 2011-0014 is a sample I put together. This is what I get when I download the file via FTP. The "Corrupt.xls" version is what I get when I use the script to download. Thanks for taking a look. BTW, I had to use mediafire. The forum doesn't allow xls. Valid: http://www.mediafire.com/?dkmgtsbz24b26mn Invalid:http://www.mediafire.com/?em667h4sgz2ugub
  11. Thanks for the replies, much appreciated. The FTP client is uploading in binary mode. I tried making the changes requinix suggested and I'm still having problems. As for what is coming across "garbled", basically the whole document. I've attached two screenshots that show the correct and actual output. Thanks again for the input guys. [attachment deleted by admin]
  12. Hi Folks, I'm having trouble with the attached script when it comes to downloading excel files. The encoding appears to be incorrect (the text in the downloaded file is garbled). The excel files are not generated via php. They are simply uploaded by the client via FTP. What am I doing wrong? Any help would be greatly appreciated! Thanks Much, John <?php $hiddenpath = "/website/myhiddenpath/download/"; // VARIABLES if (!empty($_GET['file'])){ $file = base64_decode($_GET['file']); }else{ echo "Missing Required Data"; die(); } $ext = '.xls'; $file_real = $hiddenpath.$file.$ext; $ip = $_SERVER['REMOTE_ADDR']; /*echo $file_real; die();*/ // Check to see if the download script was called if (basename($_SERVER['PHP_SELF']) == 'dl.php' ) { //If requested file exists if (file_exists($file_real)){ // Get extension of requested file $extension = strtolower(substr(strrchr($file, "."), 1)); echo $extension; // Determine correct MIME type switch($extension){ case "asf": $type = "video/x-ms-asf"; break; case "avi": $type = "video/x-msvideo"; break; case "exe": $type = "application/octet-stream"; break; case "mov": $type = "video/quicktime"; break; case "mp3": $type = "audio/mpeg"; break; case "mpg": $type = "video/mpeg"; break; case "mpeg": $type = "video/mpeg"; break; case "rar": $type = "encoding/x-compress"; break; case "txt": $type = "text/plain"; break; case "wav": $type = "audio/wav"; break; case "wma": $type = "audio/x-ms-wma"; break; case "wmv": $type = "video/x-ms-wmv"; break; case "zip": $type = "application/x-zip-compressed"; break; case "xls": $type = "application/vnd.ms-excel;charset:UTF-8"; break; default: $type = "application/force-download"; break; } // Fix IE bug [0] $header_file = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1) : $file.$ext; // Prepare headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: " . $type); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=\"" . $header_file . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($file_real)); readfile($file_real); }else{ // Requested file does not exist (File not found) echo("Requested file does not exist"); die(); } } ?>
  13. Thanks for the replies. What I'm really trying to prevent, is the user bypassing the time limits by going back and resubmitting. Even if I created a separate processing page with a redirect, couldn't the user eventually get to the form page by pressing back enough times? The refresh is actually not a problem sine the code automatically pushes the user to the next question upon refresh. Thanks again for the quick replies!
  14. Hi Folks, I'm working on a PHP project that is basically a timed quiz. I'm using one self submitting form to process all questions for a given quiz, one question at a time. Each question is essentially an essay and is displayed/timed one at a time. Everything is working great however, the back button allows users to resubmit a question. My attempts at preventing this have been unsuccessful. Man, any help would be so appreciated. I've got a client breathing down my neck. Here is the code: <?php if(!session_id()) session_start(); require_once('include/db.inc.php'); require_once('include/auth.php'); if($_GET['new'] == 'true'){ // A $appDefRecID = '26'; //Static Value $appDefRecord = $uuDB->getRecordById('php_appdefinition', 26); $test = $_GET['id']; $appDefID = $appDefRecord->getField('__kp_AppDefinitionID'); $title = $appDefRecord->getField('Title'); $description = html_entity_decode(nl2br($appDefRecord->getField('Description_css'))); $instructions = html_entity_decode(nl2br($appDefRecord->getField('Instructions_css'))); $newAppCmd = $uuDB->newAddCommand('php_application'); $newAppCmd->setField('_kf_AppDefinitionID',$appDefID); $newAppCmd->setField('_kf_UserID',$_SESSION['userid']); $newApp = $newAppCmd->execute(); $newAppRec = current($newApp->getRecords()); $appRecID = $newAppRec->getRecordId(); $appID = $newAppRec->getField('__kp_ApplicationID'); $newPerformScript = $uuDB->newPerformScriptCommand('php_application', 'php_createApp', $appID); $scriptResult = $newPerformScript->execute(); $appRecord = $uuDB->getRecordById('php_application', $appRecID); $appQs = $appRecord->getRelatedSet('PHP_FieldValue'); $_SESSION['total'] =count($appQs) ; $_SESSION['appRecID'] = $appRecID; $_SESSION['count'] = 0; $_SESSION['valueRecID'] = $appQs[$_SESSION['count']]->getField('z_RecID'); $_SESSION['vRecID'] = array(); $counter = 0; foreach($appQs as $appQ ) { $_SESSION['vRecID'][$counter] = $appQ->getRecordId(); $counter = $counter + 1; } $qRec = $uuDB->getRecordById('php_fieldvalue', $_SESSION['vRecID'][0]); $q = $qRec->getField('FieldLabel'); $javaVar1 = $qRec->getField('FieldTime'); $constant = 1000; $seconds = 60; $javaVar2 = $javaVar1 * $seconds * $constant ; }else{ $_SESSION['count']++; $counter = $_SESSION['count']; if($_SESSION['count'] == $_SESSION['total']){ header('Location: confirmation.php'); exit(); } if (empty($_SESSION['vRecID'][$counter])) { header('Location: error.php'); exit(); } $rec = $uuDB->getRecordById('php_fieldvalue', $_SESSION['vRecID'][$counter-1]); $sub = $rec->getField('SubmitCheck'); if ($rec->getField('SubmitCheck')) { header('Location: error.php'); exit(); } $qRec = $uuDB->getRecordById('php_fieldvalue', $_SESSION['vRecID'][$counter]); $q = $qRec->getField('FieldLabel'); $javaVar1 = $qRec->getField('FieldTime'); $constant = 1000; $seconds = 60; $javaVar2 = $javaVar1 * $seconds * $constant ; $_SESSION['currentAppQid'] = $_SESSION['vRecID'][$counter]; $edit = $uuDB->newEditCommand('php_fieldvalue', $_SESSION['vRecID'][$counter-1] ); $value = $_POST['answer']; $edit->setField('Value', $value ); $edit->setField('SubmitCheck', $_POST['submitCheck']); $edit->execute(); } ?>
  15. Thanks fellas. That did the trick. Much appreciated!
  16. Hi folks, I'm getting the following error: "unexpected T_LNUMBER". I'm trying to build a dynamic table in PHP it was working great until I attempted to include a java reference in one of my links. A watered down version of the code is as follows: $apps_html = '<table>'; $apps_html.= '<tr class="tableHeader">'; $apps_html.= '<th scope="col">VIEW</th>'; $apps_html.= '<th scope="col">TITLE</th>'; $apps_html.= '<th scope="col">DATE MODIFIED</th>'; $apps_html.= '<th scope="col">STATUS</th>'; $apps_html.= '<th scope="col">EDIT</th>'; $apps_html.= '<th scope="col">DELETE</th>'; $apps_html.= '</tr>'; $apps_html.= '<tr class="tablerow2">'; $apps_html.= '<td><a href="link.php">view</a></td>'; $apps_html.= '<td>' . $var1 . '</td>'; $apps_html.= '<td>' . $var2 . '</td>'; $apps_html.= '<td>' . $var3 . '</td>'; if($var1 == 'PENDING'){ $apps_html.= '<td><a href="delete.php">delete</a></td>'; }else{ $apps_html.= '<td><a href="window.html" onclick="popUp(this.href,'200','400'); return false;"></a></td>'; } $apps_html.= '</tr>'; $apps_html.= '</table>'; The document body looks something like this: <html> <head> <title>I hate java</title> </head> <body> <?php echo $apps_html; ?> </body> </html> The problem is with this line obviously: $apps_html.= '<td><a href="window.html" onclick="popUp(this.href,'200','400'); return false;"></a></td>'; Can anyone help me with the correct syntax to include java variables in my href? Thanks for your time! -John
  17. TeNDoLLA, thanks a million! That did the trick. I've been banging my head up against a wall for nearly 24 hours now! Much appreciated!
  18. I'm trying to create a table and form dynamically. The field values contain html strings. My script works except that instead of outputting a table and form, I see the actual HTML code on the page itself. So where I would like to viewing a table, I see the actual tags. I'm certain that the line that is causing the problems is as follows: $form_html .= $question->getField('MyField'); My question is, if this were a MySQL backend what would this line look like? Does that make sense? Thanks in advance!
  19. Alright, if this were a MySQL backend, what would the foreach statement look like? Any feedback would be greatly appreciated. Thanks, John
  20. I would really appreciate some insight on the correct syntax to output HTML. I'm trying to build a form dynamically from a FileMaker database. I believe this is a syntax issue not a FileMaker issue. $form_html = '<form method="post" action="register-exe.php">'; $form_html .= '<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td colspan="3"><hr noshade="noshade" size="1" /></td></tr>'; foreach($questions as $question ) { //the getField is a FileMaker function. It works but the output is literal when I echo it out. $form_html .= $question->getField('MyField'); } $form_html .= '<tr><td colspan="2" class="epi-spacerCell"><input type="submit" name="Submit" value="Apply"></td></tr>'; $form_html .= '<tr><td colspan="3"><hr noshade="noshade" size="1" /></td></tr></tbody></table></form>'; The field value is: <tr> <td class="epi-formLabel"><label for="test"></label></td> <td><input class="epi-input" size="40" name="test" id="71" type="text" ></td> </tr> Within the body of the document, I echo the variable as so: <?php echo $form_html; ?> What is the correct syntax to output HTML from a field or column value? Thanks very much!
  21. Hello All, I'm somewhat new to PHP and am trying to figure out the best way to handle a specific process. Basically, I'm developing an application that will allow a University to create surveys that will then be made available to the students via PHP. On the backend (which is written in FileMaker Pro) I have setup the following tables: SurveyDefinition - Used to define the name and general parameters for a given survey SurveyQuestions - Used to define questions for a given survey. Each question = 1 row SurveyStudent - The parent record when a student creates a survey on line SurveyAnswers - A table used to store the answers to the Surveys - Obviously there will be one row for each question that a survey has defined. So, when a student selects a survey to fill out, the system will have to "build" the survey, survey questions and survey answers. What is the best way to go about providing a UI for users to edit values from multiple rows (records)? Since each answer represents 1 record or row, I'd like for the students to be able to populate the answers and submit the form from a single page and a single submit button. Does anyone have an example they could point me to? I've tried searching the internet for an example but I must be using the wrong terminology (my background is primarily in FileMaker, not PHP). Any help would be greatly appreciated. Sorry if I gave too many details! Best Regards, John I'm working on project that utilizes a FileMaker database back end and PHP on the front. The purpose of this project is to provide a University with the ability to define applications that will be served via PHP to the students. . In the database, I have tables setup
  22. That makes sense. I didn't know select boxes were so fickle. I'll give the loop a try. Thanks for pointing me in the right direction.
  23. Hey, thanks for the reply! I tried inserting the code exactly as shown below, with no luck. When the form returned an error, the field was reset and did not retain the original value. Any other ideas? Thanks again $session1 = $_POST[ 'session1' ]; $records1 = $result1->getRecords(); $session1_popup = <<<HTML <select name="session1" id="session1" value="$session1"><option value="" label=""></option> HTML; foreach($records1 as $record1) { $value1 = $record1->getField('_kf_workshop'); $label1 = $record1->getField('PHP_Workshop::Title'); $session1_popup.= '<option value="' . $value1 . '">' . $label1 . '</option>'; } $session1_popup.= '</select>';
  24. Hello, I've got a dynamic value list using php and FileMaker Pro. I'm trying to include the $POST value so that the user doesn't have to re-enter their info if the form returns an error. Here is the code: $records1 = $result1->getRecords(); $session1_popup = '<select name="session1" id="session1"><option value="" label=""</option>'; foreach($records1 as $record1) { $value1 = $record1->getField('field_a'); $label1 = $record1->getField('field_b'); $session1_popup.= '<option value="' . $value1 . '">' . $label1 . '</option>'; } $session1_popup.= '</select>'; The above code works as expected. What I'd like to do now is add a $POST value to line #2. I'm not quite sure what syntax to use. Something like this? $session1_popup = '<select name="session1" id="session1" value="<?php '.echo $_POST[ 'session1' ].'?>"><option value="" label=""</option>'; Any insight would be greatly appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.