php

Will mod_gzip compress the cookies

I have a php web application that uses big cookies to store a lot of users data. If I set mod_gzip on the apache server, will it compress only the page content or will it compress the cookies also? ...

Help with a jquery country/state list

Is there a better way to do this jquery code? Currently I have to use PHP to insert the starting position of the jquery code. The code is for a country/state list. If a user picks USA then a state dropdown list is below it, if any other country is selected, then it will show a different text input box and hide the dropdown list. ...

MySQL cuts off string at special chars

Hello, I'm trying to insert remote POST data (articles sent by iSnare) into MySQL with PHP. Data comes successfully from remote POST sender and I can write it to plain-text file without a problem. Unfortunately, when it comes to insert it into MySQL, MySQL cuts off string (article) at special char. I tried many things but still I'm uns...

Portable Code for Frameworks?

We have decided to work with the "Insert Framework Here" We'll most likely update to the next major version of the framework as they come up- however what upper management is worried about, is "What if" the framework roll's over and dies, and code becomes unmaintained? The chances of this happening are very low, but I still have to de...

Multiple GET or POST variables 404's wordpress pages (numeric permalinks)

I am developing a live-action tag game (called DeTag) that uses a web interface for reporting kills. When a user wants to report a tag they go to a page to confirm who and when they tagged, then actually "kill" them (called pre-tag.php and tag.php respectively). However in trying both POST and GET data for the three variables I need (us...

Order of an item in MySQL query result

Is there a way to know the order of an specific item in a query result with traversing the whole set? I have a web application that show user comments in Ajaxified way, I would like to send the user a link to their comments like this: http://my.web/post/12345#comment%5F45 and using the hash value "comment_45" load the comment page wit...

CMS vs Filesystem storage id scalability

Hi, Please consider the following: I am storing around 1.2 Million TIF files ranging from 40 KB to 120 KB in size. These documents are stored on a windows server with NTFS file-system. The documents are stored using the following variables: client document type image folder actual image See below: C:\<client_id>\<doc_type_id>\i...

How do I extract <input> tags from and (X)HTML input in PHP?

Hi, I need to extract all the tags from an HTML file, In such a way that I would end up with either an array containing key=value for each of the attributes, or at least the raw text that makes up the tag. I don't quite get along with regex, much less in PHP, so I would really appreciate some help in this. PD: Some of the tags may sp...

Adobe Air and PHP

i do not fully understand how to communicate between adobe air (using flex3) and php. i do understand that many use AMFPHP and Zend AMF. However, AMFPHP seems to be outdated and Zend AMF (from what i understand) only works with the Zend framework (something I dont use, nor like IMHO). My Question Is: Are there other ways of communicat...

file upload security, htaccess, and changing extensions

Hello, all. I'm pretty new to web development, so please be gentle. Apologies if I'm posting a topic that's already been discussed; I searched but couldn't find quite what I was looking for in another thread. Background: I have a site that allows file uploads, but once uploaded, they won't need to be viewed by anyone but me. I've ...

PHP PDO PASSWORD HASH?

In a basic mysql insert you are able to set a password variable 'PASSWORD($password)' but this breaks a PDO statement. How do you hash the password while using pdo::prepare and pdo::execute? $sql= "INSERT INTO contractors (userid, password, name) VALUES ('$userid', '$pass1', '$name')"; $result = $dbh->prepare($sql); $count = $result-...

PHP Autologin function to login script

How would I implent an autologin feature to this script? session_start(); $result = mysql_query("SELECT id FROM users WHERE username = '{$_POST['username']}' AND password = '{$_POST['password']}'"); if (isset($_POST['savelogin'])) { setcookie("SaveLogin", $_POST['username'], tim...

Testing How Code Scales

I am currently working on some Ajax heavy code and I am wondering how my server will scale as more and more users (hopefully) start to use my web app. It is only on my internal test server for the moment and I was wondering how I would go about simulating a few hundred or thousand users so that I can see how it handles a heavier load. ...

Displaying an XML file with XSL within an existing webpage

Hi, I'm trying to get an html page to display an XML file formatted with an XSL stylesheet. Whatever examples I see are either displaying it in a new page, with the XSL stylesheet taking care of the tags, but no examples where I can clearly see it being displayed as part of an existing webpage... I'm using a PHP script to generate the ...

Is there a shorthand way to assign a group of variables to each of the values of an array in php?

In perl I can write ($var1, $var2, $var3) = split(/:/, "foo:bar:blarg") to split a string by colon and assign each array element to $var1, $var2 and $var3. Is there a similar syntax for this in php? I have to use the variables in a lot of my code so I want them to have meaningful names, and writing variable assignment code like $arra...

Shared/pooled connections to backend services in PHP

I'm trying to figure out the best way to minimize resource utilization when I have PHP talking to various backend services (e.g. Amazon S3 or any other random web services -- I'd like a general solution). Ideally, I'd like to have a single persistent connection to the backend (or maybe a small pool of persistent connections) with some ca...

Reduce an array to just the 'named' keys.

Hello All, I would like a hint or much better a solution for this: I do a regular expresion match to an url for example '/product/100/' preg_match('/^\/(?<name>\w+)\/(?<digit>\d+)\/$/', '/product/100/', $matches); As result of this I get the following array on $matches: array 0 => string '/product/100/' (length=13) 'name' => str...

How can I ensure my website always opens as www.mysite.com and not mysite.com - this messed up my Google OpenID logins?

Hi guys, my website has a log in by open id feature. When a user logs in for the first time using his/ her openid they are redirected to a create account page. I noticed just recently that one user when logged in using her google account created an account for the first time. However when she tried to log in again using the same google a...

Smarty AutoBind PHP Variables to Smarty Variables

In my smarty code I write a lot of code such as this: $smarty->assign('priorityList', $priorityList); $smarty->assign("groupview", $groupview); $smarty->assign('processList', key($processList)); $smarty->assign('taskList', $taskList); See how annoying it has become; I use the same name for Smarty variables and PHP variables, and yet I...

how to grab image from .php with imacro

How do I save an image from a php script for instance an image from index.php with imacro? Thanks ...