php

PHP Session Class and $_SESSION Array

Hello, i've implemented this custom PHP Session Class for storing sessions into a MySQL database: class Session { private $_session; public $maxTime; private $database; public function __construct(mysqli $database) { $this->database=$database; $this->maxTime['access'] = time(); $this->maxTime[...

How can I safely port my wordpress blog to localhost?

Hi, I'm trying to make local development copies for my wordpress blog. I tried first to install wordpress locally (on XAMPP for Windows), install the plugins then import the live data (from a DB backup). The problem is whenever I import the live data I start getting all sorts of errors, even after I change the blog's URL through the dat...

php: polymorphism on the iterator implementation of a array object?

I don't know if a array is really a object on php ... but, what I want is to change the array behavior on a foreach loop. Something similar to this on java: for( String it : myArr = new Array_Iterator( array) implements Iterator{ public Array_Iterator( String[] arr){ this.arr = arr} /* interface implementation */ }){ /* loo...

there is no type juggling for constants (I want my string 'REGEX_NAME' like 'REGEX_EMAIL' to become REGEX_NAME like REGEX_EMAIL)

I'm having to manually write: if($pattern == 'REGEX_EMAIL') $pattern = REGEX_EMAIL; if($pattern == 'REGEX_PASSWORD') $pattern = REGEX_PASSWORD; Is there an other way? ...

How to do deployment for php application

I am currently developing a php-application for a charity organization and I am now in the stage of defining the deployment practices. Our application is using both Zend Framework and Doctrine. The application will be rolled out to different servers, each with a different configuration file. The machines are both Windows and Linux (but ...

Copy/Paste from Excel to a web page

Hi All, Is there a standard way or library to copy and paste from a spreasheet to a web form? When I select more than one cell from Excel I (obviously) lose the delimiter and all is pasted into one cell of the web form. Does it have to be done in VB? or could the processing be done once the paste action is started on the web form? Than...

PHP image upload and resize error

Hi there, I looked the site to find a solution for my problem, but couldn't find the answer. Hopefully someone can help me with this: I have a script that uploads and resizes an image without pagerefresh. I found it on the internet and adjusted it for my use. The script can be found underneath. My problem: First the upload.php script...

Installing PHPUnit via PEAR

I have problems installing PHPUnit 3.4.6 via PEAR 1.9.0. After I discover channel pear.phpunit.de and try to use one of following commands: pear install phpunit/PHPUnit pear install --alldeps phpunit/PHPUnit pear install --onlyreqdeps phpunit/PHPUnit it fails, giving me following error: No releases available for packa...

PHP mySQL - UNIX_TIMESTAMP is not equal to strtotime

Hi all, PLATFORM: PHP & mySQL I am storing the date+time in database in the following format: date("Y-m-d H:i:s"). An example of a value that I have in my DB is : 2010-01-05 07:36:33. In my script, I have set the timezone as date_default_timezone_set("America/Chicago"); THE PROBLEM: I read about the UNIX_TIMESTAMP somewhere and I w...

PHP how can i check if a file is mp3 or image file ?

how can i check if a file is an mp3 file or image file, other than check each possible extension? ...

Alternative to header(location: ) php

Hey I have a while loop that constructs a url for an SMS api. This loop will eventually be sending hundreds of messages, thus being hundreds of urls. How would i go about doing this? I know you can use header(location: ) to chnage the location of the browser, but this sint going to work, as the php page needs to remain running Hope ...

How to manipulate parameter according to other parameter in a php function?

I have id names with the second part of table name plus id. For example admins_id in omc_admins table, customers_id in omc_customers table, products_id in omc_products table, categories_id in omc_categories table etc. Now the following function code is supposed to find orphans. For example, when I delete categories, it will ch...

choose the item of a select

Hello! I need to select a specific item of a combobox in my page when i click in a button. I am using php and javascript code in my page. Actually i am calling a javascript function at the "onclick" of the button. But i still dont get the right command to do this. example: <select id="TEST"> <option> a</option> <option> b</option> <o...

Getting info from 2 tables

Having trouble with some select statements. I have 2 tables. sms_log and sms_messages. sms_log : id message_id user_id sms_messages: message_id admin_id message date_sent date_delivered I want to get the sms_message data where sms_log.user_id = $id How do i do it, im a bit stuck. Also, how will i access it through php, exactly t...

PHP/MySQL question [facebook-related]

Okay... I'm having the following problem - in my facebook application I let people add quotes sending them to my DB with their user_id, post_id and date. Then there's a browse page where people see the posts - so far, so good. But then I add a button that lets my users set the said post as their status. Still all good. However when I hit...

list onclick event problem in php

I'm trying to display the new dynamic list by clicking dynamic list. Why do i call them dynamic list? Because the data is from database. My idea is generating a list of companies, when i click one company, a list of all sites in the company is displayed; And then when i click the one site of one company, a list of all employees in the ...

mysql insert problem

ive got a really weird problem. i have no clue why its not working. i create an user and get the id and insert a row based on that id in another table. the row gets inserted with that id but the other values however for that row are not inserted! $user_id = mysqli_insert_id($this->connection); $query = "INSERT INTO selections (user...

SQL server transactions in PHP

I'm trying to grasp the idea of transactions fully. Therefore the following question... (ofcourse newbie, so don't laugh :D ) I have set up a (simplified) transaction in PHP (using the PHP SQL driver from microsoft). I want to get the rows I'm going to delete for some extra processing later: sqlsrv_begin_transaction($conn); $sql = "SEL...

Adding nl2br to my Wordpress custom Meta Box

Okay let me see if I can explain this right. In wordpress we have a box to insert an excerpt. We need to add a second excerpt box. Instead of manually adding a custom field to every post I have placed a function to automatically add a custom field in the form of a Meta box on the admin post page. Okay so this is the problem that i'm hav...

Strange problem with mysql procedures and PHP database connection

I have two completely separate queries that were transferred over to procedures. When they were ad-hoc queries, they ran great but now that I have stored them, things have gotten strange. PHP calls a class method which returns the values of one of the procs. The second method is then called and fails. When I run the run the proc that PH...