php

How do I examine defined constants in PHP?

I'm stepping through the source code of CodeIgniter with Xdebug in NetBeans and I'm looking for a way to see defined constants as they are defined. If it's not possible, are there any other ways to display all defined constants? ...

get variable from one page

Hi, Guys I'am a newbie also my language maybe bad, and looking for solution for my learning php code let say i have many page i.e. etc page1.php ... page1001.php each page maybe: inside of page1.php: $color = "red"; $pages = "two"; $theme = "ocean"; $lang = "eng"; $charset = "ISO-8859-1"; etc (more..) inside of page2.php : $color = ...

How many SQL Updates functions are too many

I have a scenario where I have an inordinate number of updates that have to be performed on some text (mostly 64k text type fields, but potentially some mediumtext fields as well, which I think can contain 4MB?) fields (essentially, a search and replace on those fields). Here is how I know how to do it, but am unsure if this is the best...

Recusive xgettext?

How can I compile a .po file using xgettext with PHP files with a single command recursively? My PHP files exist in a hierarchy, and the straight xgettext command doesn't seem to dig down recursively. ...

Safely getting card number for payment gateway.

I have a payment gateway api for BluePay. My application is in PHP. I am able to process a transaction with code similar to this: bp->process(1111111111111111,.....) with 111111111111111 being the card number. the process function posts the card number to bluepay's site using PHP's CURL wrappers. How can I safely get a card number f...

Kohana - subfolders within views folder

I'm working on the admin section of a site using Kohana. I've created a "admin" subfolder within the views folder to store admin views. I'm also using a modified instance of the Template Controller for the admin section called Admin Template Controller, seen here: abstract class Admin_Template_Controller extends Template_Controller { ...

Reading RAW data from a Flash POST Request ( images )

I'm basically interacting with a third party API flash file to send HTTP POST requests to my server. I know I'm on somewhat the right path because it requires a crossdomain.xml file, and before I added that part nothing in the POST variables was showing up, however since I added that file there are 4 variables that are set, these POST v...

subtracting a percentage from a value in php

Im writing something similar to a coupon code function, and want to be able to handle both set amount codes, as well as percentage amounts. My code is as follows; $amount = "25"; // amount of discount $percent = "yes"; // whether coupon is (yes) a percentage, or (no) a flat amount if($percent == "yes"){ $newprice = ???????; // subtrac...

Best practices, PHP, tracking millions of impressions per day.

What do I have to do to make 20k mysql inserts per second possible (during peak hours around 1k/sec during slower times)? I've been doing some research and I've seen the "INSERT DELAYED" suggestion, writing to a flat file, "fopen(file,'a')", and then running a chron job to dump the "needed" data into mysql, etc. I've also heard you need ...

PHP: How to pass existing database connection to static class methods?

I have a set of static class methods. I also have an existing database connection in a script stored in an object variable $DB. How do I call those static class methods and let them use that $DB object without having to pass them this variable every time as a parameter on the class method? For instance, right now I'm having to use a glo...

sending other input with $_FILES php

Im uploading a file using the following jquery.. function ajaxFileUpload(jobid) { $("#loading") .ajaxStart(function(){ $(this).show(); }) .ajaxComplete(function(){ $(this).hide(); }); $.ajaxFileUpload ( { url:'addjobrpc.php', secureuri:false, jobID:jobid, fileElementId:'fileToUpload', dataType: '...

Google check out Merchant Id Not corrrect

Hi I am using google check out in my project. It is in sandbox mode. I am using Xml api check out , When i click google button in my page , i got an error message like " An error had ocurred: HTTP Status: 400: Error message: No seller found with id 623746024295438 " What is thie , Actually , i have that merchant Id and Key ,, Ple...

Installing Pdftk on Linux server

Ihave been using pdftk.exe in my windows local machine to play with some pdf and is working fine. I want to upload it to my server which is Linux. On searching i found out that i have to install pdftk on the server itself as a compiled package for Red Hat. How can i do this ?? can anyone help me on this?? ...

get Records from Excel sheet to MySQL database using php codeigniter

How to get records from Excel sheet to Mysql database using Codeigniter php? ...

Get original URL referer with PHP?

I am using $_SERVER['HTTP_REFERER']; to get the referer Url. It works as expected until the user clicks another page and the referer changes to the last page. How do I store the original referring Url? ...

Find all links in a string and transform them into anchor tags using PHP.

http://stackoverflow.com should become <a href="http://stackoverflow.com"&gt;http://stackoverflow.com&lt;/a&gt; EDIT: It would be great if anchor tags from the original string stayed intact. ...

php 5.3.1 and PDO

I am getting PDO::__construct(): OK packet 6 bytes shorter than expected in latest PHP 5.3.1, any idea or fixes? ...

How to get duration in terms of minutes by subtracting a previous time stamp from the present time in PHP?

How to get duration in terms of minutes by subtracting a previous time stamp from the present time in PHP? The format of time stamp is like 2009-12-05 10:35:28 I want to calculate how many minutes have passed. How to do it? ...

Part II: How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together

This question is a continuation of my last one, regarding How to make Ruby AES-256-CBC and PHP MCRYPT_RIJNDAEL_128 play well together. I've got that working now, but I'm still struggling to go the other direction. The PHP generated cryptogram appears to have all the information that was provided, but I cannot get the Ruby code to decry...

Simple php routing problem

I am setting up a simple routing system for my new custom MVC framework that I am making. Currently my router class views the URL as such: www.example.com/controller/controller_action/some/other/params So, essentially...i've been reserving the first two segments of the URI for controller routing. However, what if I just want to run t...