php

What is the correct HTTP status code to send when a site is down for maintenance?

Is there a HTTP status code to tell Google (and others) to go away, index me again later? Basically, one that semantically tells clients that the site is down for maintenance? The ones I have considered are 304 => Not modified 307 => Temporary redirect 410 => Gone 503 => Service Unavailable I'm leaning towards the last one, but was ...

Codeigniter - how to use the foreign keys from one table to look for the id's of another table.

I'm having a problem trying to wrap my head around how to query the database to retrieve the foreign keys in my Nav table and then using those to find the id's in the NavItem table. Can someone point me in the right direction or give me some pointers? i'm not even sure if this should be done in the model or the controller! Thanks in adv...

Using php variable inside a wordpress page through admin interface

Hi, I have a wordpress page in which i have a form(used machform which redirects & stores data in session) submitting it redirects to another wordpress page. Now i want to use session value in the second page. I am new to wordpress, can i use php tags inside a page through admin interface so that i can retrieve the session value? Pleas...

how to enable mod rewrite in lighttpd

Hello , i need to enable mode rewrite in lighttpd it should no display the index.php extension .... ...

how to call another classes method from within a class?

here is my setup. class testA { function doSomething() { return something; } } $classA = new testA(); class testB { $classA->doSomething(); } this wont work inside that class.: $classA->doSomething(); how else would i do it? ...

Backup cPanel with PHP and upload to another FTP

I have a php script to backup automatically cPanel and upload the .tar.gz concurrently to an FTP server. The script works fine. The script requests the file then starts the ftp transfer and when the upload is complete it send also a confirmation email. The only problem is that even if the backup is, for example, of 1GB the uploaded fi...

Zend Router various URLs

I would like to achieve something like this with ZF router. ('controller' => 'products', 'action' => 'index') //Show product details 'http://mydomain.com/en/products/category-1/subcategory-3/product-name.htm' //List products in subcategory-3 'http://mydomain.com/en/products/category-1/subcategory-3.htm' //List products in category-...

Webcam Integration with php

Hi, I need to integrate the Web cam to the application. I need to take the user profile picture using the web cam. How can i do that. any one can help me? Thanks in advance, ...

design-pattern libraries ready-to-use?

symfony has released some of their components free to use outside the framework. i have used the event dispatcher and dependency injection...they are awesome! i wonder if there are other components/libraries (from other frameworks etc) that in the same way help you manage various design patterns? eg. decorator, facade, singleton, chai...

File upload issue

I am working on a PHP based, ticket management system. While creating a ticket, one can upload an attachment. I want to put a limit (say 10 MB) per file upload. To implement this I plan the following- 1. In php.ini set post_max_size = 10M 2.In PHP script which receives the POST- Since the file is larger than post_max_size, $_FILES[]...

MySQL Grouping of data

I want to group my data by Age and by gender: like this sample data: Age: 1 Male: 2 Female: 3 Age 1 Total: 5 Age: 2 Male: 6 Female: 3 Age 2 Total: 9 How can I group the data according to age and count all the male and females in that age from mysql database? ...

phrase split algorithm in PHP

Not sure how to explain. Let's use an example. Say I want to split the sentence "Today is a great day." into today today is today is a today is a great today is a great day is is a is a great is a great day a a great a great day great great day day The idea is to get all the sequential combination in a sentence. I have been thinkin...

How to make flash file not downloadable?

Hey friends, I want that my flash file on my website, can't be downloaded by anyone. Is there any way that i can do that? As Firefox and many browser has many add-ones which easily detect out flash content and after they can download the flash file? ...

2 IP are stored for a visitor : PROXY ?

Hello, on my database i've decided to store IP of the visitors who answoers to polls. It's all working, but there is only 2 cases where not only 1 IP is stored, but there is 2 SAME ip for the same visitor MySQL output (i replaced 2 numbers by XX) 10.188.XX.129, 10.188.XX.129 Here's the script to recieve the IP of the visitor : ...

Advice on simple efficient way to store web form data when no db/auth required

Hi, I have a situation where I need to provide an efficient way to process and store comments submitted via a web form. I would normally use PHP and either MySQL or XML to store the data, but this is slightly different in that this web form will only be temporarily available in a closed LAN environment, and all i need to do is process th...

Recursive function for copy of multilevel folder is not working.

Recursive function for copy of multilevel folder is not working. I have a code to copy all the mulitilevel folder to new folder. But in between I feel there is problem of proper path recognition, see the code below.. <?php $source = '/var/www/html/pranav_test'; $destination = '/var/www/html/parth'; copy_recursive_dirs($source, ...

Serving a file download using PHP

Hi, First PHP project and I'm stuck! I wish to allow users to click a button or a link and download a file. However, my PHP must first perform some tasks, choose the right file, record the download event in a db etc. This I can do, but how do I then send the file as a response to the user's click? Thanks for any help. ...

Custom data forms in CakePHP

I'm building a controller to manage group based ACL in CakePHP and when I create or edit a group I want to be able to select what permissions it has. The group data table only stores a group ID and a group Name as the permissions are stored in the ACO/ARO table. I have an array from the ACO that I want to turn into a set of checkboxes s...

What value to use for include_path in .htaccess

Currently in my .htaccess file I am setting include_path such as this: php_value include_path /mnt/webs/mysite/includes:/usr/share/pear However this isn't great if I need to put my sites on a new server as I need to go through a whole load of sites updating each .htaccess. Basically would like a way to basically say "use the folder c...

FFMpeg Error av_interleaved_write_frame():

this my code . after running php code FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --en...