Jump to content

iwato

Members
  • Content count

    868
  • Joined

  • Last visited

Everything posted by iwato

  1. It's OK. I have figured out a solution. I will generate the variable HTML code dynamically outside the template and then insert the result as the value of an HTML template variable that serves as a placeholder for the dynamically generated content within the template.
  2. BACKGROUND: I have an HTML template that contains a variety of template variables designated by the following pair of delimiters %varname%. In most cases there is a one-to-one correspondence between the values of a set of PHP variables gathered on a PHP processing page and the template variables found on the HTML template. The routine for populating the template variables with values is captured in the following code snippet of a very simple PHP class designed for generating templates. function replace_tags($tags) { if (sizeof($tags) > 0) { foreach ($tags as $tag => $data) { $replace = '%\%' . $tag . '\%%'; $data = (file_exists($data)) ? join("", file($data)) : $data; $this->page = preg_replace($replace, $data, $this->page); } } else { die("No tags designated for replacement."); } } The PROBLEM: My difficulty arises when I seek to populate one of the sets of template variables whose number of sets is not clearly known until the template is generated. Within the template HTML code for a single set of three variables is set aside. Ostensibly, this same set of variables could be repeated five different times, with each time carrying a different set of values. PROBLEM RESOLUTION: As each set of PHP data is numerically encoded there is no confusion about which data goes with each set. And, since the HTML code for each set of data is identical across sets it appears to be a relatively easy task to populate the template variables of the relevant set repeatedly with different data from different PHP variable sets. I imagine myself breaking the HTML code into three parts: the part that comes before the dynamically generated HTML; the part that generates the dynamic HTML code; and the part that that comes after the dynamically generated HTML. Can anyone suggest an alternative strategy? One, for example, that would simply allow me to insert the dynamically generated HTML on the fly? Roddy
  3. Adding new selection to Php/SQL code

    The following SQL statement is in error $sql = "INSERT INTO users (fname, lname, uname, email, pwd, ) VALUES ('$fname', '$lname', '$uname', '$email' '$pwd')"; You have a comma after the variable name pwd that does not belong, and you left out the necessary comma between the two variable values $email and $pwd. Roddy
  4. How to Automate an HTTPRequest with PHP

    Please review the following code and make any suggestions that might improve it. Please understand that all functions and variables can be called and yield the proper results. class Newsletter { public $letter_no; public $mysqli_obj; public $pc_total; public $podcasts; public function __construct($letter_no, $mysqli_obj) { $this->letter_no = $letter_no; $this->mysqli_obj = $mysqli_obj; } public function get_letter() { $mysqli_obj = $this->mysqli_obj; $letter_no = $this->letter_no; $sql = "SELECT letter.*, qa.qa_question, qa.qa_answer FROM sevengates_letter AS letter JOIN sevengates_qa AS qa ON qa.letter_no = letter.letter_no WHERE letter.letter_no =?"; $mysqli_stmt = $mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $letter_results[$name] = $value; } } return $letter_results; } public function get_nextletter() { $letter_no = $this->letter_no; $mysqli_obj = $this->mysqli_obj; $next_letter_no = $letter_no + 1; $sql = "SELECT letter_no, letter_title, letter_abstract FROM sevengates_letter WHERE letter_no = ?"; $mysqli_stmt = $mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $next_letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $mysqli_stmt->free_result(); foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $nextletter_results[$name] = $value; } } return $nextletter_results; } public function get_podcasts() { $letter_no = $this->letter_no; $mysqli_obj = $this->mysqli_obj; $sql = "SELECT podcast_ref FROM sevengates_podref WHERE letter_no = ?"; $mysqli_stmt = $mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $i = 1; foreach ($prelim_result as $arr) { foreach ($arr as $name => $value) { $name = $name . '_' . $i; $podcasts[$name] = $value; } $i++; } $this->pc_total = count($podcasts); return $podcasts; } public function get_podcast_data($podcasts) { $mysqli_obj = $this->mysqli_obj; $this->podcasts = $podcasts; $prelim_result = []; $c = []; $row = []; $podcast_results = []; foreach ($podcasts as $name => $value) { $params = []; $mysqli_stmt = $mysqli_obj->stmt_init(); $sql = "SELECT item_podtype, podcast_no_item, item_title, item_description, item_guid FROM rss2_podcast_item WHERE podcast_no_item = ?"; $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $value); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } } $prelim_result[] = $c; $mysqli_stmt->free_result(); } foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ $pc_result[$name] = $value; } $podcast_results[] = $pc_result; } return $podcast_results; } } Roddy
  5. BACKGROUND: I have a PHP generator that creates a newsletter from an HTML template with data obtained from a MySQL database. My current plan is to include with the generator an automated mailing function using PHPMailer. I intend to use this generator to consummate to kinds of mailing functions -- mass and individual. The individual mailing: when a user opens an account he automatically receives an automatically generated newsletter with information designed for first users. In this newsletter he has the option of subscribing on a more permanent basis or declining further receipt of future newsletters. TWO TRIGGERS: The code that triggers the mailing of the first newsletter will come from the user and must be automated. The code that triggers a mass mailing to all subscribers must come from me and must be manual. This latter trigger can be resolved easily with a simple link and attached query statement. It is the automated trigger coming directly from the user that is problematic. THE DILEMMA: When the user applies for an account, he receives a verification email with a link to a PHP processor that matches the hash that he received in the email with the one created and inserted into a database when he signed up for the account. It is this PHP processor that must provide the information to the newsletter generator and trigger the new account holder's first mailing of the newsletter. The trigger must be automated. QUESTION: Although it is relatively easy to write Javascript that automatically triggers an HTTPRequest object to the newsletter generator, I am having trouble finding a simple PHP routine that will do the same. Have you any suggestions? Roddy
  6. How to Automate an HTTPRequest with PHP

    Yes, you have understood correctly. I echo as a means to insure that I am getting what it is that i am after. Already, I have created the functions that I will convert into methods, and each has a return value corresponding to what I have echoed. Eight years have passed since I created my first PHP class, but I took very good notes. Your suggestion about the get and set methods reminded of something I had forgotten. And, your suggestion with regard to the error and connectivity code excites me, as I recently changed my password and discovered that it was a very time-consuming process to call up all the files containing connectivity code. So, once again, thank you kindly for your help. Roddy
  7. How to Automate an HTTPRequest with PHP

    Yes, Ingolme and JSG, I have gotten the message and have figured out a way to catalogue the functions. Simply it will take more time. In effect, it is a short-term sacrifice for the long term. Unfortunately, these short-term sacrifices for the long-term are very expensive -- well, at least, for me, anyway.. in the end, I am surprised that you have not recommended that I create classes. Please find below a copy of my code, review it, and then tell me which of the approaches given below the code would be the most appropriate and why. Please understand that this code only assembles the data from the database -- little more. Your answer will likely guide me in assembling the entire package. <?php /************************************************************ Set up PHP error reporting. *************************************************************/ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); /************************************************************ Manual entry of letter number. *************************************************************/ /* $letter_no = 2; echo $letter_no; echo "<br /><span style='color:blue;'>\$param_val</span><span style='color:red;'>: The number of the newsletter that generates the retrieval of the data necessary to fill the template that becomes the newsletter.</span>"; echo '<hr>'; */ /************************************************************ The Test for a Valid $_GET Request (Automated Variable Assignment of the Number of the Current Edition) *************************************************************/ if ($_SERVER["REQUEST_METHOD"] == "GET") { if (empty($_GET['letter_no'])) { $error_msg = "Please submit an edition number for the newsletter that you desire."; } else { $letter_no = filter_var($_GET['letter_no'], FILTER_VALIDATE_INT); amass_data($letter_no); /********************************************************************************************* Close Test for the presence of a proper edition number. *********************************************************************************************/ } /********************************************************************************************* Close Test for Proper a HTTPRequest *********************************************************************************************/ } /********************************************************************************************* Create the amass_data() Funtion with Prepared SQL Statments *********************************************************************************************/ function amass_data($letter_no) { /************************************************************ Establish a connection with the database and set the character set. *************************************************************/ define('_HOST_NAME','baha.lunarbreeze.com'); define('_DATABASE_NAME','...'); define('_DATABASE_USER_NAME','...'); define('_DATABASE_PASSWORD','...'); $mysqli_obj = new MySQLi(_HOST_NAME,_DATABASE_USER_NAME,_DATABASE_PASSWORD,_DATABASE_NAME); if($mysqli_obj->connect_errno) { die("ERROR : -> ".$mysqli_obj->connect_error); } /************************************************************ Set the Character Set of Database Communication to UTF-8 *************************************************************/ if(!$mysqli_obj->set_charset("utf8")) { printf("Error loading character set utf8: %s\n", $mysqli_obj->error); exit(); } /********************************************************************************************* Select (With a Prepared Statement) the data from the Sevengates _letter and _qa data tables that corresponds to the designated letter number. *********************************************************************************************/ $sql = "SELECT letter.*, qa.qa_question, qa.qa_answer FROM sevengates_letter AS letter JOIN sevengates_qa AS qa ON qa.letter_no = letter.letter_no WHERE letter.letter_no =?"; $mysqli_stmt = $mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $mysqli_stmt->free_result(); //$mysqli_obj->close(); foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ echo $name . ': ' . $value . '<br />'; $letter_results[$name] = $value; } } echo "<span style='color:blue;'>\$letter_results</span><span style='color:red;'>: Selected data from the designated Seven Gates newsletter data</span>"; echo '<hr>'; /********************************************************************************************* Extract the number of the most recently posted newsletter data. *********************************************************************************************/ $letter_no = $letter_results['letter_no']; echo '$letter_results["letter_no"] = '. $letter_no; echo "<br /><span style='color:red;'>The just requested Seven Gates edition number.</span>"; echo '<hr>'; /********************************************************************************************* Next Newsletter Preview from Current Letter Edition *********************************************************************************************/ $next_letter_no = $letter_no + 1; echo '$next_letter_no' . ': ' . $next_letter_no . '<br />'; echo '$letter_results["next_title"] = '. $letter_results['next_title'] . '<br />'; echo '$letter_results["next_letter"] = '. $letter_results['next_letter'] . '<br />'; echo "<span style='color:blue;'>\$next_result</span><span style='color:red;'>: Selected preview data for next Seven Gates newsletter taken from the current letter archive.</span>"; echo '<hr>'; /********************************************************************************************* Next Newsletter Preview from Next Letter Edition *********************************************************************************************/ $result = []; $params = []; $row = []; $c = []; $prelim_result = []; $sql = "SELECT letter_title, letter_abstract FROM sevengates_letter WHERE letter_no = ?"; $mysqli_stmt = $mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $next_letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $mysqli_stmt->free_result(); //Print and store preview data obtained from the next letter archive. foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ echo $name . ': ' . $value . '<br />'; $nextletter_results[$name] = $value; } } echo '<span style="color:blue;">$nextletter_results</span><span style="color:red;">: Selected preview data for next Seven Gates newsletter obtained from the next letter archive.</span>'; echo '<hr>'; /********************************************************************************************* Discover (With a Prepared Statement) the podcasts associated with the most recently posted newsletter data *********************************************************************************************/ $params = []; $prelim_result = []; $row = []; $c = []; $podcasts = []; $sql = "SELECT podcast_ref FROM sevengates_podref WHERE letter_no = ?"; $mysqli_stmt = $mysqli_obj->stmt_init(); $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $letter_no); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } $prelim_result[] = $c; } $mysqli_stmt->free_result(); // $mysqli_obj->close(); /********************************************************************************************* Extract the value for each referenced podcast, assign to it a unique name, and create from this unique name and associated value an array whose elements are the name-value pairs for each referenced podcast. *********************************************************************************************/ $i = 1; foreach ($prelim_result as $arr) { foreach ($arr as $name => $value) { $name = $name . '_' . $i; $podcasts[$name] = $value; } $i++; } $pc_total = count($podcasts); //Display $pc_total echo '<span style="color:blue;">$pc_total</span>: There are <span style="color:red;">' . $pc_total . '</span> podcasts associated with the Seven Gates Newsletter No. ' . $letter_no; echo '<hr>'; /********************************************************************************************* Retrieve data (With a Prepared Statement) from the named fields of the just discovered podcasts. *********************************************************************************************/ $prelim_result = []; foreach ($podcasts as $name => $value) { $params = []; $c = []; $row = []; $mysqli_stmt = $mysqli_obj->stmt_init(); $sql = "SELECT item_podtype, podcast_no_item, item_title, item_description, item_guid FROM rss2_podcast_item WHERE podcast_no_item = ?"; $mysqli_stmt->prepare($sql); $mysqli_stmt->bind_param('i', $value); $mysqli_stmt->execute(); $meta = $mysqli_stmt->result_metadata(); while ($field = $meta->fetch_field()) { $params[] = &$row[$field->name]; } call_user_func_array(array($mysqli_stmt, 'bind_result'), $params); while ($mysqli_stmt->fetch()) { foreach($row as $key => $val) { $c[$key] = $val; } } $prelim_result[] = $c; $mysqli_stmt->free_result(); } // print_r($prelim_result); $mysqli_stmt->free_result(); //$mysqli_obj->close(); foreach ($prelim_result as $arr) { foreach ($arr as $name => $value){ echo $name . ': ' . $value . '<br />'; $pc_results[$name] = $value; } echo '<br />'; } echo '<span style="color:blue;">$pc_results</span><span style="color:red;">: Data retrieved from the above named podcasts.</span>'; echo '<hr>'; /********************************************************************************************* Close the amass_data() function. *********************************************************************************************/ } ?> <?php /* require_once("/Users/kiusau/vendor/autoload.php"); $lipsum = new joshtronic\LoremIpsum(); var_dump(class_exists('joshtronic\LoremIpsum', false)); require_once("../../_utilities/php/page.php"); $start = "<!DOCTYPE html>"; $end = "</html>"; $page = new Page("./newsletter_template.php", $start, $end); $page->parse("./newsletter_template.php"); $tags = array( 'letter_no' => $result['letter_no'], 'letter_title' => $result['letter_title'], 'letter_link' => $result['letter_link'], 'letter_abstract' => $result['letter_abstract'], 'date' => $result['submission_date'], 'revision' => $result['revision_date'], ); $page->replace_tags($tags); $page->output(); */ ?> What are the advantages and disadvantages of each approach and why? Which would you recommend, if any? Leave the code as is and simply include or require it where necessary. Write the whole thing as a single class and convert the functions into methods. Write a new class for each function Roddy
  8. How to Automate an HTTPRequest with PHP

    Please allow me to restate my question: Is the function verify_email( ) -- as written in Ingolme's snippet -- properly declared? Or, has she assumed its prior existence and not written its full declaration as a heuristic expedient?
  9. onclick function call with parameters

    NO! Do not use the .bind( ) function, it has been deprecated. Use the more flexible .on( ) function. Great explanation! Have a great day! Roddy
  10. How to Automate an HTTPRequest with PHP

    Can I now access that function anywhere, or is it dependent on the variable whose return value it contains?
  11. How to Automate an HTTPRequest with PHP

    JSG: Thank you for the hesitation. I have understood your hesitance well. This is, indeed, what I am attempting to do. Simply, my idea was to do it on its own separate page. Up until this point my preference for compartmentalization has been webpages. The reason for this has been one of order. In short, each page is its own entity that can be accessed at will and neatly listed on an index page for easy reference. Accordingly, most functions that I write are written and entered on two separate pages: one in HTML with a highlighted explanation as to how the function works and what tasks it can perform, and the other written only in the language of the function that can be included anywhere at will. The organizing principle here is the same as above. You appear to be pushing me in the direction of efficiency. Efficiency with an important cost, namely, my organizational strategy that has served me so well up until now. I foresee a painful adjustment.
  12. How to Automate an HTTPRequest with PHP

    $verified = verify_email($_POST['email'], $_POST['verification_code']); if($verified) { $vars = [ 'title' => 'Something', 'name' => 'Something' ]; $to = $_POST['email']; $subject = 'Email subject'; $body = generate_template($vars); send_an_email($to, $subject, $body); } If I have understood correctly, you are suggesting the creation of three functions generate_template() send_an_email() and then a routine that executes the generate_template() and send_an_email(), if the value of verify_email is Boolean true. What I am unclear about is the nature of the following expression verify_email($_POST['email'], $_POST['verification_code']); Is verify_email() a function, an array, or an object or some combination of these? If it is a function, is it one that I can call independently of $verified. What would I be creating exactly. Roddy
  13. How to Automate an HTTPRequest with PHP

    INGOLME: I will need some time to figure out whether I can pull off what you are suggesting easily. Certainly I know how to write and implement a PHP function, but am known to run into problems of scope on occasion. Also, your suggestion confounds the verification process with the mailing process on the same page -- an idea that, from my most humble technological viewpoint, appears more complicated. The other connection (trigger) between my local form and remote processing page necessitates, of course, an HTTPRequest. There is no getting around this. JSG: Because the information required to send the email is produced on a different page. See above. Please read my BACKGROUND, TRIGGER, and DILEMMA notes carefully. I believe that the answer can be found there.
  14. How to Automate an HTTPRequest with PHP

    Excuse me, but what could be simpler than generating the template and email on the same page and not caring from where the instruction comes? Roddy p.s. Just to be clear, I am referring to the email that sends the newsletter, not the verification email that calls the generator to process the template and mail the letter.
  15. How to Automate an HTTPRequest with PHP

    My goal is to use the same page with directives from two different sources (triggers): one from the verification page that is on the server, and one from a form that is situated locally. A receiving $_POST variable on the generator page would not care from which source the request was made. Is it more understandable now? Roddy
  16. Sanitization of $_GET Superglobal

    Thank you, and have a great New Year! Roddy
  17. Sanitization of $_GET Superglobal

    BACKGROUND: It appears that there are few problems in web development that do not have multiple solutions. My problem is to decide which solution best suits my needs. I have a confirmation email that sends a name, hash, and email address via an HTTP REQUEST using the $_GET superglobal to a PHP file that matches the hash with an entry in a newsletter roster table. If the match succeeds the value of the status variable is changed from 0 to 1. Before the hash is sent to the roster table it is sanitized using the MySQLi real_escape_string( ) function. Elsewhere on my website I use the PHP filter_var( ) function with parameter values that vary with the nature of the data being sent. QUESTION ONE: In the above instance which PHP function would be more secure. And, why? QUESTION TWO: In general which function is preferred? And, why? Roddy
  18. Sanitization of $_GET Superglobal

    Could I reword the above statement to read, "When coding (positive) it is not what is coming in that must be sanitized; rather, what is being sent out. When hacking (negative) it is what is going in that counts." Please allow me now to restate my two questions. QUESTION ONE: When would you use the real_escape_string( ) function? QUESTION TWO: When would you use the PHP filter_var( ) WITH sanitization?
  19. Sanitization of $_GET Superglobal

    Now I am confused. What makes printing an HTML page so very different from processing data? Is it because Javascript cannot run, but in a browser context? Also, why not just sanitize when the data comes in. In this way, you can be sure that whatever goes out will be clean. Roddy
  20. Sanitization of $_GET Superglobal

    This I do. I am referring to the first receipt of the $_GET superglobal -- at the point where I am likely to take information from the variables contained within and seek to process it before uploading it to the database. Roddy
  21. Sanitization of $_GET Superglobal

    Merry Christmas to those at W3Schools who maintain tradition no matter their philosophical or theological persuasion. Roddy 🎄
  22. HTTP and HTTPS Compatibility

    Yes, you are right. I simply forgot to upload a block of files whose prefix I had changed on my test server, but failed to upload to my host server. Thanks! I simply could not bear the thought of having to do everything all over again. I feel so relieved. Have a great weekend! Roddy
  23. HTTP and HTTPS Compatibility

    BACKGROUND: Sometimes I believe that I will never launch my project. The reason for this doubt is clear. Each time that I believe that I have got everything right, I make a small change that i am told will make everything better, and I finish by having to redo much of what I have already done simply to make it work as it did before with the new feature. What keeps me going on the other hand is that I have always somehow been able to overcome each of these sorts of major hurdles. No wonder it has taken me 14 months just to be able to get where I have gotten. DILEMMA: In order to observe the issue that I am having you are requested to follow the steps below. Mind you, the result of the experiment appears to be the same no matter the browser. I have tried it with Chrome, Safari, and Firefox. Step 1: Using the http:// protocol open to the following splash page: http://www.grammarcaptive.com Step 2: Click on the Freeman. This should open to a page with two preceding splash pages Step 3: When the 2nd splash page opens, you should see what appears to be a frame with a series of frames in which each frame is still another set of frames. _______ Step 4: Using the https:// protocol open to the following splash page: https://www.grammarcaptive.com. Step 5: Click on the Freeman. This should open to a page with two preceding splash pages. Step 6: When the 2nd splash page opens, however, the nested sets of frames have disappeared. _______ DISCUSSION: Now, I have made what I believe to be a fairly thorough check for the presence of the https:// prefix on all pages that refer to a link containing Javascript that might influence the behavior of the splash pages in question. I suspect that by having changed the prefix from http:// to https:// that I have, at least for some pages, introduced new code that is no longer compatible with the Javascript code that I am using. My Javascript console tells me that the jQuery variable is missing. Any ideas? Roddy
  24. Interpreting HTML as PHP files Using .htaccess

    Thank you for your help. I was finally able to resolve the issue by adding the following code to my httpd.conf file. AddType application/x-httpd-php .php .phtml .html Roddy
  25. The following code was inserted into the root folder of my www.grammarcaptive.com site in the form of an .htaccess control file. It was also inserted into my test server in an identical location. Although it appears to work well on the remote server, it fails on the local test server. Only the paths leading up to the sites' root folders appear to be different. THE CODE <IfModule mime_module> AddType application/x-httpd-ea-php56 .php .html </IfModule> REMOTE SERVER PATH public_html/grammarcaptive.com/.htaccess LOCAL TEST SERVER PATH ../../Sites/grammarcaptive.com/.htaccess QUESTION: Could the above path differences be at cause, or might there be an APACHE directive of some sort getting in the way? If so, what directive is it likely to be, and where should I look for it?
×