Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Jimity

  • Rank
  1. Hi All, I'm using some of my own PHP coding in conjunction with a WYSIWYG website program (to save time) which uses inbuilt controls to allow me create a solution. Everything compiles fine and works, however I find I need to manually edit some of the compiled / created files with custom information / settings etc in order to make things work better (this is due to the rigid structure of some of the pre-built controls I am using in this program). Anyway, I'm looking to create a PHP script that will go into the files that need manual editing and make the changes for me. I'm doing well so far, reading in the required file, and using the string replace command etc as a prototype, however I need to change a php variable string in one of my files to read as a session variable string. E.G I need the string "$Variable" in the file to actually say "$_SESSION['sessionvariable']" instead. Can anyone help me with a piece of code that may be able to do this ?
  2. Not to worry. I fixed it. I've added some PHP coding to prevent caching. Combined with one or two sleep commands to stretch things out a bit, it shows the embedded image in the html whilst deleting the customised source files.
  3. Hi All, This is related to a previous post I have made in that its got to do with the same solution. I have an HTML form with a PHP backend. The form takes in user data, and the PHP takes that data as variables and populates a series of source HTML files etc (which includes the same image files universally) where placeholder variables are located. These source files are copied from a source template location in order to keep things simple. Essentially its so I can create a customised HTML solution (with embedded images) for each specific end-user. On a Windows Browser client the customised solution and its source files are placed in an archive and pushed to the end-user as a download for them to then process locally on the Windows client. At the end of the download, all the customised source files, and the archive, are deleted. Thsi works 100% as intended. I also need to take into account non-Windows clients though. On clients such as iOS/MacOS/Android I currently have the customised HTML solution displaying to the end user directly in the browser (its a stepping stone towards a better solution later down the road). I then complete some cleanup work to remove the customised source files (which have been copied from a source template location as well). The problem I am having is.: The HTML file displays within the browser as intended. Unfortunately though the embedded image within this HTML file is not displaying. I've worked out its essentially because the HTML file and its source files (which includes the embedded image file) are being deleted as part of my cleanup work at the end of my PHP. Whilst the HTML file displays on the end users browser in time before this cleanup work, the image file is being deleted before the browser essentially receives it to be displayed, creating an empty box on the HTML where the image should be. Can anyone help me with some coding that could essentially delay the start of my cleanup work in the script until the HTML file and its embedded image have been loaded on the end-users' browser ? I've tried sleep() commands, flush() commands, and ob_flush() commands without any success.
  4. Apologies for the delay in replying. I fixed it with a bit of ugly coding Basically I've shown the HTML file contents, and from that I've run a meta tag calling (a second later) the PHP coding (in a seperate file) that starts the download. Its ugly IMHO, but it works I now have another issue, but I'll start a new post for that
  5. Hi Scootstah, The good news is its fixed. Well . . . sort of I ran the code in my script as you recommended. It found problems with session_start. Even though it was at the top of my code, there were spaces there, so I removed all spaces and placed it at the very top of my code. This led me to a new error though.: Cannot modify header information - headers already sent. After doing a lot of reading up on this one, and not believing it could be true, I found the php file was being encoded with Byte-Order-Mark, which was causing this error. After downloading Notepad++ and re-saving the file, I'm now happy to say it works. The file comes in as a download rather than its binary contents displayed within the browser. Now I have a new problem though. . . The HTML that makes up the success message within this file for the end user is not displaying. Instead, the original form stays on screen, with the file download taking place. As I dont have any header coding for downloading the file in the original (starting) form page, I know the browser is going to my success message page. I just cant get the text of that page to show. Should I make a new post for this problem ?
  6. Hi Scootstah, I've moved this PHP coding to the very top of my page and turned on Error Reporting. Unfortunately no errors come up and I get the same result
  7. Hi All, I'm hoping someone can help me out on this one. I cant seem to figure out why its happening. I have a HTML/PHP form that takes in a series of user input and populates them into a series of placeholders within some source files. Those source files, edited with the placeholders, are then to be saved as new files and archived into a zip file which is sent to the user as a download. Everything up to this point, the saving of the new source files and creation of the zip file, works fine. Next, I want to display a new page with a success message to the end user, which in turn starts the download of the zip file. In order to carry the name of the file between pages I'm using $_SESSION. Rather than downloading the file though, the binary content of that zip file displays within this page along with the success message. The file doesn't download. Below is the coding (I've done shortened variations of it with the same result). If I run this coding, or shortened versions of it, within the original HTML/PHP form page (without a success message page) it works fine. Can anyone help me out with where I'm going wrong ? $myfile = $_SESSION['zipfile']; header('Content-Description: File Transfer'); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename='.basename($myfile)); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($myfile)); readfile($myfile);
  • 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.