Php How to build escrow style system

I have a website where clients pay for a service but have to out the money upfront via escrow, I'm very proficient with PHP (this is what the website is coded in) how would I go about implementing an escrow system that would work automatically?

Is there a good pre-existing class for dealing with URLs in PHP?

Is there a widely accepted class for dealing with URLs in PHP? Things like: getting/changing parts of an existing URL (e.g. path, scheme, etc), resolving relative paths from a base URL. Kind of like a two-way parse_url(), encapsulated with a bunch of handy functions. Does something like this exist?

PHP, MySQL on IIS - MySQL not being loaded when serving pages

I have, as best as I can manage, set up IIS (6.0), PHP (5.2.8) and MySQL (5.1.30) on Windows Server 2003, with all the involved mucking about (I think) in IIS and PHP to get things talking to each other. PHP does work - however, I cannot use the mysql or mysqli libraries from a PHP page. Fatal error: Class 'mysqli' not found in... Fatal error: Call to undefined function mysql_connect() in... Information relating to MySQL or MySQLi does not appear when using phpinfo() in a PHP page. However,

how do websites do this index.php?something=somepage

i've seen alot of php based websites where no matter where you navigate your stuck at the index.php and some random parameters are passed in the url. and when i take a look at an open source version who does the same the index.php has a bunch of includes in them whats a basic way i can do the same thing? does this include mod rewrite? thanks

Superimposing images in PHP

Is there a PHP function that would allow me to superimpose an image over another one? If not, how can I accomplish this (not asking for code, just a list of steps)?

Php json_encode on a two-dimensional array

