php

Is it possible to upload files from FTP to FTP using PHP

Hi Here is my prob in Brief. I know how to upload a file to server using FTP with programming language PHP. But is that possible to get files from another server to our server using PHP with having the FTP Username and Password Thanks n advance... Fero ...

Problem having lots of databases?

We have built a hosted web application, that is developed in a way that each customer is connected to an individual database. This application is a web plattform/publishing system, and has been working very well so far with this design. We also have a main database. Now we are about to make some changes in our pricing model, which would...

Priming read for PHP Query

I am new to PHP and working on my own CMS for a project. Mostly to just give myself a project to learn the language. The CMS is working but I am just tracking down some bugs in it. So here it goes... I am trying to list all of my published articles for each section. It does this correctly but I am having an issue in the code statemen...

Finding out where curl was redirected

I'm using curl to make php send an http request to some website somewhere and have set CURLOPT_FOLLOWLOCATION to 1 so that it follows redirects. How then, can I find out where it was eventually redirected? ...

Return a 'DESC package' in PHP using OCI

Hi I am trying to get information on an Oracle package directly from PHP using OCI8: $sql = 'DESC my_package'; $stmt = oci_parse($conn, $sql); oci_execute($stmt); this returns: Warning: oci_execute() [function.oci-execute]: ORA-00900: invalid SQL statement in /oci8_test.php on line 16 I know the command works as I tried it in SQL...

Implementing RFC 2369's "List-Unsubscribe" in PHP website - should I send confirmation?

I'm trying to implement RFC 2369's "List-Unsubscribe" in a PHP website which sends out daily updates by email. I'm planning to use the HTTP option only since this can be implemented simply in PHP code. My question is this: Once the user is unsubscribed, is it ok to send out a confirmation email, like "unsubscribe successful"? Or will t...

Advanced PHP Polymorphism question

Hey guys! I have a class which has a function to retrieve children elements from a database. The following code will be rather pseudo cause I want to keep it as easy as possible. abstract class SomeHostObject extends SomeObject { function getChild($identifier) { global $database; $id = $database->select('Some MySQL Quer...

cakephp retrieving multiple values in a column

I want to retrieve multiples values from a field. the code I am using this this $conditions = array('Tag.name'=>$compare);//$compare = array('value1', 'value2',..); $values = $this->find('all', array('conditions' => $conditions)); But It keeps coming out like this SELECT `Tag`.`id`, `Tag`.`name`, `Tag`.`count` FROM `tags` AS `Tag...

Tell from where a .php file has been included?

Does anybody know of an automated way of telling whether a PHP script is being called directly (as a HTML page), or as a JavaScript, or as a CSS Stylesheet? Without GET variables, or setting a flag in the file ( that is what I am doing right now). Just curious. EDIT: Some background because it was asked for in answers: The reason why...

how to send zipped (ASCII) data in an HTTP response from PHP

I am writing a service that sends data as a response, to a client. I am sending text (PLAIN ASCII) data, but I want to compress the data first (uzing any of the standard compression routines), and then send the compressed data back to the server, using the header() function etc. I am relatively new to PHP so having gathered the data, I...

Make an object searchable with array_search in PHP

Hi, I would like to make a class in PHP such as it would be searchable with PHP native method array_search. Currently my class implements IteratorAggregate and Countable, which allows me to do foreach on it. There is a couple of other SPL interfaces (SeekableIterator, ArrayAccess, etc...) which seems to maybe fit, but I would like to k...

How to reverse bits of a byte ?

Best in PHP, for example, 11011111 ==> 11111011 ...

PHP directory list from remote server

How can i use opendir function to read the directory list of a remote server knowing its IP address? ...

Performance-oriented way to protect files on PHP level?

I am looking for some input on something I have been thinking about for a long time. It is a very general problem, maybe there are solutions out there I haven't thought of yet. I have a PHP-based CMS. For each page created in the CMS, the user can upload assets (Files to download, Images, etc.) Those assets are stored in a directory, ...

How to order pages in CMS?

I wrote a simple CMS for one of my clients which does specifically what he needs (without the bloat of mainstream content management systems he would never use). The CMS enables him to create and manage two types of content: pages and news (short messages that show in the sidebar). The pages are displayed in the navigation menu of the ...

How to set a timer in PHP?

For example, my goal is to test the code given here: http://stackoverflow.com/questions/863268/php-script-that-reports-progress-to-client <?php waitalittle(); echo 'Task one finished'; flush(); waitalittle(); echo 'Task two finished'; flush(); ?> My objective is to create the waitalittle() function, which should take 5 seconds to ...

Working back a regex to form new input strings

Hello; I have a regular expression like: '/items\/a=(0-9)+\/b=(0-9)+/' which matches urls like: items/a=5/b=5, items/a=11/b=9 etc. (I hope the regex is correct, but please do not mind if it is not) What I want to be able to do is injecting values back into this regexp so lets say I have a=99, b=99 for values and I want to work out t...

Insert record failing! php mysqli

Hello, i have a mysql database... CREATE TABLE `applications` ( `id` int(11) NOT NULL auto_increment, `jobref` int(11) NOT NULL, `userid` int(11) NOT NULL, `q1` text NOT NULL, `q2` text NOT NULL, `q3` text NOT NULL, `sub_q1` text, `sub_q2` text, `sub_q3` text, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TI...

Cakephp console (bake) on Mac OS with Mamp : database connection error

Hi I am trying to do the Simple Acl controlled Application tutorial in the cakephp cookbook. The idea is : Making Databases CREATE TABLE users ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL UNIQUE, password CHAR(40) NOT NULL, group_id INT(11) NOT NULL, created DATETIME, modified DATETIME ); ...

Can we alias a function in php ?

is it possible to alias a function with a different name in PHP? if yes how ? suppose we have this function sleep(); is there any quick way to make an alias called wait(); without writing this code function wait ($seconds) { sleep($seconds); } ...