php

How to hide password in configuration files

Is there a way to hide my password for database access in my config.php configuration file ? What is the best way to do this ? I want to hide to visitors and hosting's admin :) ...

Duplicate entries on mysql on insert using doctrine

Hi all! I am facing a very weird problem with mysql and doctrine [with help of codeIgniter]. I am trying to make a simple migration script taking all records from one table and after a little process, saving them to another. However, on my laptop [running windows and wamp] I get double numbers of the original table records to have bee...

Unix tree convert to recursive php array

I have a response from remote server like this: /home/computer/Downloads |-- /home/computer/Downloads/Apple | `-- /home/computer/Downloads/Apple/Pad |-- /home/computer/Downloads/Empty_Folder `-- /home/computer/Downloads/Subfolder |-- /home/computer/Downloads/Subfolder/Empty `-- /home/computer/Downloads/Subfolder/SubSubFolder ...

How can I check if I made optimal mysql database?

Are there any ways to check whether my Mysql database and PHP script are optimal? I want to figure it out and fix if it's possible till I publish it on internet for many users. Thanks. ...

Replace string with incremented value

Hello, I'm trying to write a CSS parser to automatically dispatch URLs in background images to different subdomains in order to parallelize downloads. Basically, I want to replace things like url(/assets/some-background-image.png) with url(http://assets[increment].domain.com/assets/some-background-image.png) I'm using this insid...

In CakePHP, how do I create a form to list models within a date range?

I have a very simple model that includes the auto-filled field much like 'created'. (DateTime format). I'd like to use the Form helpers if possible, to validate the date fields and whatnot. I'd like a simple form with a "Begin Date" (YMD, 12 hours), and an "End Date" (same format). There is already a controller action set up as fol...

How do I enable mod_deflate for PHP files?

I have a Liquid Web VPS account, I've made sure that mod_deflate is installed and running/active. I used to gzip my css and js files via PHP, as well as my PHP files themselves... However, I'm now trying to do this via mod_deflate, and it seems to work fine for all files except for PHP files. (Txt files work fine, css, js, static HTML...

jQuery AJAX PHP JSON problem

Hi Gurus I'm facing the problem of receiving an empty array when I do an AJAX request in the following way: This is the code I'm executing in JavaScript: <script type="text/javascript" src="lib/jquery.js"></script> <script type="text/javascript" src="lib/jquery.json.js"></script> <script type="text/javascript"> $(document)...

Reset a LDAP Password with PHP

How can I reset a LDAP password in PHP? I already have a connection to the LDAP Server. ...

how to force apache to crash?

I want to test something when apache crashes. The thing I want to test involves Windows asking me if it wants to send an error report. Any way to make Apache crash and ask me to send an error report on it? Thanks ...

PHP create image to display email address?

Using PHP: How can I create an image to display an email address (to help reduce spam)? Meaning, if I want to display "[email protected]" on my web page, since crawlers can easily find that text - I want to display the email address as an image that says "[email protected]". How do I do that? I want the font to be: color: #20c font: 11px...

SQL query , whats this?

I never seen SQL like that before: SELECT * FROM !.tables WHERE id = ! What's it doing? ...

PHP Segmentation fault when started from crond

Hello, I've a php script that's started each minute from cron. It almost always runs without any problem, except for about 10 times within 24h. The times it fails I get a segmentation fault like: bin/sh: line 1: 21815 Segmentation fault /usr/bin/myscript The number after "line 1:" is always different. I'm running: PHP 5.2.6-1+l...

Problem with PHP localeconv() - Maybe UTF-8

I'm having an issue with the localeconv() in PHP. I'm using a Windows PC. I set my locale to France using setLocale(LC_ALL, 'fra_fra') function. Then I call the localeconv() function to a variable. When I output that variable, below is what I get. Array ( [decimal_point] => , [thousands_sep] => � [int_curr_symbol] => EUR ...

Using variables before include()ing them

I'm using a file, page.php, as an HTML container for several content files; i.e., page.php defines most of the common structure of the page, and the content files just contain the text that's unique to every page. What I would like to do is include some PHP code with each content file that defines metadata for the page such as its title,...

Creating Facebook Apps .. going mad

Hi, IU am trying to create my first Application running inside an Facebook Canvas/IFRAME. I am using Zend Framework (PHP) for this project. But I am not able to understand all the different ways facebook is offering. There is an PHP SDK wich works so far. There is an Javascript SDK and something called FBJS? Does someone know a good p...

PHP problem? Is this code correct for updating a txt file?

Hi I made a website that takes a value from the user and saves it to a text file. On my home PCs, it works great, and the data.txt file gets updated instantly. However, my friend says it is not getting instantly updated on his home PCs [he is using a Wi-Max connection]. It takes 1 minute to get updated for him. Is this problem a resu...

Is SQL used by PDO database independent?

Different databases have slight variations in their implementations of SQL. Does PDO handle this? If I write an SQL query that I use with PDO to access a MySQL database, and later tell PDO to start using a different type of database, will the query stop working? Or will PDO 'convert' the query so that it continues to work? If PDO does ...

How to cache pages using background jobs ?

Definitions: resource = collection of database records, regeneration = processing these records and outputting the corresponding html Current flow: Receive client request Check for resource in cache If not in cache or cache expired, regenerate Return result The problem is that the regeneration step can tie up a single server process...

Loading template with variables from form fields using jQuery & php

I am trying to create a form that generates an html template. I have the template in a hidden div on the page and am using jQuery to create a new window with the template html, but I can't figure out how to load the contents of the form fields into the template. I know I should probably be using AJAX, but I don't know where to start. ...