I have a problem using JSON and arrays. Here is my code: while($row = mysql_fetch_assoc($result)){ echo json_encode($row); } The result is: {"id":"1","title":"event1","start":"2009-11-10 14:18:15","end":"2009-11-03 14:38:22","allDay":"false","url":null}{"id":"2","title":"event2","start":"2009-11-09 15:41:20","end":"2009-11-10 16:41:25","allDay":"false","url":null} But I want the result to look like this: [{"id":"1","title":"event1","start":"2009-11-10 14:18:15","end":"2009-11-03 14:38:22

Where do you "Load Balance" an ORM in a PHP MVC Application

The Problem: Object models built using an ORM often need to perform multiple queries to perform a single action. For example a "get" action may pull information from multiple tables, particularly when you have a nested object structure. On complicated requests these queries can add up and your database will start blocking long before it would if you were manually writing SQL. The Question: Where do you load balance the ORM to cut down on the number of queries that need to be made, and more imp

Php Caching data by using hidden divs

I'm trying to speed up response times in my ajax web application by doing the following: Say the user requests a page whose contents don't change (e.g a web form). When the user makes a different request, I 'cache' the form by putting it in a hidden div. Before displaying the new information. So the form is basically still loaded in the browser but not visible to the user. If the user requests the same form again, it gets loaded from the hidden div. That's notably faster than doing a round-tri

PHP/Apache, options +indexes in htaccess doesn't work for root directory

I need to offer a directory listing of the root directory of my site, so I created an .htaccess file containing options +indexes It works for subdirectories, but for the main directory I get the Test Page for the Apache HTTP Server on Red Hat Enterprise Linux page. I have two sites that are identical except for the PHP version installed. On one site (PHP 5.2.1) this technique works fine. On the other (PHP 5.2.9), it doesn't. As far as I know, the Apache installations are identical, and I v

in php how do I use preg replace to turn a url into a tinyurl

I need to convert a string of text containing a long url into the same string but with a tinyurl (using the tinyurl api). eg. convert blah blah blah http://example.com/news/sport blah blah blah into blah blah blah http://tinyurl.com/yaeocnv blah blah blah How can it be done?

Php How to properly preload images, js and css files?

I'm creating a website from scratch and I was really into this in the late 90's but the web has changed alot since then! And I'm more of a designer so when I started putting this site together, I basically did a system of php includes to make the site more "dynamic" When you first visit the site, you'll be presented to a logon screen, if you're not already logged on (cookies). If you're not logged on, a page called access.php is introdused. I thought I'd preload the most heavy images at this p

PHP: optimum configuration storage?

My application gets configured via a lot of key/values (let's say 30.000 for instance) I want to find the best deployment method for these configurations, knowing that I want to avoid DEFINEs to allow for runtime re-configuration. I have thought of pre-compiling them into an array via a php file pre-compiling them into a tmpfs sqlite database pre-compiling them into a memcached db what are my options for the best random access time to these configuration (memory is not an issue) ? the b

Php Authentication for SaaS

What would be recommended as an authentication solution for a Software-as-a-service product? Specifically, my product would have clients that would typically have low information technology skills, potentially not even having an IT department within their organization. I would still like to have my application authenticate against their internal directory service (eDirectory, Active Directory, etc.). I don't want them, however, to have to open/forward ports (for instance, opening up port 636 so

PHP -- automatic SQL injection protection?

I took over maintenance of a PHP app recently and I'm not super familiar with PHP but some of the things I've been seeing on the site are making me nervous that it could be vulnerable to a SQL injection attack. For example, see how this code for logging into the administrative section works: $password = md5(HASH_SALT . $_POST['loginPass']); $query = "SELECT * FROM `administrators` WHERE `active`='1' AND `email`='{$_POST['loginEmail']}' AND `password`='{$password}'"; $userInfo = db_

PHP session corrupt

Using symfony framework 1.4 I have created a website. I'm using sfguard for authentication. Now, this is working great on WAMP (windows). I can login to several accounts on different browsers and use the website. I have ubuntu server 9.10 running apache (everything up to date and default configuration). On my server, when I login to the website in one browser it works great. When I on my other computer login with another user account on the public website, the login is successful. But when I r

PHP not obeying my defined ETags

What I'm doing I'm pulling an image from the database and sending it to the browser with all the proper headers - the image displays fine. I also send an ETag header, using the SHA1 of the image's content as the tag. The images are getting called semi regularly, so caching is a bit of an issue (won't kill the site, but nice to have). The Problem $_SERVER['HTTP_IF_NONE_MATCH'] is not available to me. As far as I can tell, this is because of PHP's "disobey the cache controls" life style. I can

Php How to properly display utf encoded characters on my utf-8 encoded page?

I am retrieving emails and some of my emails have utf encoded text. However even though my page is encoded as utf 8 - in some places when I try to out put utf text I get funny characters like: =?utf-8?B?Rlc6INqp24zYpyDYotm+INin2LMg2YXYs9qp2LHYp9uB2bkg2qnbjCDZhtmC?= =?utf-8?B?2YQg2qnYsdiz2qnYqtuSINuB24zaug==?= Whereas in other areas of the same page it displays fine. What is going on?

How to get a list of unrepeatable date from my db in PHP?

in my db there are 5 fields (id, list_date, amount, total, m_from) and contain data, for example : 1 - 1/1/2010 - 10 - 50 - 'example111' 1 - 1/1/2010 - 10 - 50 - 'example111' 1 - 1/4/2010 - 10 - 50 - 'example154 1 - 1/1/2010 - 10 - 50 - 'example111' 1 - 1/5/2010 - 10 - 50 - 'test' I need to know how I can get dates from list_date but without repeatable dates like '1/1/2010, 1/5/2010, 1/4/2010' Thanks in Advance.

PHP echo xyz if rows in loop contain no data

I am trying to echo some text if my loop returns with no data but can't get it do work. I have tried a few things but no luck. my code: $result = mysql_send("SELECT * FROM datatable WHERE id='". $_SESSION['id']."'ORDER BY id ASC LIMIT 2"); while($row=mysql_fetch_array($result)) { $a = 1; extract($row); echo 'Trans ID: '; echo $row['trans_id']; echo '<br>'; echo 'Amount: '; echo $row['amount']; echo '&nbsp;'; echo $row['euros']; echo '<

Php Highlight active link

How can I have the active link highlighted when clicked but keep the home page link highlighted until another link is clicked? I'm using PHP if that helps. Here is my (x)HTML code. <div id="nav"> <ul> <li><a href="http://localhost/link-1/" class="active">Link 1</a></li> <li><a href="http://localhost/link-2/">Link 2</a></li> <li><a href="http://localhost/link-3/">Link 3</a></li>

Force timeout on a MysqlQuery from PHP

Is there a way to force Mysql from PHP to kill a query if it didn't return within a certain time frame? I sometimes see expensive queries running for hours (obviously by this time HTTP connection timed out or the user has left). Once enough such queries accumulate it starts to affect the overall performance badly.

Php Kohana 3 ORM: constructor "after load"

Is there any way in Kohana 3's ORM to run a chunk of code in a model, but only after that model has been loaded from the database? A simple example is a required has_one relationship. ORM::factory('user')->where('name', '=', 'Bob')->find(); Now what if all users have to have some other property, so if Bob doesn't exist, it will have to be created? Right now, in the place where this line is running, I'm checking for null primary key, and instructing the model to add that relationship

Php How to merge two dates into a normal human readable date range

Say you have the following date range: 2010-04-10 - 2010-04-15 As a human, I might write this as April 10 - 15, 2010, or something like that. Not sure if there is a defined correct way of writing ranges like that, but anyways, if you were to do something like that, how would you do that? I'm not even sure where to begin... I'd like to do this so that the date ranges potentially can be more compact, easier to read and also nicer looking.

Stop php script execution

I have php_mod and an apache server. If I start a script from the browser it will persist until the execution is complete ( even if i close the browser ) How can i stop the process ?

Php How to install a Google search box with suggest on MediaWiki?

I have found several extensions for MediaWiki which allow you put a Google search box for searching the web on your MediaWiki site. However, none of them seem to have an option to enable suggest, which populates a drop down menu of possible search terms based on what the user has typed in so far. How can I do this? I posted this to Stackoverflow, because the solution will most likely require programming. FYI, the existing extensions I found are: - http://www.mediawiki.org/wiki/Extension:Googl

PHP handling of JSON-sent data

I won't tell you I've searched and tried dozens of syntaxes from the internets. You couldn't tell if I'm lying or not. So... This is part of my html (the relevant part): var jsonData = { address: 'address', address1: 'address1', address2: 'address2' }; var out = JSON.stringify(jsonData); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "joaca2.php", data: out, dataType: "html", success: function (response) { alert(respons

PHP preg_match problem

content.tpl tratata 'hey' tratata <br/> okay 'aaaaa' <br/> 'trtata' <br/> echo 'tratata'hmmmm'traatata'; 'hello' tratata <br/> How do I change all the quotes ONLY in the echo? I need tratata 'hey' tratata <br/> okay 'aaaaa' <br/> 'trtata' <br/> echo 'tratata\'hmmmm\'traatata'; 'hello' tratata <br/> Thank you

PHP Tokens From a String

Let's say you have a string that looks like this: token1 token2 tok3 And you want to get all of the tokens (specifically the strings between the spaces), AND ALSO their position (offset) and length). So I would want a result that looks something like this: array( array( 'value'=>'token1' 'offset'=>0 'length'=>6 ), array( 'value'=>'token2' 'offset'=>7 'length'=>6 ), array( 'value'=>'tok3' '

Php How can I use ajax to post message through a url and still keep line breaks?

Here is a sample of the javascript/ajax on PAGE A: var commReq = getXmlHttpRequestObject(); function AddComment(Comment){ if (commReq.readyState == 4 || commReq.readyState == 0){ commReq.open("GET", '/receiveComment.php?com='+Comment+'&' + Math.random(), true); commReq.onreadystatechange = handleComment; commReq.send(null); } } Now the php page that receives the comment (receiveComment.php) PAGE B: $Comment = mysql_real_escape_string(preg_replace("/[^A-Za-

Php how to remove the deprecated error

I'm developing google clone search engine with Google API key in PHP. I'm getting this error. what should I do for remove that error? Deprecated: Assigning the return value of new by reference is deprecated in E:\wamp\www\downclone\google.com-search-engine-clone\google.com Search Engine Clone\nusoap.php on line 3703 thanks in advance

Php How to forward to the correct URL after login

I have a website which has a web page containing list of logs. Now I usually give the link to access that page for some user eg : http://172.20.22.77/someapp/results.htm?id=45 Now when some user clicks on this .It would give him a login screen .But after login it does not go to the page that was intented . I am using sessions to implement the website and it has many pages, hence session is used to track the user browsing the page. kindly let me know how can i redirect the URL being asked af

php jquery jcrop and imagejpeg

That's my first approach with GD stuff. I'm trying to implement resize and crop using jcrop jquery plugin. I still can't figure out how to save the image I've cropped. On the jcrop site there's not much about it. here's my code: if ($_SERVER['REQUEST_METHOD'] == 'POST') { $targ_w = $targ_h = 150; $jpeg_quality = 90; $src = 'demo_files/flowers.jpg'; $img_r = imagecreatefromjpeg($src); $dst_r = ImageCreateTrueColor( $targ_w, $targ_h ); imagecopyresampled($dst_r,$img_r,0,

Is there a sequence of loading of extensions/modules in PHP?

We installed the PHP extension for memcached server http://pecl.php.net/package/memcached using pecl install memcached which ended with an instruction to add "extension=memcached.so" in the php.ini, while we did that, we kept getting the error http://pecl.php.net/bugs/bug.php?id=17574&edit=1. So we removed that line "extension=memcached.so" from php.ini and added this line to the file /etc/php.d/memcached.ini and every thing worked fine. leaves me with a question.. is there a specific seq

Reasons for PHP's popen command to fail

I have a batch email process that sends about 30,000 email messages. I have ran into a strange problem where it gets to about 85% completion of the process and then the email start failing with the message Could not execute: /usr/sbin/sendmail I am using a library called PHPMailer 1.73 and the relevant code where the error message comes from is if(!@$mail = popen($sendmail, "w")) { $this->SetError($this->Lang("execute") . $this->Sendmail); return false; } The value of $sendma

Php Alternative to block a table

I have a table called 'messages' (INNODB) where the user can insert their own posts. I want to put a limitation. In my php script when the table gets to 10 records, you can not add more. The logic of the program is more or less as follows. Step 1. I run a query to count the lines that are in the table. Step 2. Recovered that value, I decide whether to insert a new post. My difficulty is in properly managing the possibility of two user who do the same thing simultaneously. If the user A is in

PHP simplexml_load_file - error handling

I'm loading a XML file from a foreign server which is working. But how do I receive an error message if the file does not exist or something else went wrong while loading it? This is my code: $xml = simplexml_load_file('http://api.example.com/2/image/' . $myhash . '.xml'); Also I'ld like to know what's the best practice if something like that happens. Should I just display an error message like "error - please reload page" or should I directly redirect the user like to the "homepage" or a

Php mysql if word match statement

how do i save the data, if 1) the word match Pros, it will be saved to t_pros column 2) the word that not match Pros, it will be saved to t_others column i heard i can use mysql CASE statement, but dont know how to use it? table pro: id t_pros t_others ------------------------ 1 Pros 1x 2 Pros 2x 3 voucher <input type="text" id="t_pros"> $db->query("INSERT INTO pro(t_pros,t_others) VALUES($t_pros, $t_pros)");

Php Session Data Not Showing When Cookies Disabled

I'm pretty new to PHP and am experimenting with cookies and sessions. So, in IE, if I set my Privacy settings to Block All Cookies, obviously all cookies will be blocked but what about sessions? I ask because I am under the impression that if cookies are blocked but I start a session, the session should be valid. In other words, whatever I set for the session variable should stick with the browser for as long as the browser is open but this does not seem to be happening. My whole thought proc

Php adding weekdays - clears the time

I've tired to add 10 weekdays to now. Everything is OK, but it clears the time part. Do you know why? $now = date("Y-m-d H:i:s"); echo $now.'<br>'; $mod = strtotime($now." +10 weekdays"); echo $mod.'<br>'; echo date("Y-m-d H:i:s",$mod).'<br>'; Output: 2011-05-23 14:34:02 1307311200 2011-06-06 00:00:00 My expected output were: 2011-06-06 14:34:02 Thanks.

Php Where are the index files of Zend Lucene?

the first time I indexed my data this way $index = new Zend_Search_Lucene('/tmp/search_index', true); This created a tmp/search_index folder in the public folder of my project. After I noticed there is something wrong with the index I just deleted all file in the search_index folder. After trying to reindex the data I realized that the search_index folder is empty. However the search gives still results. Where is the index data stored now? It's not in the public folder...

how to growl from php

I am trying to send growl notifications from PHP. The receiving computer is OSX and I am able to receive local notifications as well as notifications from ruby scripts executed from other computers. No password is set. I use the php-growl class and my code looks like this: <?php require 'class.growl.php'; $ip_address = '10.0.0.210'; $growl = new Growl($ip_address, ''); // Register with the remote machine. // You only need to do this once. $growl -> register();

Php concurrency in innodb

i have a code like this reserve.php $r=mysql_query("select count(*) from ticket"); $rec=mysql_fetch_array($r); if ($rec[0]==0) { insert into ticket values ..... } i have 1 ticket only. two users request reserve.php. "a" user request reserve.php and available ticket is 0 . but before insert, for "b" user available ticket is 0 yet. so two users reserve ticket. table is Innodb. how to prevent this? transaction , lock table or what?

  1    2   3   4   5   6  ... 下一页 最后一页 共 5106 页