php

PHP - mail() function not working on my hosting

Hello, I have a simple script that works fine on any of my other servers, but on that one I need, it doesn't. <?php $mail = mail('[email protected]', 'My Subject', 'msg'); ?> I tryed calling the webhost provider, but can't reach them. Also tryed to google some advice, but nobody seems to have the same problem. The script doesn't sho...

How do I order subpages within my static ones in Wordpress.org 2.8.4 ?

I already applied a custom order for the toplevel navigation of my page, but it doesn't automatically sort the submenus alphabetically, although i assumed this behavior: Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it’ll be better in future...

Using proc_open function in PHP

Hello All, I am trying to execute a TCL script from PHP. I am using PHP's proc_open for the communication .But I am unable to get the result from the tcl script . Can someone go through the code and let me know where I am going wrong ? PHP code <?php $app = 'tclsh84.exe'; $spec = array(array("pipe", "r"), array("pipe", "w"), array(...

How can i unserialize a string?

I have a menu system that uses a drag and drop tree structure to make it easy for a user to modify. When the javascript serializes the string, it does it in the following way: // Assume each of these items has an ID on with the respective numbers attached Menu Item 1 + Menu Item 2 + Menu Item 3 + Menu Item 4 Menu Item 5 Menu It...

What is the best way, inside a controller, to know if the request is a XMLHTTP one or not (ZF)

I have different logic in an action depends if the request is an AJAX one or not. (For AJAX logins, I do not need to redirect after successful login, which is not the case in normal login, for example). What is the best way, beside checking the headers for X-Requested-With: XMLHttpRequest Is there a flag or something? ...

Best way to atomically create files

Hi SO, The 'best practice' (as I see it) to atomically create a new file, is to open a temporary file (using tmpfile()), and then moving the file to it's final location. However, this won't work well if the temporary file is on a different mountpoint, as this will result in the file gradually building up and additionally result in unne...

Pitfalls of automated file versioning?

I'm working on a file management system and would like to include an automated versioning such as bates numbering if a file with the same name exists. I thought of inserting a "-v0001" between the filename and extension and counting the number of versions as they come in. $basename = pathinfo($filename, PATHINFO_BASENAME); $fname = pat...

prototype ajax not properly executing query

So I decided to start using prototype and here's my first question. I'm trying to send out an ajax request to a php page which updates s single record. When I do this by hand (ie: typing the address + parameters it works fine but when I use this code from javascript: var pars = 'trackname=' + track + '&tracktime=' + time; new Ajax.Requ...

Type code in to a text input form, how?

Hello! i have this image upload script. <?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = "temporary_images/".$imagename; move_uploaded_file($sour...

How to extract citations from a text (PHP)?

Hello! I would like to extract all citations from a text. Additionally, the name of the cited person should be extracted. DayLife does this very well. Example: “They think it’s ‘game over,’ ” one senior administration official said. The phrase They think it's 'game over' and the cited person one senior administration official sho...

AMFPHP over SSL problem

I seem to be having a problem running AMFPHP under SSL in our development environment. I created a self-signed cert under CentOS and got everything working, but whenever I go to the page in Firefox I get warned that the certificate is self-certified and therefore cannot be accepted. This then seems to affect the AMFPHP calls from flas...

URL shortening: using inode as short name?

The site I am working on wants to generate its own shortened URLs rather than rely on a third party like tinyurl or bit.ly. Obviously I could keep a running count new URLs as they are added to the site and use that to generate the short URLs. But I am trying to avoid that if possible since it seems like a lot of work just to make this o...

PHP 5.3 support for strange '${}' code?

I've just upgraded to PHP 5.3 and started supporting an old website for a new client. It seems to use rather odd PHP code which I've not come across before. Whilst trying to access $_GET or $_REQUEST variables, the developer has used the following: ${"variable_name"} I get notices generated due to undefined variables (presumably becaus...

Widget Development: I need to develop a specific countdown widget

I have a client who needs somebody to develop a "countdown widget" for their main public website. It has to do with graduation dates. So, any customer not registered with the widget would see "Start your Graduation Countdown". Clicking on that would do something like provide them with an input form that includes name and graduation da...

Hunting down PHP parse errors

When writing PHP code, you can cause some really hard to track down parsing errors if you don't remember what parts you were editing previously. I'd be interested to hear about any insightful methods to hunt down these errors you may have discovered. Example: unexpected ';', expecting T_FUNCTION in someclass.php on line 877 This vagu...

Cakephp change URL behaviour

Hi, We are developing a site using CakePHP. We have a windows IIS server (shared hosting) with PHP5, that does not support .htaccess or mod_rewrite but still we have the site up and running and developed a lot of things. The current URL structure is something like this: mydomain/index.php/user/add We want to change this to something l...

How can I get Eclipse PDT to only show my code templates on CTRL-SPACEBAR?

In an earlier version of Eclipse PDT, when I typed e.g. "sh" and pressed CTRL-SPACEBAR, it showed me only my code templates which started with "sh". In the newest version I downloaded, it seems to be showing me every single method in every class which begins with "sh" which is too much. How can I get Eclipse PDT to just show me only my...

PHP autoloader: ignoring non-existing include

I have a problem with my autoloader: public function loadClass($className) { $file = str_replace(array('_', '\\'), '/', $className) . '.php'; include_once $file; } As you can see, it's quite simple. I just deduce the filename of the class and try to include it. I have a problem though; I get an exception when trying to load a ...

What would be a quick and dirty way to get PHP talking to java?

We have a php setup for our web pages that is secure with HTTPS. The web app talks to a DB but we also want it to talk to a java server we have. The java server is a standalone java application (not web). We simply want a callback action after the PHP page finished writing to the DB done in the java server. What is a good way for this ...

download file from ftp using php

I am trying to make a application in which admin will be able to see the files from particular folder(predefined) and should be able to download them one by one. The files will be stored on the server. Can someone guide me how to do this? ...