Hello, I have the following function to return a clean path for a script.
function cleanPath($path) {
$path = (string) $path;
$path = preg_replace(
array(
'#[\n\r\t\0]*#im',
'#/(\.){1,}/#i',
'#(\.){2,}#i',
'#(\.){2,}#i',
'#('.DIRECTORY_SEPARATOR.'){2,}#i'
),
array(
'',
...
As a company specialized in developing custom CMS, we have been asked to deploy a open source CMS in our next project.
We are free to choose a system. What would you recommend for a team familiar with MVC model and OOP in PHP5?
I was told that Drupal and TYPO3 are very hard at the beginning, so what are the other options? eZ Publish o...
Need help (or an example) as I don't seems to be able to invoke jquery datepick or nicEdit when using XMLHttpRequest.
My code comes with 4 php files:
Main page: main.php
++++++++++++++++++
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www....
I have a ciphertext, encrypted in 3DES CBC mode, and I'm having some trouble decrypting it. I have the following information (not actual values):
<?php
// Three 16 character long keys
$key1 = '1234567890123456';
$key2 = '6543210987654321';
$key3 = '6549873210456123';
// The initialisation vector
$ivec = '0102030405060708';
// A token ...
Hi. I have a simple html page that only uses PHP in two places
<?php preg_replace('/(www\.)?([^.]*)\.(com|info)/', '${2}', $_SERVER['HTTP_HOST']); ?>
<?php echo $_SERVER['HTTP_HOST']); ?>
In page is loaded on multiple domains, and I just want to display the host name as text in some other static content
I'd like to remove the need fo...
I'm trying build a regex that will replace any characters not of the format:
any number of digits, then optional (single decimal point, any number of digits)
i.e.
123 // 123
123.123 // 123.123
123.123.123a // 123.123123
123a.123 // 123.123
I am using ereg_replace in php and the closest to a working regex i h...
Hello,
I have an input box which i use to add items to a table in the db.
It looks like this:
<td>
<form class="insCat" action="#" name="insertCat">
<input name="categorienaam" type="text">
<input class="insert" type="submit" value="nieuwe categorie">
</form>
</td>
And i handle it like this in jquery
jQuery(".insert")...
We are using the Zend Router and it seems that its overwriting the parameters that are sent by forms. The only parameters that arrive to the controller are the params from the Url.
Does anyone know why this is happening?
Here is the config file:
; Routing config
routes.groups.route = groups/:group/:type/:idPost/:postUrl/:page
routes...
Hi , i have an large SQL Statement, is there any "smarter" way to format this stuff ??
$serverFields = 'SERVER_ID, SERVERNAME, SERVERLOCATION_ID, SERVERLOCATIONDETAIL_ID,
SERVEROS_ID, SERVEROSVERSION_ID, IP_BACKEND, IP_FRONTEND, IP_BACKUP,
SERVERREMOTETOOL_IDS, LOGIN, DESCRIPTIO...
Is there a way to optimize the following PHP code so that I can only use preg_replace and not preg_replace+substr?
$type = substr( preg_replace('/([^a-z])/', '$2', strtolower($_GET["type"])) , 0, 3);
...
How do you call a JavaScript function from one PHP file that is defined in another PHP file?
...
I have two tables that i am inserting records into. I am using PHP to execute the sql query to perform the operation. When performing the insert operation, i insert 10,000 new records in two tables. One table completes insert process successfully on all operations while the second table completes the first insert operation but stops the ...
Hi All,
How to correctly deploy applications from development to production and how to deal with multiple site configurations.
All my development are done thru svn located at var/svn/myapp/trunk and
the actual production code is in /var/www/myapp.
I check out the latest code to my local machine into a directory called "myapp_latest_sv...
I have a database class which is constructed so that it opens a connection to the database when the first query is run. Should each of the other classes, used for the site's users, groups and so on, create one database object each? This makes the classes easy to deploy elsewhere; they will only depend on the database class. This will how...
I'm at a crossroads, not exactly sure what is better to use. Right now I'm using sessions arrays to store calculations on the fly, but I need to switch to objects because I would like have some functions. But I was also considering using ajax and insert the data on the fly back and forth to the database but I'm worried it might be to man...
My first question on SO, thanks. :)
I'm developing a support issue logging system for my company and it must allow for files to be uploaded aswell as any problems submitted to our database.
There could be from 0-6 different uploads to check, along with a support issue. I've managed to get an accurate variable of how many files there is ...
I've been trying to research a safer way to implement Cufón that would store the actual font data in a MySQL database that could be queried and returned when necessary, without having to store the converted .js file on the server (and break EULA).
Is this even possible? I'm still in the beginning stages of testing this out.
I've alread...
In the same way that you can generate specific content based on browser type is there a way to generate specific content based on the server running PHP without reference to the server or site name?
For example, a way for PHP to automatically detect the environment it was in and configure things like DB connections, ini_set for errors e...
$modules = array(
'home' => 'home',
'login' => 'login',
'forum' => 'forum',
'topic' => 'topic',
'post' => 'post',
'profile' => 'profile',
'moderate' => 'moderate',
'search' => 'search',
'ucp' => 'usercp',
'ucc' => 'usercp',
'pm' => 'pm',
'members' => 'members',
'boardrule...
I need a way to count the number of pages of a PDF in PHP. I've done a bit of Googling and the only things I've found either utilize shell/bash scripts, perl, or other languages, but I need something in native PHP. Are there any libraries or examples of how to do this?
...