php5

Reset a LDAP Password with PHP

How can I reset a LDAP password in PHP? I already have a connection to the LDAP Server. ...

JavaScript: document properties

Hi, is there a "document" property named ssh? It's a simple question. I've seen this in some code at work, but no one in the office wrote the code, so I'm stucked. The line was document.ssh.firstPing(...) firstPing was a method in the code, that is writen in js+php. But I've searched with eclipse throughout all the code and there is ...

Single certificate to talk to 5 third party boxes

All, I have a web application that uses CURL to talk to 5 boxes that are running third party SDKs. All 6 boxes use HTTPS. Is it fine if we have one certificate and specify CURL to use that certificate to talk to the 5 boxes or do I need to have 5 different certificates? Thanks ...

[ask][php] find dynamic filename exist

hi. i am writing a cache module in php. it tries to write a cache with a $string+timestamp as a filename. i dont have problem with writing the cache. the problem is i do a foreach loop to get the cache that i want. this is the logic that i use for getting the cache foreach ($filenames as $filename){ if(strstr($filename,$cachenam...

filter by value in object of array

hi i want to know how to filter the value in object of array... i just display the below is one data of my object array Object ( [_fields:private] => Array ( [a] => c7b920f57e553df2bb68272f61570210 [index_date] => 2010/05/11 12:00:58 [b] => i am zahir [c] => google.com [d] => 23c4a1f90fb577a006bdef4c718f5cc2 ) ) Object ( [_fiel...

Get the full result

Is there a PHP function to get the full result with a mysql query in a multidimensional array? SELECT * FROM table Usually I would make something like this: $query = mysql_query = ("SELECT * FROM table"); while ($result = mysql_fetch_array($query){ echo $result[0]; } ...

Using PHP interfaces in Codeigniter

I am trying to find out how can I used PHP interfaces in my MVC design. I want to make sure that the design enforces an interface so that any new module would follow that. For example: <?php interface BaseAPI { public function postMessage($msg); } class ServiceAPI implements BaseAPI { public function postMessage($msg) { ret...

PHP 1-liner each() with mysql_fetch_assoc()

Hey All. Trying to create a 1-liner to loop through a mysql result set. Example: $sql = "SELECT uid, role FROM usr WHERE uid = '$this->uid'"; $r = db::q($sql); if($r->rows()) { $q = mysql_fetch_assoc($r->result); while(list($k, $v) = each($q)) { // would like to omit line above and consolidate here $_SESSION['usr'][$k] = $this...

Parse error after upgrading to PHP 5.3

I have a php code that works well in PHP 5.2 but throwing "Parse error: syntax error, unexpected '}'" after upgrading to PHP 5.3. When I use echo/print or heredocs to print all the HTML part of the code, the error is gone. My question is, why this error occurred? Is this mean that in PHP 5.3 we are no longer allowed to put HTML code in...

use stream_socket_client to retrieve 2 remote files at the same time

I have a script in PHP which retrieves two very similar files and performs some tasks on the data then outputs a result. I'm currently using curl and getting one, processing it, then getting the other and processing it. I want to switch to stream_socket_client as I've heard you can retrieve both files at the same time and do the process...

Finding an open and closing tag in Regexp

Is there a way to find custom tags in regexp I.e. match {a}sometext{/a} As well as {c=#fff}sometext{/c} So that it finds the entire block of inner content? The problem is the sometext could have another tag as in: {a=http://www.google.com}{b}Hello, world{/b}{/a} The only solutions I can come up with would match from ...

How to find out master product of simple product?

How can I find out, if a simple product is part of a configurable product and then get the master product? I need this for the product listing. Just found out: $_product->loadParentProductIds(); $parentIds = $_product->getParentProductIds(); ...

How to display configurable product in each color in Magento product listing?

I have a configurable product which is available in many different colors and sizes. I want the configurable product to appear once for every color. My idea is to assign one simple product of the configurable product in every color to the category of the configurable product. Then I want to change the listing, so that the (colored) simpl...

Conversion from jpg to gif with reduced size

Hello, This is nice code. But it is uncertain. I am trying with jpg to gif conversion. With some images it reduces the size and with some images it increase the size. Can you help me that how can i get the reduced sized gif from jpg. Thanks, ravi ...

Effective Data Validation

What's an effective way to handle data validation, say, from a form submission? Originally I had a bunch of if statements that checked each value and collected invalid values in an array for later retrieval (and listing). // Store errors here $errors = array(); // Hypothetical check if a string is alphanumeric if (!preg_match('/^[a-z\...

exporting username and password from form data to textfile using php

when user submit the form need to export form data to text file.exporting username ,password and email from form data to text file for forgot password. please help us. Thanks & Regard pmms ...

Replace repeating character with array elements in PHP

I hope this is blindingly obvious: I'm looking for the fastest way to replace a repeating element in a string with the elements in a given array, e.g. for SQL queries and parameter replacement. $query = "SELECT * FROM a WHERE b = ? AND c = ?"; $params = array('bee', 'see'); Here I would like to replace the instances of ? with the cor...

explode is not working to split string

we unable to split the string following code.please Help us. <?php $i=0; $myFile = "testFile.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "no\t"; fwrite($fh, $stringData); $stringData = "username \t"; fwrite($fh, $stringData); $stringData ="password \t"; fwrite ($fh,$stringData); $newline ="\r\n"; fwrite ($...

PayPal testing without using Sandbox

I am developing a website in PHP that accepts PayPal payments. It uses the IPN from PayPal and has a custom payment template etc etc. It all works great through the Sandbox server but when it comes to showing my client, I don't want to have to tell them to login to/create a Sandbox account, create a buyer account and make a payment - h...

How to disable E_STRICT

I need to turn off E_STRICT. I have error_reporting = E_ALL & ~E_STRICT in my php.ini but it seems to be ignored. I tried this in my code: ini_set('error_reporting', E_NOTICE); Nothing! Please help. ...