php

In CakePHP Auth - is there a way to force https on all actions requiring Authentication (but not others)

Using CakePHP Auth, I want to have all actions that require being logged in to also be forced to use https. Is this possible via a Callback somehow? Further info: I have Admin routing in use as well as certain "member-only" actions. Using cakePHP 1.2 also. many thanks for any pointers on this. boobyW. ...

upload image out side site root directory

I want to upload image out side site root directory using php? can any one tell me that how I give path of directory out side root for image upload ???? ...

Is "PHP In Action" still one of the best books

Hi A friend directed me to this Question "What is the best PHP programming book?" and from there suggested that "PHP in Action" is the book for me (me been a born again programmer that hasn't coded in 7 years but wants to re-code a project i got outsourced). The question i ask, "is it still one of the best books to learn php or has php...

update session variable by ajax

how we can update session variable by ajax in a php page. ...

i have a function written in java programming, i want to convert it into the php.

public static String convertHexString(String hex){ byte[] bytes = new byte[hex.length() / 2]; for (int i = 0; i < bytes.length; i++) { bytes[i] = (byte) Integer.parseInt(hex.substring(2 * i,2 * i + 2), 16); } sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder(); System.out.println(encoder.encode(bytes)); return encoder...

The point of PHP's recent dropping of [[:POSIX:]] regular expression flavor

Dropping of the ereg-functions and their POSIX-regular expression flavor in later PHP versions? After reading an older posting concerned of this - and reading the official PHP statement I'm inclined to ask what this is about. Following the development of PHP over the years (and doing much development in Perl and PHP) I'm really unsure i...

what is rediffmail and hotmail host name and port no??

Im using for rediff: $mail->Host = 'smtp.rediffmail.com'/'smtp.rediffmail.com'/;(i tried both) $mail->Port = 25; and for hotmail: $mail->Host = 'smtp.live.com'; $mail->Port = 25/587; (i tried both) but the response i get is... SMTP Error: Could not connect to SMTP host. wat is d problem?? or is der any othe problem??? ...

Shorten Array in PHP?

I want to shorten an array so it only contains 30 elements. If for example I have an array of 100 elements is it possible to take it and chop of (as to speak) 70 of those elements? ...

Best way to check for existing user in mySQL database?

I am trying to create a user login/creation script in PHP and would like to know the best way to check if a username exists when creating a user. At the moment, I have the following code: function createUser($uname,$pword) { $server->connect(DB_HOST,DB_USER,DB_PASS,DB_NAME); $this->users = $server->query("SELECT * FROM u...

Creating "Like" buttons for arbitrary elements on my site, and reading back the status - possible?

I'm a total newbie to Facebook programming and would like to know, as a follow-up to this question, whether the following is possible. I have a collection of events on a web site. I'm fetching them from several RSS feeds, and have total freedom in how to output them - e.g. as single pages, so there is a permalink for every event. I wou...

formatting date string in cakephp

I'm new to cakephp, I've got a simple Users controller that corresponds to a users table. I have a created field in the table that I want to ouput on the view action using the niceShort() function. how do I use it in the view? Current code is: <p>Member since <?php echo $user['User']['created']?></p> thanks, Jonesy ...

How to find out the time difference and added to the previous storedtime?

Hi friends, I have the two times like this 2010-08-09 11:16:06 2010-08-09 11:19:12 I need to find out the time difference between these two dates and also I need to store difference between these two.For example here the difference is 00:03:02 And if the user again start the timer and stop it for example the second starting time is 20...

Checking if values equal true in PHP

How can I check if each value in the variable $c = 90,89,78,88; equal true I think you call it an array in my script one at a time? This part checks the variable. if($cat['id'] == $c){ $url = $parent_url . $cat['url']; echo '<a href="' . $url . '" title="' . $cat['category'] . '">' . $cat['category'] . '</a>'; } H...

Sync mysql table data from client to master

I have run in to a slight problem. The story goes as follows: I have a document archive system (written in PHP) which runs at multiple clients (23 at present). On their system they only have their documents. Every night, they all need to be 'synced' to a master database on site (central server). I have access to each MySQL database from...

Configure symfony project for Multiple Domains

We have a product developed in PHP Symfony framework. We have couple of clients right now for whom we are maintaining different code base and databases (MySql). They access their respective code base using subdomain like client1.myproduct.com and client2.myproduct.com Now we want to make a single code base for both the clients and onl...

Seems to be a syntax error in my MySQL

MySQL is putting off the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `badips` ( `id` int(10) NOT NULL auto_increment, ' at line 2 When I run the following PHP: if (file_exists("../login/includes/confi...

Uplodify error when flash is installed

I have used uplodify for multiple image upload .When i installed macromedia flash 8 in my system the uplodify is not working, it showing an error Error calling method on NPObject in swfobject.js.It was before i installed macromedia flash 8 can any one give any solution for this one In my system i got this error, but in other syste...

Generate a PHP UTF-16 SHA1 hash to match C# method

I'm trying to replicate some C# code in PHP5 and am having some difficulties. The C# code is as following, and it is important to note that it cannot be changed: string s = strToHash; UnicodeEncoding encoding = new UnicodeEncoding(); byte[] bytes = encoding.GetBytes(s); SHA1Managed managed = new SHA1Managed(); bytes = encoding.Get...

How to add parameter to multiple rendered URLs?

Hi, I've got a PHP page serving content into an Iframe on another website, and it needs to re-load content inside the Iframe according to user interaction on the host website. The page content that's inside the Iframe contains multiple URLs. In order for the Iframe interaction to work, I was thinking of using a request parameter in the...

How to integrate magento products in amazon store with API

i like to appreciate if anybody like to help me??/ ...