php

Sending a users credit card number to a printer with PHP

Hi there, I've been curious about this for awhile and could never find any good information. I used to work at a pizza place that did online ordering. The user would submit their card information and we would run it at the store. I was wondering if someone could give me an idea as to how this transaction took place. If it was PCI com...

PHP image editing

Read the bottom first, where the most current information is. Most of this is old information (though you might need it). I'm starting on making a PHP function that morphs/deforms an image you give it. I need to make a black background for starting, so this is what I have so far: (not anymore) function morph($img) { list($width,...

Redirect unless the page is called from jQuery

I have a page that is dynamically loaded into another page by an jQuery call. What I want is to make the loaded page accessible only if is called by the jQuery and to redirect if it's accessed directly from the browser address bar. How do I do that? Thanks! ...

Codeigniter and preg_replace

I use Codeigniter to create a multilingual website and everything works fine, but when I try to use the "alternative languages helper" by Luis I've got a problem. This helper uses a regular expression to replace the current language with the new one: $new_uri = preg_replace('/^'.$actual_lang.'/', $lang, $uri); The problem is that I ha...

nothing happens when clicking on my submit button no _POST values

Hi. For some reason nothing happens when a user click on my submit button. The html look like this: <td colspan="3"> <div align="center"> <input name="Decline" id="Decline" value="Decline" type="submit"> | <input name="Accept" value="Accept" type="submit"> </div><input name="place"...

Array diff of specific key within multi-dimensional array

I have two arrays of products, both formatted exactly the same, like so: $products = array( [0] => array( ['product_id'] => 33 ['variation_id'] => 0 ['product_price'] => 500.00 ), [1] => array( ['product_id'] => 48 ['variation_id'] => 0 ['product_price'] => 600.00 ), ) I ...

Sessions Not Working Like They Should PHP

Hi everyone! I have a simple form which passes a session variable and it simply fails to load on the second page, I have same version, php 5, on both boxes, works on one not on the other, I checked to see if session id's were the same, and they are, exactly the same on both pages of the form (NOT on both servers, these are obviously di...

Search an array for a matching string

Hi There, I am looking for away to check if a string exists as an array value in an array is that possible and how would I do it with PHP? ...

Optimizing a PHP page with many queries

So i have a site that I am working on that has been touched by many developers over time and as new features arised the developers at the time felt it necessary to just add another query to get the data that is needed. Which leaves me with a php page that is slow and runs maybe 70 queries. Some of the queries are in the actual PHP file f...

Unicode Surrogate Pairs question

Ok so I have a surrogate pair, example below: \u306f\u30fc Is there a function I can use to print the character to the screen? Regards, ...

php twitter grab retweet user info

i am working on a project in php. When we post something on twitter, i want to grab the users who have re-tweeted my tweet and store it in my database. I want to work in php and mysql. If I post a question on my tweet, i want grab the answers and save the userinfo of all the users who gave the right answer. Any suggestions on how t...

PHP: Problem submitting form in AJAX/JSON ?

currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input type='text' name='mytext2' value='123'> <input type='submit' value='Submit'> </form> <div id='textone'></div><div id='texttwo'></div> _home.php $arr = array( 'textone' => $_POST['mytext...

PHP and MySQL stats system.

What is the best database model to store user visits and count unique users using the IP in a big database with 1.000.000 rows for example? SELECT COUNT(DISTINCT ip) FROM visits But with 1.000.000 diferent ip's it can be a slow query. Caching will not return the real number. How big stats systems counts uniques visits? ...

How to create a collapsible list?

Is there a way I can have collapsible list and have the clicked list expand when clicked and stay expanded even when the page refreshes? I'm using PHP, CSS and Jquery ...

Displaying an associative array in PHP

I am trying to build a function that extracts information from a database and inserts it into an associative array in PHP using mysql_fetch_assoc, and return the array so another function can display it. I need a way to display the returned assoc array. This should be a different function from the first one ...

Displaying an associative array in PHP

Possible Duplicate: Displaying an associative array in PHP I am trying to build a function that extracts information from a database and inserts it into an associative array in PHP using mysql_fetch_assoc, and return the array so another function can display it. and i need way to display the returned assoc array this should be...

Is == in PHP a case-sensitive string comparison?

I was unable to find this on php.net. Is the double equal sign (==) case sensitive when used to compare strings in PHP? ...

fill array with values without loop in php

I'm wondering is there any method (that doesn't use loop or recursion) to create and fill with values an array. To be precise I want to have an effect of $t = array(); for($i = 0; $i < $n; $i){ $t[] = "val"; } But simpler. ...

Optimizing the website with .htaccess

I've tried to optimize my website using YSlow for directions. However, even though I have added the DEFLATE code at .htaccess to gzip the files, YSlow still doesn't show the files as gzipped. I tried testing my website using this: http://www.gidnetwork.com/tools/gzip-test.php and it shows that my webpages are not gzipped or compressed. H...

How to grab a value from a url with multiple values using PHP. [2 Part Question]

This is a two part question. First how can I grab the last url value from a link when I dont know how deep the value is, for example how can I grab the last value of sub_4 from the link example below using PHP? And second how can I grab the url value cat=3 and the last url value sub_4 using PHP? I'm kind of new to PHP so a detailed ste...