php

unexpected T_ELSEIF

$pages = array("grac", "zamknij", "dolaczyc"); $pagesid = array("showNews", "showThread", "showProfile"); foreach ($pagesid as $page) { if (isset($_GET[$page])) { include('sobra/'.$page.'.php'); } } // just pages elseif (in_array($_GET['page'], $pages)) { include("$_GET[page].php"); } // error else include('error.php'); gives:...

Why does fgets hang on a certain url on wamp, but is fine on mamp?

I have a script that reads RSS feeds using fopen & fgets. When trying to the feed at: http://rss.fok.nl/feeds/nieuws my script hangs until the max_timeout of the PHP is reached. The thing is: it worked perfectly (on the same url) until today. it still works on my development mac MAMP server. it doesn't work on the production WAMP ser...

Load testing the UI

I have been working on a site that makes some pretty big use of AJAX and dynamic JavaScript on the front end and it's time to start stress testing. But how do you properly stress test something that requires clicking several links on the front-end? One way I was able to easily hit every page of the site quickly and repeatedly was to poin...

Need help with regular expression in PHP

I'm looking at a string and trying to get everything inside the pair of brackets. The contents may change and the max and min may not exist in certain cirumstances. get(max(fieldname1),min(fieldname2),fieldname3)where(something=something) sort(fieldname2 asc) The where() and sort() are not guaranteed to be there. There may be spaces b...

Becoming a multi language programmer

I am a (self-proclaimed) PHP guru, but Stackoverflow pointed out some serious flaws in PHP. I also know the syntax of C++, C#, Obj-C, java, bash and ruby. But going from building a "Hello world" to building a real-world application isn't trivial. Any suggestions to spend more time on languageX (professionally/paid) while phasing out t...

IE 6 and the multiple button elements all sending their name & values.

When using multiple button elements in a form, I realised that IE7 sends the innerHTML instead of the value of the button. All good I thought, I'll simply change my PHP code to this <?php if (isset($_POST['button-name'])) { add_product_to_cart(2); } ?> Now my old friend IE6 is going a little step further at being a nuisance. It s...

How to set up SVN with files that are in an /htdocs directory structure

I'm having a slight issue wrapping my head around on how to set up Subversion when working with php files. I store all my files at c:\www[nameOfProject]\htdocs and I setup virtual hosts for each project. (c:\www\project1\htdocs\index.php maps to http://localhost/project1/index.php). How do you guys handle using SVN? Lets say I have c:\...

Submitting Data via GET with "Snoopy" in PHP

I'm trying to send data to a url via GET in PHP. I've decided to go with the Snoopy Class after receiving an answer to another question here. The thing is, I cannot seem to find very good documentation/examples for the methods in this class. I see the ->httprequest() method, but I don't see where I can add an array of values along with ...

IIS7 + PHP + Zend - Not executing <= *pic*

I have PHP, IIS7, ReWrite Module for IIS and Zend all installed. I can execute PHP pages just fine, even got PHPINFO showing up. I setup a Zend quickstart app on IIS and when I open it this is what I see: You can see from the source that it's not executing the <= portions. Any idea what needs to change? ...

How do you search a table for a definition to a word in jQuery?

This is a little hard to explain, but I have an HTML table, full of SQL definitions, that cross-talk a great deal. For example, one is talking about "INSERT statements", and mentions a "unique key". Another one of the rows talks about unique keys. I'd like to create little definition bubble (when you hover over "unique key" in the INSER...

Why isn't Suhosin part of the PHP core?

It seems Suhosin patches and extends the PHP core as a means to protect users from flaws in the core. It also seems some smart people are using this system. Since it appears to be a good thing, I'm curious as to why its not part of the PHP core to begin with. Anybody know? Update: Apparently some distributions of Linux also package PHP ...

Is it ever ok to store password in plain text in a php variable or php constant?

As per question, is it safe to store passwords on php pages such as $password = 'pa$$w0rd'; If the users can't see it, it's safe, right? EDIT: Some people actually suggested using hash, however, there would be a problem with database server connection password, wouldn't it? ...

script to tell me who, and how many users, are online

In my research to find a way to make PHP tell me how many people are 'online' on my site I've discovered that there are ways to 'estimate' this. I've chosen to log everything that happens on the site, also for error-management sake, but now i'm stuck at writing my SQL query. Basicly I have a database with 'IP', 'userid' and 'datetime'...

Generating WSDL when using PHP's native SOAP class?

Hello, I'm using the native SOAP class in PHP 5, having changed from NuSOAP as the native class is faster (and NuSOAP development seems to have ceased). However the PHP 5 SOAP lacks the ability to generate WSDL. Has anyone experience of generating WSDL in PHP? If so, please recommend your preferred method. Thanks. ...

Will splitting up included functions improve PHP performance?

Hello. I have main php-file with main class. Also in this class i do require_once("func.php"); which has many useful functions for my site. Size of func.php is very big, because there is many functions for different actions on different pages. But I include it on every page, because including called by main class. What I need to d...

Best way to defend against mysql injection and cross site scripting

At the moment, I apply a 'throw everything at the wall and see what sticks' method of stopping the aforementioned issues. Below is the function I have cobbled together: function madSafety($string) { $string = mysql_real_escape_string($string); $string = stripslashes($string); $string = strip_tags($string); return $string; } However,...

Repeater, Datalist in ASP vs PHP

Can anyone give me some suggestion please. In ASP we can use datalist and repeater control to repeate the rows but how can we do similar in php. I am designing a private message page for the similair as inbox page. Please can anyone help me. ...

Problem with flooding menu (php,javascript,ajax)?

I have two drop down menus on my website. Technologies used are Javascipt , php , mysql. City : [ ] Area : [ ] TODO: When user selects city I want to query database for areas in city and dynamically populate the area drop down menu. When user selects area I want to query database again for results that belong to that p...

List of all PHPUnit assertions

Where can I find a list of all PHPUnit assertions? ...

Extracting a subset of values from an associative array (php)

I want to do something seemingly very simple, but I can't find anything about it: simply extract a subset of an array similar to array_splice, but using keys to retrieve the values : $data = array('personName' => 'John', 'personAge' => 99, 'personId' => 1, /* many more data I don't need here ... */); list($name, $age, $...