I’m making some site which must be fully unicode. Database etc are working, i only have some small logic error. Im testing my register form with ajax if fields are valid, in email field i check with regular expressions. However if a user has a email address like 日本人@日人日本人.com it isn’t coming troug…
Tag: php
How to ban all executable files on Apache
I would like to find out the most effective way to ban any executable files from one specific sub folder on my server. I allow file uploads by users into that folder, and would like to make that folder accessible from the web. I have the root folder pretty much locked down with mod_rewrite. In that one unprot…
What is the advantage of using heredoc in PHP? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, …
PHP Time() to Google Calendar Dates time format
I have PHP times for the start and end times of an event. This is a simple <?php time(); ?> for some future date’s start and end time. I was wondering if anyone knew of a way to take either the numerical format (PHP time()) or taking some string value representing that time (I could do a strtotime…
Remove Category Base from WordPress Category URL
I fished around the internet for a solution to this, tried a plugin or two to remove the /category/ from wordpress url’s. While some of these plugins are good, the category link still display’s /…
Generating a random hex color code with PHP
I’m working on a project where I need to generate an undefined number of random, hexadecimal color codes…how would I go about building such a function in PHP? Answer Get a random number from 0 to 255, then convert it to hex:
PHP – How Detect if Output Buffering is Enabled
Is there a simple way to detect in PHP if output_buffering is enabled in php.ini? I’d like to be able to display a message if it is not enabled. Within my application I tried using an htaccess file to automatically enable it but it seems it does not work in all server environments and in some cases it g…
Remove the last character from a string
What is fastest way to remove the last character from a string? I have a string like I would like to remove the last ‘,’ and get the remaining string back: What is the fastest way to do this? Answer Contrary to the question asked, rtrim() will remove any number of characters, listed in the second …
PHPExcel Column Loop
How can I do a loop which based on Excel worksheet columns? I found (and used) WorksheetIterator, RowIterator and CellIterator but nothing about columns. Answer There is no ColumnIterator, so you’ll have to do this by hand. For any given worksheet: To loop rows for a column: To loop columns in a row, yo…
PHP Redirect with POST data
I did some research on this topic, and there are some experts who have said that it is not possible, so I would like to ask for an alternative solution. My situation: Page A: [checkout.php] Customer fills in their billing details. Page B: [process.php] Generate an invoice number and store customer details in …