i have downloaded some php files (it's a content management system) but i can't open them. it appears that they contain binary data. this is what i get when i open them using a text editor:
Zend20020623011793334417xù
ں2ف=كڈإ™m{Orvƒًè¢9 ف]UفU0زع^ہ€eo.’ذî™éفïىجhzcëن7,xAœگrBBو$89¯‘<"ٍs~±B¤كغتزZء¤ص€1cXû‡ûû×O¦أل¼\آ=o…ر¨ّzـ;^´>®é3ُéJہإً_±w[ƒٍµhيŒٍE6Ovئس~:.$َügLk,{+»9*گ~m.إ5طû¤ْW%&&aد؛fجMe´?›خة<ƒط<_$o¦َ—Q^4ûJ§{ç/صg}u¥kڈnFق0غM2#5شl\ظو›—.©3 ق?h+<Wٍ9LkئPïھة¤4ےbإ9…ھ â8”8'´‘گwٍشQf~[أيBى}VC‘ هNç،Œح]ڈق~[ƒ‰ف:ô¾6Wںنüو–¤£ôُe½ئـة÷g%ت»®-ىلƒپآڈUˆ%©يئ‘B~نKٍ©,ةgڑCLاcپء¼اثYiآ9†ںئأ,?5طفمjک'g»³²ص_Jں&÷èQM+ƒZS=c¾03¥–xwجMB~TN±‹`قƒ²
(there is much more, about 50 lines)
what is this? i have never worked with Zend, is it some kind of compression? how can i open and edit these files?
This file appears to be encoded by Zend guard. You probably cannot decode it.
Here is something you can read on http://www.zend.com/en/products/guard/
Encoded PHP file. Protecting their source code
Related
I followed this tut :
http://klewos.wordpress.com/2010/04/16/using-php-to-fill-a-word-document-quick-tip/
and all is fine till i open the downloaded .doc into libre office,
instead of outputing the doc content, it shows the full xml code as content !
Just note that i would prefer to create a PDF as final document but it seems easier with doc
I should miss a step with the xml to doc ?
if someone sees a better way to do this kind of thing (my base doc is 10 pages long so i don't really want to create a line by line pdf)
Anyhelp is welcome ;)
The article does mention that particular situation:
I’ve tried to open the Word 2003 XML document in OpenOffice.org 3.1.
Unfortunately, Writer wasn’t fooled by the .doc extension and opened
the document as plain text. Only after changing the document’s
extension to .xml, the editor opened it correctly. So, the documents
are portable after all.
How would i generate a file of all of the following types:
.js
.css
.html
I would also need to be able to read the file and overwrite it somehow.
Is this possible in anyway?
All of these files are just text files with different file extensions so if I could maybe make a text file and change the file extension?
As all of those are simply text files, all you need to do is create/open the file with the desired name and write text into them.
Check out some of the PHP file IO commands:
fopen()
fread()
fwrite()
fclose()
PHP is usually (often?) used as a templating language, where HTML "files" are generated "on-the-fly" and output directly to the browser.
I could be wrong, but it sounds like you are talking about generating files and saving them to disk to be served statically to the browser later. If that's the case, you're right - they are just text-files - so writing them as text-files with the relevant file extension should work.
This seems like it would be logistically complicated to manage as a site scales though. Also - if you're creating an web-interface to edit files on the server, while some CMS-es do this (Wordpress for example), it does come with a lot of security issues (allowing PHP unrestricted write access to your server is rarely a good move).
I've found library in php called moovrelocator.
Description from it's site:
MOOV Relocator is a well documented small library written in PHP to relocate (or move) the MOOV-Atom of MP4-Files from the end to the beginning of a file.
And it works pretty well with php.
Unfortunally I haven't found such library in python. And I want to ask community. Is there any library with which I can replace php-moovrelocator?
Quicktime/MP4 Fast Start
Enable streaming and pseudo-streaming of Quicktime and MP4 files by
moving metadata and offset information to the front of the file.
Usage
$ qtfaststart.py infile [outfile]
If i had a text file on my web server, which contains full PHP code, all properly formatted, could i use PHP fopen to read the text file and echo the output of the PHP to the browser. Ie. Run PHP code that is held in a text file rather than hard coded?
Thanks
It's perfectly possible to do this (it's just another file after all), although I'd be tempted to directly include it rather that messing around with fopen/eval, etc. (N.B.: The file would of course have to be "fully formed" and begin with "<?php", etc. for the include to work.)
However, I'd be very wary of naming the file with a .txt extension as this will mean that it'll be possible to browse the contents of this file directly from the browser if it exists in the public HTTP docs area. As such, why not simply write the data into a .php file - this will be no more difficult than a .txt file and offers the advantage that it always be parsed by the web server if someone attempts to access it.
You can read in the file as you suggested using fopen you can then execute the string that is read in using eval. I wouldn't recommend this. Try another solution to what ever the actual problem is.
I am storing files into an image field in SQL server storing the string in hex after converting into using:
unpack("H*hex", $datastring);
If I read from the database and write to a file, then open the file locally I can open it up just fine. But if I try to send the file as an attachment to the browser the file becomes corrupted and unreadable. Currently, the files in question are PDF and MSWord documents.
I am setting content-type to the appropriate MIME type for the files and setting content-disposition to attachment. I've tried various ways of streaming the file including dumping the string directly from the database and writing first to a file then reading the file (either line by line or with readfile()).
I am using a slightly customized version of the Zend framework, but I'm not sure if that is causing any issues. What should I do to send files to the browser?
How do you serve them?, in theory if you are using MVC, you need to disable the view at the end of your controller to avoid extra content being inyected at the bottom of your file.