php

have anyone done OpenMarket's sms/mms integration ?

Hi Everyone, Currently I am developing a web application where I am gonna integrate OpenMarket SMS and MMS functionality. Have anyone used this earlier? Can I have some demo of the integration by someone? Any help will be very appreciated. ...

Session Time out In Php

Hi I have a php web site. It’s a shopping cart site. When a user purchases two or more item the session will expire. But we don't put the session unset code in any where in the site. Cloud you please help me what is the problem hare? Please give me a solution. The main issue is that user can't proceed the check out. Thanks in advanc...

How can I create a non-file lock in PHP?

I have a maintenance script in PHP that updates and repairs the database. In theory, running two scripts simultaneously shouldn't be a problem, but I want to be extra safe by putting a lock in a variable in PHP. The problem, of course, is that I can't store it in a $_SESSION variable because sessions only apply to one user. Is there any...

Trouble with array_unique

print_r($tokens); $tokens = array_unique($tokens); print_r($tokens); Gives the following output: Array ( [0] => Array ( [Class_ID] => 32709 ) [1] => Array ( [Class_ID] => 34682 ) [2] => Array ( [Class_ID] => 34818 ) ) Array ( [0] => ...

What is the benefit of using the super global `$_SERVER['PHP_SELF']` in PHP?

What is the benefit of using the super global $_SERVER['PHP_SELF']? ...

cleanest way to skip a foreach if array is empty

Not a major problem but I was wondering if there is a cleaner way to do this. It would be good to avoid nesting my code with an unnecessary if statement. If $items is empty php throws an error. $items = array('a','b','c'); if(!empty($items)) { // <-Remove this if statement foreach($items as $item) { print $item; } } I could p...

How do I setup a Doctrine relation for a foreign key that could point to different tables, depending on context?

I am creating an application, built with PHP, MySQL and Doctrine v1.2, that deals with ordered groupings of items, which can contain different types of items. For example, the group My Last Vacation can have images, video and textual notes. These items would be sortable so that they appear in the order that the end user specifies. Eac...

Is there a "handy" PHP framwork?

Hello, I'm looking for a PHP framework for small projects. Things like the ZEND framework or Symphony are much to big for my needs and they don't save me time. I'm faster developing those small apps by hand instead with on of these mighty frameworks. Maybe someone has an suggestion? Thanks! ...

How does Linux determine the next PID?

How does Linux determine the next PID it will use for a process? The purpose of this question is to better understand the Linux kernel. Don't be afraid to post kernel source code. If PIDs are allocated sequentially how does Linux fill in the gaps? What happens when it hits the end? For example if I run a PHP script from Apache that ...

Performance cost of sending an email with PHP ?

Rich sites such as facebook send you an email for every event that takes place, notification, friend request and so on, I would like to know how costly is it for the web server to perform this action? that also 100s of time a day for active and popular users. Thanks ...

How to get graphs about apc info in PHP?

I need to get statistics info like this: More in this post. ...

Regular Expression to get contents of div class in php

Hi, Is there any special syntax to get nested div element with unique class name in RegExp in php. Consider I have a syntax like <div style="demo"> <div class="row"> <div title="[email protected]" class="text">ABC</div> </div> <div class="row"> <div title="[email protected]" class="text">PQR</div> </div></div> here how can we r...

Any tool to parse a ZF project for translate() method ?

Hi, I used gettext as adapter for Zend_Translate in the past and poedit has such utility that parses a project for translate() methods. But I'm not using gettext anymore (it's a requirement) and I use CSV instead. I'd like to know if there are any utilities to parse my project and help me to gather all my translated string. I know so...

How can I use fixtures in Doctrine 2?

Hi, Does anybody can get me started on using fixtures in doctrine 2? In doctrine 1 this was easy. But in the doctrine 2 documentation there's nothing I can find about fixtures. Thanks. ...

Uploading a file to my Linux PHP web host through a URL

Hi, First of all, I don't know if this is where I have to ask this question; so I'll count on the moderators to move it if need be. I have a Linux PHP web hosting account on GoDaddy. When I have to upload a file, I normally use FTP, either a client or the host's file manager. However, if the file is one which I have to download from ...

Deleting parts of a file with php

After using file_get_contents to write to a html file, I need to delete certain parts of this files contents because the paths to css and images has changed. So I have lines as below : <link href="/Elements/css/main.css" rel="stylesheet" type="text/css"> <image src="/Elements/images/image1.gif" /> I would like to remove the: '/Ele...

Checking for searched keyword

On one page of my website, I am getting a lot of visitors from a specific keyword. I want to display a message for only those visitors coming from that search keyword. How can I check if the user is coming from the search engine / that keyword? ...

Soapclient query a Sharepoint web service

I successfully query a service with the following code from here <?php $authParams = array("login" => "username", "password" => "password"); $listName = "{2882F083-8890-4ADA-A1FC-39ED1D63D825}"; $rowLimit = '150'; $wsdl = "http://localhost:89/list.wsdl"; $soapClient = new SoapClient($wsdl, $authParams); $params = array('listName' => $li...

registration form helps to efficiently register people

hi guys, i want to make a registration form, here i want to user to add some inputs to it, when (s)he register a person, i want to submit it, register the person but i want only to give a alert saying registration successful, in the original registration form some fields are cleared and user can use it to register people again, cycle g...

How to implode 2 dimensional array into square brackets

Hi guys, I would like to output my php array into this format: [1991, 6.5], [1992, 4], [1993, 5.9] PHP array: while ($row = mysqli_fetch_array($result)) { $metals[] = array('year' => $row['year'], 'metal' => $row['metal']; } I have seen some examples of implode function but I couldn't find any that could matc...