php

Is there any way to get a referring function's name in PHP?

I have a function that is often called inside of other functions, and I'd like to be able to find out automatically what the name of the referring function (if any) was. Something like this: function do_something() { do_something_else(); } function do_something_else() { echo referring_function(); // prints 'do_something' } I...

Information on accessing SVN repositories via PHP

Googling this does little good, as you can imagine. Does anyone have resources that outline how the PHP Subversion support works. I need to open a repository on disk, and read new commit logs, etc. Anything you have, would be helpful. Except the PHP docs. I have those already :) ...

Authorize.net Payment integration

I'm looking to do Authorize.net payment integration with a website using PHP. My questions are: 1) Where I can find a tutorial, development guide, and/or code samples for doing this with PHP. 2) Is it possible to obtain a test account to do the integration like Paypal's sandbox, or does one need to have a live account to which you can...

How to list all countries and its states/provinces in php?

Is there any quick guide/reference to list all the countries and its states/provinces? Like when I click US, it will list: Alabama, alaska etc ...

Implementing Server Push

Read about Server push here. I want to push data to client from my web application in real time. I was looking at TCP sockets as one of the options. For HTTP I found a variety of frameworks for Java, PHP, Python and others over here. However I don't know whether any of these support Push. What options and frameworks would you suggest...

Shell equivalent of php preg_match?

Is there a shell equivalent of PHP's preg_match? I'm trying to extract the database name from this string in a shell script. define('DB_NAME', 'somedb'); Using preg_match in PHP I could just do something like this. preg_match('define(\'DB_NAME\','(.*)'\'\)',$matches); echo $matches[1]; How can I accomplish the same thing in a she...

Increasing PHP memory_limit. At what point does it become insane?

In a system I am currently working on, there is one process that loads large amount of data into an array for sorting/aggregating/whatever. I know this process needs optimising for memory usage, but in the short term it just needs to work. Given the amount of data loaded into the array, we keep hitting the memory limit. It has been incr...

Autosaving Form Input Using Prototype and PHP

I'm implementing a relatively simple autosave system and I'd like to do so using the Prototype library. I'm using the PeriodicalUpdater request, but it's not working as I'd hoped. In short, I'm trying to, periodically, send a textarea's content via an AJAX request to a PHP page that will save it to a MySQL database. I'm doing somethin...

random and unique subsets generation

Lets say we have numbers from 1 to 25 and we have to choose sets of 15 numbers. The possible sets are, if i'm right 3268760. Of those 3268760 options, you have to generate say 100000 What would be the best way to generate 100000 unique and random of that subsets? Is there a way, an algorithm to do that? If not, what would be the bes...

Automatic href Link click

Hai i want to generated an automated click event. I am working in php server, i Know Javascript. Below is my Code <script language="javascript"> function autoClick() { var elm=document.getElementById('thisLink'); elm.click(); document.getElementById('thisLink').click(); } </script> </head> i put this on inside the body ...

AJAX: How do I make the button submit after I press "Enter"?

Currently, I am using an with ajax to update my mysql. Now, I have to click on the button with the mouse for it to work (I am using onclick), but how can I make it accept the "enter" button? My guess is... Enter isn't working because isn't there. If I leave it there, my ajax just doesn't move. ...

create thumbnails using for loop

How to create Thumbnails from an unzipped image folder using for loop in Codeigniter? ...

PHP equivalent for a python decorator?

I want to be able to wrap a PHP function by another function, but leaving its original name/parameter list intact. For instance: function A() { print "inside A()\n"; } function Wrap_A() { print "Calling A()\n"; A(); print "Finished calling A()\n"; } // <--- Do some magic here (effectively "A = Wrap_A") A(); Output:...

How to get the directory of file inside itself with PHP?

A.php: <?php ... ?> How to know the directory within itself? EDIT On windows,how to change "\" to "/"? ...

Web 2.0 Advantages?

The GWTPHP Framework here says the following: One of the advantages of Web 2.0 based applications is that the traffic between client and server consists only of data. You don’t need to send long HTML code that defines design, only data - so the communication and reloads are very fast. I don't seem to understand this, ...

jquery sortable update can work only one time?

Need a way to make element show in the div,but when i use ajax send data to list.php.it can not work? PHP: <?php mysql_connect('localhost','user','password'); mysql_select_db('fruit'); $days = 3; for($i=1;$i<=$days;$i++) { ?> <ul id="sortable"> <?php $sql = "select * from menu where columnNo = '$i' order by orderNo ASC"; ...

about Monit and PHP

Excuse me, may I ask in linux, is there any way to call php code from the monitrc file of Monit? THanks ...

Why this PHP snippet failed to match anything?

var_dump(preg_match_all('/(job_show\.asp\?id=[0-9]*)">/s',':</font><a href="job_show.asp?id=42"',$match)); $hrefs = $match[1]; var_dump($hrefs); Output is: int(0) array(0) { } It's supposed to match "job_show.asp?id=42" ...

User Recommendation Email Body

Hello, The code below works great. It allows a user to send emails to other people in order to recommend my site. How can I replace "Michael" below with $_POST['sendername']? I tried and it didn't work. Thanks in advance, John $msg = "<html><body>Hello, your friend Michael recommends that you use <a href='http://www.site.com/'...

what is a good approach in dealing with remote captcha validation in jquery?

I am using Kohana's Captcha library which generates the captcha image. I am using jquery to validate the captcha. The problem is when I enter a wrong text in to match the image against, the captcha library seems to be generating another captcha image but won't output it in my current form. The validation is remotely done by calling a con...