php

Whats the best way to retrieve information from Sphinx (in PHP)?

I'm new to sphinx, and I'm seting it up on a new website. It's working fine, and when i search with the search in the console, everything work. Using the PHP api and the searched, gives me the same results as well. But it gives me only ids and weights for the rows found. Is there some way to bring some text fields togheter with the 'mat...

UTF-8 Server.UrlEncode problem in ASP Classic

I'm having a bit of bother URL encoding a string of UTF-8 encoded text to pass over HTTP. I am using Server.URlEncode in classic ASP (vbscript) to do the encoding on the "é" character. It produces the following string, %C3%83%C2%A9 The system I am talking to over HTTP is PHP however and it cannot decode this string. Using a PHP encode...

Disable image from caching?

** edit it seems that when the javascript changes the image that the reflection gets an undefined src. Any thoughts on that ** I've got this problem where I'm using jquery to reflect an image. I've got this news title list and it's automatically jumping through titles. Each time it changes the image and the reflection. This works pref...

invoking a php method from java

i need to invoke a PHP method from java . can i do that with request dispatcher? ...

PHP Regex Problem - Optional text

The following regex should be for Do Dollars Dollar or #do #Dollars or #Dollar but not for Doblabla (which it currently is) etc.. /^@(?P<name>\w+) (?P<amount>\d+) [#]?Do(?:llars?)?/i How do I change that? So that it no longer matches on Dogfood and Dogs etc... Update 3: Not Solved Afterall: /^@(?P<name>\w+) (?P<amount>\d+) [#]?(do(...

calling php from java

I am writing a java class.And i have some logic in test.php One of the methods of that java class should invoke test.php so that test.php performs some computation and returns the result to the invoking java method. Can i do that with runtime rt = runtime.getRuntime(); process exec = rt.exec(test.php); Please suggest. Thanks in advanc...

Google Maps api access possibilities for iphone? (processing javascript without UIWebView)

I want to access some data from Google maps. the only way possible is using JS for that. I'm not trying to access it through a webview. usercase: I have point 1 (lat,lng) and point 2 (lat,lng). I want to use Google maps api to determine what the driving distance is between those 2. So in other words I want to use the Google maps ap...

How do I sha1 hash hex values correctly in PHP?

I have a series of hex bytes. Theoretically, the last 20 bytes are the sha1 hash of the first part: 3F F4 E5 25 98 20 52 70 01 63 00 68 00 75 00 79 00 69 00 00 00 74 28 96 10 09 9D C9 01 00 74 A0 D7 DB 0B 9D C9 01 4D 00 79 00 47 00 72 00 6F 00 75 00 70 00 00 00 2F 00 00 00 BD 0D EA 71 BE 0B 25 75 E7 5C 58 20 31 57 F3 9A EF 69 1B FD If...

POST BACK in PHP or JAVASCRIPT?

how can I post back the data that are already in the text field? example: if I miss one of the required field an error will prompt when i click the submit button. How can I make an post back data in that form using php or javascript and make the cursor of the mouse directly located to the field that caused an error? ...

No error when uploading a really big file in PHP?

I have a PHP form for uploading files and it works fine and displays an error message if something went wrong. This is all good. The problem is when I test with a really big file, it just refreshes the page as if I hadn't sent a file at all, and none of the $_POST variables from the form are even sent to the server. I want to display a...

mod_rewrite multiple directories to a php file

RewriteEngine on RewriteRule ^/(dir1|dir2|dir3)/(.*)$ /targetfile.php [R,L] http://www.somesite.com/dir1 -> http://www.somesite.com/targetfile.php http://www.somesite.com/dir2 -> http://www.somesite.com/targetfile.php http://www.somesite.com/dir3 -> http://www.somesite.com/targetfile.php From what I've seen online, this should work. U...

PHP hostname bindings

If I write a PHP script to connect to an SMTP server (in my case, this is Postfix installed locally) and send an email, the first "received" header in the e-mail turns out as: Received: from [SERVER_IP] (SERVER_HOSTNAME [127.0.0.1]) by SERVER_HOSTNAME (Postfix) with ESMTP id D682A34381 for <TO_EMAIL>; Thu, 5 Mar 2009 17:25:18 +0000 (GM...

Zend Framework: How to unset a key in Zend_Registry?

I am testing my Zend Framework application and would like to test that something happens when a particular key is not set in the registry. This is the function that I am testing: protected function getDomainFromConfig() { $config = Zend_Registry::get('config'); if (!isset($config->domain)) { throw new Exception('Please m...

If .net sha1 hash expects a byte array, and php sha1() wants a string, can I match the results?

I have a set of bytes I want to apply an sha1 hash to. One hash will be in .net, the other in PHP. Then I'll test to see if they match. In .net, you can create a byte array and use sha.ComputeHash(). byte[] data = new byte[DATA_SIZE]; byte[] result; SHA1 sha = new SHA1CryptoServiceProvider(); // This is one implementation of the abs...

Import package or autoloading for PHP?

Hello, everyone. What solution would you recommend for including files in a PHP project? There aren't manual calls of require/include functions - everything loads through autoload functions Package importing, when needed. Here is the package importing API: import('util.html.HTMLParser'); import('template.arras.*'); In this functi...

PHP Sessions + Useragent with salt

Hi, It keeps running in my mind the last couple of days, but I read some articles about how to make your PHP sessions more secure. Almost all of these articles say that you need to save the useragent in the session WITH an additional salt. Something like this: $fingerprint = md5('SECRET-SALT'.$_SERVER['HTTP_USER_AGENT']); The salt wo...

Checking site and deciding then CSS style?

I aim to have a similar Bar at the top as here: http://www.keltainenporssi.fi/ The colour of the current site is in red, while other sites are in black. How would you reach my aim? Perhaps by php? The syntax in pseudo-code may be if $site = A use-styleA if $site = B use-styleB else use-FinalStyle ...

PHP Config --bindir

When using the following configure flags below, the following error is reported, why is this? Obviously the directory exists. This is a PHP 5.2.9 install on a 64bit CentOS 5.2 OS. ./phpconfig.scr: line 11: --bindir=/usr/bin: No such file or directory './configure' \ '--host=x86_64-redhat-linux-gnu' \ '--build=x86_64-redhat-linux-gnu' \...

How can I add search functionality into my PHP website?

Duplicate: How would I implement a simple site search with php and mySQL? I want to insert a search functionality into an existing website. The site is database driven. What is the best way to achieve this? Should i just simply go ahead with the query select * from tables where field like user input? Is there a better way to index the ...

Checking the user's location and then applying specific style?

How can you apply a US style for people in US and a UK style for people in UK? For example, I want to change a flag according to the user's location in my site. ...