php

convert password encryption from java to php

I'm trying to create a PHP version of an existing JSP program, however I'm stuck at the password encryption part. Could you please tell me how to convert this one? I know it tries to get the md5() but after that, I don't get it. I get lost in the Stringbuffer and for() parts. Can you help me out? public static String encryptPassword(...

Sanitize file_get_contents

I want to use file_get_contents to implement a proxy so I can do ajax cross domain requests. Querystring will be used to supply the URL to file_get_contents. Now the problem is people can muck around with the querystring in order to read local files on the server. I dont want this. Can someone get me a function to sinitize the queryst...

Php regular expression to match a div

Hello all <div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div> <div id="c"> Bar </div> I want find all object in id="a" and out put is <div id="a"> <div id="b"> Foo </div> <div id="m"> Bar </div> </div> Geat thanks. ...

Get Flickr Sets

Hi everyone. Usual stuff, Googled forever, looked on here, no help. Yet. What I want is to list the sets of photos I have on Flickr. Nice & simple, it would seem. I want the 'title image' (the one used as the thumb for it on Flickr its self), the title and URL. Can't be that hard, can it? The language of choice is PHP (5.1.6), or JS (...

PHP fsockopen to curl conversion

i have this piece of code: <?php $host = "registration.mypengo.com"; $request = "/webregistration.aspx?taskaction=serviceresponse&partner=157&subid=" . $subid . "&msisdn=" . $msisdn . "&type=TEXT&data=" . $data . "&serviceid=" . $service_id; $fp = fsockopen($host, 80, $errno, $errstr, 3.0); if($fp) { fwrite($fp, "GET $request HTT...

Which PHP IDE would you use on Windows, if you're used to TextMate on the Mac?

Until now, most of my PHP development had been done on a Mac in TextMate. For a new client I need to work on a secured windows box, and I was wondering which IDEs I should be looking at, as someone used to working with TextMate. I've tried the 'E' editor, and I'm unconvinced. I've tried IDEs on the Mac, and they always seem like poor rel...

str_replace function wont replace string if i use single quotes

I using php's str_replace function to replace some text. Example below. str_replace("{x+{\$v}}", "{x-{\$v}}", $this->introtext); str_replace('{x+{\$v}}', '{x-{\$v}}', $this->introtext); In first case it replace text, but in second case it is not doing so. What is difference between two? ...

Passing counter variable dynamically

'view_act.php' file <?php $query = mysql_query('select * from activities'); $check=mysql_num_rows($query); if($check==0) { echo "No enteries found "; } else { static $counter; echo '<table border="1" cellpadding="5" cellspacing="5" align="center"> <tr> <th><font color="#FF9900">ACTIVITY ...

i want check input by regex | contain 16 number

I have input, I want to check it. It should accept only numbers, and must be 16, no more and no less. How I can do that using php and regex? ...

htmlspecialchars() - How and when to use and avoid multiple use

Hi, I'm building a PHP intranet for my boss. A simple customer, order, quote system. It will be denied access from the Internet and only used by 3 people. I'm not so concerned with security as I am with validation. Javascript is disables on all machines. The problem I have is this: Employee enters valid data into a form containing an...

Multiple case or switch commands in php?

Good Afternoon, I am trying to assign some variables to a listing which has a main category and a subcategory. This works fine for most of the variables, however in each sub category there are some fields which are other. ie Main Category 1 has sub category database, development and other Main Category 2 has sub category email, interne...

garbage collection in session will take place when session managing with database in php?

How or when garbage collection with session will take place in case of session managing with database in php? I done session management with database. But it is not deleting the user details who completed the time of expiration. ...

Need a regular expression for an Irish phone number

I need to validate an Irish phone number but I don't want to make it too user unfriendly, many people are used to writing there phone number with brackets wrapping their area code followed by 5 to 7 digits for their number, some add spaces between the area code or mobile operator. The format of Irish landline numbers is an area code of ...

PHP alternative for MSSOAP.SoapClient30 in ASP.NET

Hello, Can somebody help me with this - I need some tips or code to connect to wsdl service, send XML request and than print response on client side. I only have primer written in ASP.NET and need PHP alternative: function doXMLRequest(Xmltext) Set oSOAP = Server.CreateObject("MSSOAP.SoapClient30") oSOAP.ClientProperty("ServerH...

PHP getting a bunch of weird code \u0644\u064a\u0646\u0643 \u0627\u0644

Hello I'm getting a bunch of weird html output in users messages e.g. \u0644\u064a\u0646\u0643 \u0627\u0644 \u0639\u0627\u0645\u0644 I assume their aribic characters decoded? How can I perhaps preg replace all these codes with something a little more useful? because search results are filled with pages and pages of this stuff Perha...

How to create a session in PHP when there is a session on the same domain in Rails?

I have a Rails app on a subdomain - xyz.domain.com, and a PHP app on another subdomain - abc.domain.com When a user is logged into the Rails app, I would like to give them a session so that I can log certain events about that user in the PHP app but in the same database of the Rails app. I would essentially just expose an API that requ...

Documentation generator tool for BOTH Javascript and PHP

Do you know about a tool to easily create documentation for both Javascript and PHP code? Something that takes comments in code similar to the one shown below: /********************************************************** This fucntion does something special... param1: ... param2: RETURNED VALUES: ... **********************************...

PHP Associative array sort

I have an array like one below. Currently it is sorted alphabetically by the OwnerNickName field. Now i want to brig the array entry with OwnerNickName 'My House' as the first entry of the array and rest sorted alphabetically by OwnerNickName. Any idea? Array ( [0318B69D-5DEB-11DF-9D7E-0026B9481364] => Array ( [O...

How can I give a color to imagecolorallocate?

I have a PHP variable which contains information about color. For example $text_color = "ff90f3". Now I want to give this color to imagecolorallocate. The imagecolorallocate works like that: imagecolorallocate($im, 0xFF, 0xFF, 0xFF); So, I am trying to do the following: $r_bg = bin2hex("0x".substr($text_color,0,2)); $g_bg = bin2hex("0...

Error on using Chilkat.Zip2

Can anybody please let me know, i have used the below code to access COM object... $zip = new COM("Chilkat.Zip2"); echo $zip; but, which shows an like this... Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `ZipActiveX': Invalid syntax ' in D:\xampp\htdocs\test\testscript1.php:2 Stack t...