php

swfupload + upload.class in the same php project

Hi, i have a project with upload.class from php and swfupload. Im also using zend framework, so i init upload.class in the bootstrap file. Both uploads are working well, but when i init the upload.class, through a require once, the swfupload stop working. When i try to upload an image, appears the message error 500... can´t They work...

Parse error: syntax error, unexpected T_DOUBLE_ARROW PHP

I'm getting a Parse error: syntax error, unexpected T_DOUBLE_ARROW PHP on line 47, which is 'post_content' => $thisShow['content'], Anyone got any ideas why? protected function _saveShow($thisShow) { $saveData = array( 'mid' => $this->_saveAsUserId, 'post_title' => $thisShow['title'], ...

Sending signal to daemon in php

Hi, I have a daemon written in PHP which is running on my linux machine. I am trying to send a signal to it through another php file. For this purpose I am trying posix_kill function. But its not working. When I run the php page, I get an error that php is compiled without --enable-grep I want to know how to enable it? OR what is the...

need help passing multiple variables from foreach loop to test in switch case statement

$list_of_groups = array("FACULTY","STAFF"); foreach ($list_of_groups as $i => $group) { $user_in_group = $adldap->user_ingroup($username,$group); print "<h2>Group: ".$group." user in group? ".$user_in_group."</h2>"; // if 1, means yes } Need to print run the appropriate function based on what returns true. There are user's that...

playing dynamic sound clips in browser

Hi, I've never delt with sound clips and im wanting to play one via an event. I have a file which has a snippet like so: if( $get['0002'] == 'mu' ) { switch( $get['0000'] ) { case 'mp3': header('Content-Type: audio/mp3'); break; case 'wav': header('Content-Type: audio/x-wav'); break; default: break; } ...

Selective upload manager in Moodle

In Moodle 1.9.7, is it possible to somehow specify a white-list of the allowed extensions for the user uploaded files? ...

Find difference between two dates in php or mysql

How to find the age between two date using php or mysql 2009-09-24 21:09:36 2010-03-04 13:24:58 Thanks ...

php array in url from json

Here is what I want to do: I have some json like this var foo = { format:"json", type:"test", id:"26443" }; and I awant to put that in a url like this 'http://example.com/a:3:{s:6:"format";s:4:"json";s:4:"type";s:4:"test";s:2:"id";s:5:"26443";}' which I will then put into ajax call but everything I have tried results...

Is preg_match safe enaught in input satinization?

Im building a new web-app, LAMP environment... im wondering if preg_match can be trusted for user's input validation (+ prepared stmt, of course) for all the text-based fields (aka not html fields; phone, name, surname, etc..). For example, for a classic 'email field', if i check the input like: $email_pattern = "/^([a-zA-Z0-9_\-\.]+)@...

Zend Framework: Getting request object in bootstrap

How do I get the request object from inside the bootstrap file? I can try this methods but not work. $request= new Zend_Controller_Request_Http(); $request = Zend_Controller_FrontController::getInstance()->getRequest(); ...

PHP: optimum configuration storage ?

Hello, My application gets configured via a lot of key/values (let's say 30.000 for instance) I want to find the best deployment method for these configurations, knowing that I want to avoid DEFINEs to allow for runtime re-configuration. I have thought of pre-compiling them into an array via a php file pre-compiling them into a tmpf...

CakePHP accessing other controllers

CakePHP Newbie :) I am having trouble accessing another controller and passing that data to a view in one of my controllers: In controllers/landings_controller.php: var $uses = 'User'; function home() { $userdata = $this->User->read(); $this->set(compact('userdata')); } In views/landings/home.ctp: <?php echo $this->us...

Inserting Cells Into A Table ?

How do i go about inserting a cell into a table? For example, i retrieve data from a database using MySql and PHP, how do i then go about inserting a cell into an already scripted table? In my case, how would i insert a cell into a row 150 pixels from the start of the row? example: ___________________________________________ | <--15...

How to simplify the following tables and optimize?

Hi Now i have a table with the following fields id country hdate religions season description link rate and i store the data within this table , my sample data will be 1 Afghanistan 2008-01-19 Islamic Winter Ashura ashura 2 2 Afghanistan 2008-03-20 Islamic Winter Mouloud (Birth of the Prophet) mouloud 4 ...

php multiple select drop down

here is my mysql and php code layout: I have 3 tables tableA stores unique "person" information tableB stores unique "places" information tableC stores not unique information about a person and places they have "beenTo". here is how i layed out my form: -one big form to insert into "person" tableA; "beenTo" tableC in the form, a per...

[Solved] Counting the age of an item in weekdays only

I've been trying to count the age of something in weekdays. I've tried the method detailed in this question, http://stackoverflow.com/questions/883615/given-a-date-range-how-to-calculate-the-number-of-weekends-partially-or-wholly-wi but it doesn't seem to fit my usecase. An item has a created DATETIME in the database, and I need to mark...

Is it poor practice to build an SQL query using WHERE 1=1 AND ...

I'm writing a PHP script that builds an SQL query by concatenating the string and adding conditions to the WHERE clause as needed. Would it be better practice to use WHERE 1=1 so that the first condition is satisfied and the script can just concatenate an AND x = 'y' to the query, or should I write the extra code to check if a clause ha...

how to check if the second array key is an array?

i have an array which could look like this: $config[$name][$array]['key'] = 'value'; // here it's an array or $config[$name][$array] = 'value'; // here it's not an array i want to check if the second array key ('array') is an array or not. could someone help me? ...

Using regex to extract variables from a plain-text form letter?

Hi - I'm looking for a good example of using Regular Expressions in PHP to "reverse engineer" a form letter (with a known format, of course) that has been pasted into a multiline textbox and sent to a script for processing. So, for example, let's assume this is the original plain-text input (taken from a USDA press release): WASHING...

Validation of user input or ���������

We're letting users search a database from a single text input and I'm having difficulties in filtering some user supplied strings. For example, if the user submits: ��������� lcd SONY (Note the ?'s) I need to cancel the search. I include the base64 encoded version of the above string wrapped up so that its easy run: print(base64_d...