php

Selenium more than one baseUrl per test class

I am writing selenium scripts on a complex web based application. To use a useraccount I need to register first using one URL and then approve the account in the admin console on another URL. The problem is that there is another baseURL for registration and admin console and I need that in one unittest. But when I use setBaseUrl in my...

Flex Client application - HTTPRequest problem in the initialize function.

Hello all. I have a serious problem in my flex client applications. I have an apache server with php web services. the flex client makes an httpservice requests. I noticed that the httpservice requests that runs from the creationComplete event of the application does not always get data from the server. but HTTPservice requests called fr...

What would be the regular expression for finding "RT @"?? And removing it as a potential result?

I am getting these results from my api query on twitter. I would like to not display the Retweeted ones. How would i accomplish this in PHP? RT @BarclaysWealth: RT @BarclaysStock: Investment ViewPoint - We take a look at what a hung parliament could mean for the UK economy http://bit.ly/OaYh7 From: InfoFocus: at: Fri, 07 May 2010 21:...

PHP: Change color of text based on $value

What's the easiest way to change a text's color based on a variable? For example: If $var is between 1-5, green. Between 6-10, Orange. Greater than 11, Red. ...

hook_form_alter not working

Hi, Im using drupal 6.16. The below code for hook_form_alter is not working. Im simply trying to change the 'Log In' to 'Sign In' on the submit button of the user login form <?php //$Id$ function helloworld_form_alter($form_id,&$form) { switch ($form_id) { case 'user_login_form': // Change 'Log in' to 'Sign in'. $for...

What's holding up my PHP script?

We've got a PHP crawler running on our web server. When the crawler is running, there are no cpu, memory or network bandwidth spikes. Everything is normal. But our website (also PHP), hosted on the same server, stops responding. Basically the crawler blocks any other php script from running. What could be the problem? EDIT: ** fsockop...

PHP system() help

Hello, I have this shell script #!/bin/sh ############################################################# # Example startup script for the SecureTrading Xpay4 client # # Install Xpay4 into /usr/local/xpay4 # # To run this script automatically at startup, place the # # following line at the end of the bootup...

"'" is displayed as u0027 in facebook app - how to fix that?

I have a facebook app that is displaying random quotes - it is written in php. One quote in the database looks like this: "There's only one rule in photography - never develop colour film in chicken noodle soup. - Freeman Patterson" When it is seen on facebook it looks like this: "Thereu0027s only one rule in photography - never dev...

Handling login with PHP script called from a flash document

I'm setting sessions. And then checking the session by another PHP page. When I login using the browser and then checking using the browser then everything is ok. When I check the is Logged or not by calling the PHP file from a flash file then it can't find any session data. Why is that? and how to solve it? ...

Difference between numeric and string value in PHP

Hi everyone, I am getting a difference when comparing two string which are 0 and '0' in PHP. Can I do anything to make them be compared equally in an if action? Thanks! ...

PHP line break with file_put_contents()

I can't seem to figure out why the following code doesn't produce a new line in my text file - neither does using \n etc either - any ideas what could be wrong? $data = $name . ' | ' . $_POST['comment'] . PHP_EOL; //write to file $f = file_put_contents('posts.txt', $data, FILE_APPEND); ...

PHP: How to access array values returned by a static function?

I am running following code, getAccount() is a static function, $ac_info = AccountClass::getAccount($ac_code); print_r($ac_info); and getting following output AccountClass Object ( [account_code] => [email protected] [username] => XYZ [email] => [first_name] => [last_name] => [company_name] => [id] => [email protected] [balance_in_cents]...

Contingent Header Category Label

Right now the header has a bit of code in it that queries the section name and then uses that section name as the h1 title in the page. It works fine. However, I want to selectively break that operation in certain categories and give myself the ability to manually enter the h1 title for a given section. Here's what I'm struggling with...

Why i get everytime the error-message that i've already sent the headers

Hey, i've another question about web-programming. I programmed a login script, but everytime when i try to login it says that i've send the header informations already. Here are the 2 files: <?php if($_GET['logout'] == 1) { setcookie('authorized', 1, time()-3600); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitiona...

How to sort a multidimensional array by a certain key?

This should be really simple, but what is the way to go on this. I want to sort an multidimensional array by a key, like this: Array ( [0] => Array ( [iid] => 1 [invitee] => 174 [nid] => 324343 [showtime] => 2010-05-09 15:15:00 [location] => 13 [status] => 1 [created] => 2010-...

Getting the error "Unexpected $end" in my class file

I'm writing a php library that handles different products, somewhere in my class I must have a missing curly brace or something but I can't find it. Does someone with a debugger or keen eyes see anything wrong with this code? http://pastie.org/953994 Thanks in advance! Edit: I think it's something with the query in the EquipmentData...

Difference between :: and -> in PHP

I always see people in serious projects use :: everywhere, and -> only occasionally in local environment. I only use -> myself and never end up in situations when I need a static value outside of a class. Am I a bad person? As I understand, the only situation when -> won't work is when I try following: class StaticDemo { privat...

$facebook->getSession() returns null in the example code. is that ok?

Running the example code for the Facebook API I get a null session object, and I should get a non-null object giving the comment in the code. What am I doing wrong? In other words, in my index.php this fragment from the example code shows "no session" when I go to http://apps.facebook.com/my_app in my browser: <?php require './faceboo...

conditionals in wordpress

Why this code works fine: <?php if (**is_page**('4')) { ?> <style type="text/css"> body {background-image:url("<?php bloginfo('template_url'); ?>/images/bac4.jpg");} </style> <?php } else ?> and this not: <?php if (**is_category**()) { ?> <style type="text/css"> body {background-image:url("<?php bloginfo('template_url'); ?>/im...

PHP upload problems

Hello, Any ideas why this isn't working? I've used it many times before. I have a folder called 'uploads' in the same directory $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['file']['name']); if(! move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $error = 1; } The file input form see...