php5

how to CREATE only 1 session with rc server when running PHPUnit selense html files?

My website has a Login page, so it needs to login first to run each html selense test file. The way PHPUnit framework works is creating independent test cases by running each test independently, which means it calls the Setup() function on each test case --> then calls Selenium RC Server--> then creates session id. My Code is below: req...

Wordpress Split Archives into 5 sections based on Category and tags

On my site (currently PHP5, wordpress 2.8.5) I have a lot of categories total=150. Each category is a City name ie: Paris, this has a tag associated with this category. ie: Hotel, Sports, Bars, Entertainment, Food total->5 On my Archive page I'm looking to produce a tabbed section based on my tags. ie: tab 1: tag->Hotel-> lists all ...

writing memcached connection using pecl based memcached extension

I am actually thinking to start using memcached in my php code, http://us3.php.net/manual/en/book.memcached.php while I searched in google, I find memcache based examples, but not much about memcached based connection and other examples. it will be really helpful, if someone can share procedural way of writing memcached connection for...

Symfony difference between <ModelName>.class.php and <ModelName>Table.class.php

Cuold someone explain me the difference between the Doctrine auto generated files .class.php and Table.class.php? For example in the Jobeet tutorial there's JobeetJob.class.php and JobeetJobTable.class.php (http://svn.jobeet.org/doctrine/trunk/lib/model/doctrine/sfJobeetPlugin/) I don't understand the role of each file and where I have ...

[PHP]: Remove URL part and file extension with strstr

I tried function: strstr, but it has one problem. Suppose, the URL looks like: http://www.example.com/index.php With strstr, I am able to remove anything before '/', but I want just: index i.e., the actual name of the file without extension. ...

[PHP]: Why "\" gives error while storing it in string?

My string looks like: $fullPath = $dirName . "/" . $file; If I replace / with \, it gives error: "Expecting identifier or variable". I want to store in the latter way itself. How to override anything coming in between? ...

PHP referring to object data with numerical key

I have converted an array to object data like this: <?php $myobject->data = (object)Array('zero','one','two); print_r($myobject); ?> And the output is: stdClass Object ( [data] => stdClass Object ( [0] => zero [1] => one [2] => two ) ) So far so good. But if I try to refer to the numerical keys... <?php $myobject->data = (o...

search string with preg_replace

$html = file_get_contents("1.html"); eval("print \"" . addcslashes(preg_replace("/(---(.+?)---)/", "\\2", $html), '"') . "\";"); This searches an string and replaces ---$variable--- with $variable. How can I rewrite the script so that it searches for ---$_SESSION['variable']--- and replaces with $_SESSION['variable']? ...

[PHP/JavaScript]: Call PHP file through JavaScript code with argument.

I want to call a PHP file but want to pass an argument to the PHP file. Not getting the correct approach, I am attempting to write a cookie and read that cookie when the PHP file loads. But this is also not working. I am using following code to write and read cookie. I just want to test the read cookie function of JavaScript here. I know...

[PHP]: Directory handling problem.

My project files are located on remote server in the folder. I access a file in this folder in this way: http://www.example.com/searchtest.html This opens a page with Input Box where user types keywords to search. The search script is a .php file located in the root itself. The script has to search for .html files with the name similar...

Doctrine ORM: Create Table Like Another

Hello, Is there any way, when using Doctrine, to create a table like another? I know in MySQL there is a function to do so: CREATE TABLE user2 LIKE user; and tables user and user2 will be identical. Can this be done in Doctrine? ...

PHP Paypal Class

Could anybody recommend a up-to-date class (or payment system) for handling paypal recurring payments with PHP? Thank you! UPDATE: I ended up using the PaypalNVP class by Peter Reisinger. Unfortunately, that was a very long time ago and I can't seem to locate it online (the readme and class files had no URL - just the name). If you c...

PHP cURL: How do I make it visit this website before continuing?

I am passing post data to a website, but I have to visit the homepage first before I can navigate to any other parts of the website. So how can I do that? Do I just use a header redirect and then have it execute the rest of the cURL? Update: I think this might be better than the solution below: http://coderscult.com/php/php-curl/2008/05...

How to use jQuery in a facebook application.

Hi all, I finished my application in locale and I want to integrate it in facebook creating an app. My application works well, but when I try to load it from facebook it doen't work. I've read that there's some problem including javascript that are not FBJS. I'm not using the facebook markup language but mine ( jQuery UI and simply htm...

PHP preg_match problem

Hi guys i'm having a problem, I have the following code: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="320" height="240"> <param name="movie" value="http://www.domain.com" /> <param name="quality" value="high" /> <param...

How to load helper from model in CodeIgniter?

I want to load some helper in a model. How to do this? Tried to use: ${get_parent_class($this)}->load->helper ('text'); But still getting an error Fatal error: Call to a member function helper() on a non-object ...

Is SQL injection a risk today?

I've been reading about SQL injection attacks and how to avoid them, although I can never seem to make the "awful" examples given work, e.g. this post http://stackoverflow.com/questions/332365/xkcd-sql-injection-please-explain I created a php file and a table in the database, had a value passed through $_GET and tried to delete the tab...

PHP Session is not destroying after user logout

I'm trying to create an authentication mechanism for my PHP Application and I'm having difficulty destroying the session. I've tried unsetting the authentication token which was previously set within the session array and destroying the session through session_destroy, as well as resetting the session array completely before destroyi...

PHP5: const vs static

In PHP5, what is the difference between using const and static? When is each appropriate? And what role does public, protected and private play - if any. ...

Masking Domain URL with Sub domain URL

Hai i'm having a subdomain (abc.example.in) but this is referred to mydomain/folder . the thing is i want the mask URL links and the masked url should be displayed following with sub domain can any one help me out . mydomain/folder/path to abc.example.in/path ...