The problem was solved: For other users that may have this problem – notice the encoding of the PHP file. If you use PHPExcel it must be ANSII encoding and not UTF8, otherwise the EXCEL will be downloaded corruptly. The Headers that were added (answer 1) solved the problem after i changed the encoding o…
Tag: php
Creating a very simple 1 username/password login in php
I want to make a single login for just 1 user without storing in a database but I can’t seem to get this to work. My code: login.php trylog.php Answer Your code could look more like: Now, when the page is redirected based on the header(‘LOCATION:wherever.php), put session_start() at the top of the…
Differentiate each apache user and give permissions
In a web application, I want to create a folder for each www-data user and give write permissions just on that folder, and just to that user. AFTER VALIDATION I can do: This will create a new directory with a random name, in the path $file->getPath() with all permissions to the owner user. But it would giv…
get two paths of images from database and loop them to display in slider
Im little bit stuck on a logic.scenario is i have a slider where two images are shown at a time taking 50%-50% part of screen,here is the simple html of it,
Get data from regular form inputs alongwith contents in div
I have a little email system on my wordpress site wherein people submit php generated content to me via email. Basically the content is generated within a div and then via a little javascript the div-content is mailed to me. I am skipping the part how it is generated in order to keep the focus on the main iss…
PHP find the days until a date
I have to find the number of days until a date in timestamp format (mysql db) My problem is that if date now is 2013-12-01 09:59:00 the days are 15 while datenow is 2013-12-01 10:01:00 the days are 14. How could I make a difference only of the days without the time? Answer Using the DateTime class: returns
Image in text line is slightly offset
I’m trying to make a clickable button by treating a hyperlink with CSS and adding a little icon next to it. Everything but one detail works great; namely the icons which are slightly offset from the text on the button. It looks as follows: As you may see, the white icons (12x12px) on the buttons are sli…
when it is required that a class will be defined before instantiation?
In the PHP documentation it says: Classes should be defined before instantiation (and in some cases this is a requirement). can some one give me a example of a class that can not be instantiated unless it was previously defined? Answer The parsing rules are the same as for functions: if they’re defined …
cronjob not running with codeigniter
I am sure the answer is right in front of me, but this is driving me crazy. I have searched high and low for the answer and can’t find it. Essentially I am trying to run a script through a cronjob …
PHP Methods and Class Design [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year. Improve this question Which design concept is better in PHP; passing variable to the function…