php

How do I detect when an input is changed?

Via JavaScript, PHP, or HTML. I want to do this to check if a username is allowed (on our side). Sorry for not elaborating too much. If the username is too short, a message will appear next to it (I will do this part) saying that it is too short, but for this to be done automatically I would need for it to be detected. <script type="te...

phpprobid mod development

Does anyone know where I can find documentation or a tutorial that shows how to write a mod for phpprobid? ...

Can something "bad" happen via img src?

I know, I know, title is quite bad, but I'll try to explain what I mean here. So, I ask my members to show their photos. They upload it somewhere, then paste their photos' URL into input and I save it to my database (MYSQL). Then, the photo is being seen on their profiles. I get the URL from database and do something like that: <img src=...

Single PHP "exit;" statement prevents HTML5 video in Safari

Bizarre bug: in a PHP script that serves video files, I have a few test conditions (authenticate token, make sure file exists, etc.) before sending a "video/mp4" header and outputting an MP4 file. If any of the tests fail, $fail is given a non-false value. At the end of the tests there's this if statement: if ($fail) { exit; } T...

Displaying part of a controller in a layout/view

I'm using CakePHP and I have a component I wrote that uses a component called "Users" to handle users login, logout, registration, etc. I would like to render that on the default.ctp layout in a sidebar. How can I do this? I tried: <div id="leftNav"> <div id="login-block" class="block"> <?php echo $this->element...

session data not being written to database

The site I'm renovating writes session data to their database using the session_set_save_handler function as follows: session_set_save_handler (array(&$ses_class, '_open'), array(&$ses_class, '_close'), array(&$ses_class, '_read'), array(&$ses_class, '_writ...

Why can't php be totally safe?

Very simple question. Why php can't be totally safe? Is it really not possible to create a web language which can't be broken? ...

Calling a Python program from PHP.

I've got a version of the A* algorithm that builds a graph of the UK road and cycle network in Python lists. It takes about 30 seconds to initialise, but once done can very quickly find the shortest route between any two vertices. The start and finish vertex ids are provided by PHP. I'm trying to work out the best way of communicating b...

Create User and Edit User - DRY or separation, which is more important

I'm wondering what more experienced developers think about how to handle almost identical processes, such as a user creating a profile and a user editing their profile. At the moment I have a single controller method and single view which handle the distinction between a new user and existing/editing user, just by passing around an $edit...

php shell_exec: how to copy a directory from one user to another (VPS on CentOs5)

In Running on CentOS5 + DirectAdmin. I own a VPS, but for security reasons I just want to give all managenent only to 'reseller' user. With a resseler user I have script, which connects to ressellers DA and creates an user. My problem is - how to copy a directory tree with ~10000 of files, which is located in 'resellers user' ftp, ex....

Any other PHP frameworks use a cascading file system?

I really like the Kohana cascading file system. Do any other PHP frameworks feature this? I want to learn another framework besides Kohana, but I'd love to be able to use the awesomeness of the file system. ...

Do I've to free mysql result after storing it?

Hi, I was wondering whether or not I've to call the $stmt->free_result() for after I've stored it's result with $stmt->store_result()? Could I rather just call $stmt->close() on the end? The reason why I'm asking it is because when I call the $stmt->num_rows I've to call the $stmt->store_result() as said here: http://www.php.net/manual...

Problem with Php password on a flash blog

Hi guys. I recently purchased a flash blog on Flashcomponents.net : http://www.flashcomponents.net/component/advanced_xml_flash_blog_with_cms_and_rating_system.html There is the blog and the blog "editor", for wich you have to log in. The password is defined in a Php file named 'admin.php'. The problem is that, whatever password I type, ...

implicit class variable declaration in php?

Hi, I've been looking at some code and am having a hard time working out variable declaration in php classes. Specifically it appears that the code i'm looking at doesn't declare the class variables before it uses them. Now this may be expected but I can't find any info that states that it is possible. So would you expect this: class E...

Kohana Error: `The log directory is not writable`

I have a project I checked out in Kohana and I'm trying to get it running on a local server and I'm getting the issue here: http://djaffry.selfip.com:8081/ The permissions for the logs folder is the same as for everything else, drwxr-xr-x 3 tipu tipu 4096 2010-06-24 12:37 cache drwxr-xr-x 3 tipu tipu 4096 2010-06-24 15:21 config drwx...

Scalable, Delayed PHP Processing

I'm working on an online PHP application that has a need for delayed PHP event. Basically I need to be able to execute arbitrary PHP code x many seconds (but it could be days) after the initial hit to a URL. I need fairly precise execution of these PHP event, also I want it to be fairly scalable. I'm trying to avoid the need to schedule ...

oop design: returning a boolean property rather than explicitly returning TRUE or FALSE

I have noticed that most PHP-based libraries or frameworks have classes that don't explicitly return the keywords TRUE and FALSE, instead: if(condition) { $this->boolean_property = FALSE; return $this->boolean_property } does this mean anything or is it just another "purist" move which does not present any advantage over the other...

Declaration of Methods should be Compatible with Parent Methods in PHP

Strict Standards: Declaration of childClass::customMethod() should be compatible with that of parentClass::customMethod() What are possible causes of this error in PHP? Where can I find information about what it means to be compatible? ...

How to group array values to different levels in PHP?

$arr = array(25,41,120,...36); How to group values in $arr to specified integer range $start ~ $end ? For example , if the level range is 1~5(1,2,3,4,5), how can I specify a level for each element of $arr ? The only principle is that larger value should map to larger level, and should cover the entire level range as possible. UPDAT...

Is there a version of tac that gunzips the content? (like zcat)

I am working on a PHP script that needs to read log files in reverse line order. I currently do the following: <?php shell_exec("tac logfile.log > tmpfile.log"); $rFile = fopen("tmpfile.log", "r"); while (!feof($rFile)) { //logic } unlink("tmpfile.log"); ?> This works nicely as it switches the order of the lines in the file and ...