php

Passing sessions or authentication state between PHP and ASP.Net

We have a current (legacy) PHP based website that is unlikely to be redeveloped for the next year or so, that acts as our main portal. We would like to develop new applications in ASP.Net, and plug them into the current portal - but we do not want our website users to have to log in twice. Whats the best way to share authentication sta...

2 SQL queries in one line - how?

The following errors,so must be wrong,but what is the correct way to do this: $query = "SELECT * FROM tblProducts WHERE ProductId ='$SCId' AND SELECT * FROM tblProducts WHERE Cat ='$CatType' AND Type ='$TypeType'"; $rsPrimary = mysql_query($query) or die ("Query '$query' failed with error message: \"" . mysql_error () . '"'); $num...

Store in Session Data vs store in Sql Database for temporary data

Hello, I am wondering whats more efficient, to store temporary data (related to that session) in a session using say $_SESSION variable in PHP or store and retrieve from an SQL database? Thank you for your time. ...

How to filter a result set using the query string in PHP / MySQL?

I'm building an events page similar to last.fm/events The user can filter events by date, category etc, with the parameters passed in the query string My question is, what's the best way to structure your code (queries, loops) to allow for these different query types, and potentially combine them (e.g. filter by date and category) I'm...

PHP - HTTP Post - incorrect headers

Hi I'm currently trying to post an xml file to an external server, but I'm getting a response back that the headers are incorrect. The server I'm posting requires some headers and I'm wondering if they're in the correct format or if there are any other "standard" headers that need to be included? My code is: <?php function httpsPost($...

How to push Headers from a file on an external server to download?

The following script is what I usually use to push headers to the browser so that the dialog box appears for users to download a file. However, in this case the file resides on a different server. I though this should make no difference but it does as when I execute this script with the URL of an externam MP3 file it gives me a "ERROR: ...

Jquery sortable list won't serialize, why?

I'm implementing a sortable list of images with jquery in a Zend Framework application. I just can't get the .sortable('serialize') method to return more than an empty string. When I try with a few simple examples outside my application it works. Does it matter that the snippet below is wrapped in various other and other tags. I think...

What's the fastest way to get started with Kohana PHP framework?

I have been reading that Kohana is good for my project. So now I want to get started. My PHP knowledge is 2 years old and very limited now. But I am experienced with object oriented programming and other patterns, since I develop in Objective-C. I know a little bit about databases. People told me the Kohana documentation is horribly poo...

How do I receive email and process it in a web application

I have set up an email id my PHP web application. Users will send emails to this id. I want to process these emails in the application. Ho do I go about doing this? Thanks in advance. ...

How can I truncate a string in PHP?

How can I truncate a string after 20 words in PHP? ...

php hash form string to integer

Does PHP have a built in function for doing string to integer hashes, something that's difficult to reverse? Now, I know I can probably get away with doing an md5, and treating a substring of it as a radix 16 number, but I'm looking for something built in. Thanks. ...

table pagination and filtering with javascript and php

Hello, Let's say that you have to generate and display a table after querying a database using PHP. The table might have a lot of rows. One must be able to filter the resulting table using different criteria (single or multiple selections), much like an Excel table. example: +----------------------------------------------------------...

Joomla to Static HTML website

Hi, I have a Hindi magazine website hosted on Joomla. Though helpful from publishing point of view the site was a maintenance nightmare. Joomla is so much susceptible to hacker attacks. My host will often shut down my site due to bots attacking my website. Recently I relaunched the site as a new Wordpress based site on a different name....

Anything wrong with this PHP

Can you see anything wrong with this code, or can it be optimised? Code from index.php, to include the file if(empty($_GET['t'])) { $folder = "apps/"; }else { $folder = str_replace("/", "", $_GET['t']) . "/"; } if(empty($_GET['app'])) { include('apps/home.php'); } else { if(file_exists($folder.$app.".php")) {...

Kohana: Which alternatives are available?

Since Kohana seems to be very poor documented and my time is valuable, I may want to stick with something that lets me get a web platform faster up and running. I know it forked from Code Igniter. I actually like the idea of Kohana, but since the big hole in documentation it seems to be a bad alternative. Well, almost everyone on the ne...

PHP - Hashed array, insert at Index?

Hi, i wrote an array wrapper class PersonArray which can contain objects of a certain type (Person). Every person has a unique getHash() function which returns the ID + Name as a unique identifier. This allows for speedy retrieval of the Person from the PersonArray. The PersonArray actually holds two internal Arrays. One for the storage...

http post headers

Hi, When I post some headers in a request and view them on on the receiving page, most of them are prefixed with "HTTP_" except for a few like [CONTENT_TYPE] => text/xml [CONTENT_LENGTH] => 8647. When I post my own headers (which are required for an external server) they then get prefixed e.g. My header: BATCH_TYPE shows up as HTTP_...

Extract elements from array so it only consists values of a specified index

I have an array array( array('total'=>10,'v'=>3229), array('total'=>20,'v'=>3129), array('total'=>30,'v'=>3391), ); is there a one line way to convert the above to the following in PHP? array(10,20,30); ...

forcing access to __PHP_Incomplete_Class object properties

I'm writing a module for a php cms. In a function (a callback) I can access an object that comes from the framework code. This object is of type ' __PHP_Incomplete_Class' because the needed header file is not included before the session starts. I cannot include it without hacking the core cms code. I wonder if is possibile to access t...

Issue with PHP getting an incorrect date from a C# web service

Ok this has been driving me nuts now for about 12 hours. I have a C# web service running under IIS 7 and I am connecting to it via PHP on a Apache 2.2 box. Not that any of that should really matter but figured I would drop it in. Now when I go directly to the web service and invoke it I get the correct datetime format but if I call it f...