php

phpDocumentor to wiki?

My company is working on end user/developer docs using mediawiki. I'd like to take a lot of the API docs that phpdoc spit out (for specific functions/methods) and have it in wiki markup for easy transfer. Any solutions out there for getting wiki markup or wiki output from phpDoc? I've looked around and found nothing. ...

PHP can't read files containing PHP code as text files

I've stumbled upon the following pecularity: $handle = fopen(realpath("../folder/files.php"), "r"); can't read a file, but as soon as I remove php tags from the file, it becomes readable and my scripts prints non-empty file content on the page. Also, file.php is never ever executed, so I wonder why it is the problem. I guess somehow A...

Problem with Lucene- search not indexing numeric values?

I am using Lucene in PHP (using the Zend Framework implementation). I am having a problem that I cannot search on a field which contains a number. Here is the data in the index: ts | contents --------------+----------------- 1236917100 | dog cat gerbil 1236630752 | cow pig goat 1235680249 | lion tiger bear n...

Duplicate explorer/outlook type application on a web page

We have an ancient application that basically duplicates a file explorer, outlook style application in html (menu and toolbar on top, tree on the left, gridview on the right, and yes I know it is a bad idea to bring desktop UI to the web, but it was 2000 and seemed like a good idea at the time). The main problem (other than the HTML is ...

How do I use multiple foreign keys in one table referencing another table in cakephp

Using cakephp, I have a generic address table, which I want to link to customers, vendors, contacts. most of the tables only have a 1 to 1 relationship, but I want my customers table to have 2 perhaps for clarification: I have a customers table id, int mailing_address_id, int billing_address_id, int and an addresses table id,int add...

php/SQL: ORDER BY or sort($array)?

Which do you think is faster in a php script: $query = "SELECT... FROM ... ORDER BY first_val"; or while($row = odbc_fetch_array($result)) $arrayname[] = array( "first_key" => $row['first_val'], "second_key" => $row['second_val'], etc... ); sort($array...

PHP Set time to Pacific daylight saving time

In a PHP site, I have the current time setting: D j M Y, G:ia How do I change that to reflect current pacific time with the daylight saving time? ...

Need help displaying xml as html

I'm trying to use the Macromedia XSLTransform class to convert XML returned from Amazon Web Services to HTML. Here's the PHP page that calls the transform: <?php require_once('includes/MM_XSLTransform/MM_XSLTransform.class.php'); $restquery = "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&amp;AWSAccessKeyId=[myid]&amp;...

How can I execute a PHP script from Java?

I have a php script which is executed over a URL. (e.g. www.something.com/myscript?param=xy) When this script is executed in a browser it gives a coded result, a negative or positive number. I want to execute this script from Java code(J2EE) and store that result in some object. I'm trying to use httpURLConnection for that. I establis...

PHP: PEAR: Encrypting with Crypt_CBC, Decrypting with Perl's CBC

Hi, One of the tasks I have to do needs me to encrypt something from PHP's side, and then decrypt it with Perl. The PEAR module I've found which appeared to be suitable for my needs was Crypt_CBC. However, there must be something I'm doing wrong or do not understand, as I've been unable to achieve getting the correct results so far. ...

How to determine the "number of pages" most effectively?

Hi! I hope I'm not writing a duplicate, but I haven't found anything that answers my question. (Although it seems to me to be quite common problem.) The problem occurs in nearly every web project: You have a table with many many entries and want them to be displayed on single pages. Now I wonder what's the best way to compute the num...

PHP install script - Codeigniter

Hi all, I have an application developed with codeIgniter that I would like to write a nice user friendly install script for. The biggest problem with this is that code-igniter needs configuration manually before this can happen, does anyone know a way around this / the the best way to allow this with minimal configuration? ...

How can I follow and fully report on a chain of symlinks?

What are the best tools/programming-techniques for following a complicated nesting of symlinks and completely capturing and reporting on every symlink along the way, including those in the middle of a path (See below for more info). Here's a specific example. Consider the following output from a shell command ls -l /Library/Java/Home...

Implementation: How to retrieve and send emails for different Gmail accounts?

Hello all, I need advice and how to got about setting up a simple service for my users. I would like to add a new feature where users can send and receive emails from their gmail account. I have seen this done several times and I know its possible. There use to be a project for "Libgmailer" at sourceforge but I think it was abandoned. ...

What functions do I need to keep an eye on with 3rd party access to my server

I am normally responsible for all scripting on web-sites running on my server, but some of my clients have other people working on (parts...) of their sites. When I give access, they can use php, so I regularly check if they seem to be knowing what they are doing, blocking people when they are: using mail() without proper input filter...

PHP base64_decode C# equivalent

I'm trying to mimic a php script that do the following : replace a GET vaiable's every space with a + sign ($var = preg_replace("/\s/","+",$_GET['var']); ) decoding to base64 : base64_decode($var); 1st i added a method perform a base64 decoding : public string base64Decode(string data) { try { ...

Scan PHP uploads for viruses

I'm currently using the following code to scan files that have been uploaded as part of an application form: $safe_path = escapeshellarg($dir . $file); $command = '/usr/bin/clamscan --stdout ' . $safe_path; $out = ''; $int = -1; exec($command, $out, $int); if ($int == 0) { // all good; } else { // VIRUS!; } It works, but is s...

How to open an Excel file in PHP?

How can an excel file be opened, all cols/rows read in an array etc the same way .csv files can be? Is there any built in libraries/classes for that in php? ...

Codeigniter: How to do a select (distinct fieldname) MySQL query

I'm trying to retrieve a count of all unique values in a field. Example SQL: SELECT count(distinct accessid) FROM (`accesslog`) WHERE record = '123' How can I do this kind of query in CodeIgniter? I know I can use $this->db->query() and write my own SQL, but I have other requirements that I want to use $this->db->where() for, and if...

Don't get the glob function in PHP

http://php.net/glob The documentation page on glob() has this example: <?php foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ?> But to be honest, I don't understand how this can work. The array produced by glob("*.txt") will be traversed, but where does this array come from? Is glob(...