php

How can I stop PHP sleep() affecting my whole PHP code?

So, on my arcade, howlingdoggames.com. I have a points system that gives you a point every time you visit a page with a game on, now, to reduce abuse of this, I would like to make some sort of delay, so its only awarded after 45 seconds. Here's what i've tried. ... if ($_SESSION['lastgame'] != $gameid);{ sleep(45); $points...

how to link web clients to the respective running background scripts ?

say a php script executes a ruby script in the background each time, php script is run from the browser. what would be an approach to associate the logged in user on the website, to the running background ruby script ? this is so the logged in user on the website can get feedback on the running ruby script they executed by visiting a s...

What is ideal software setup for programming web applications (editing php, javascript, xhtml, css) ?

I've been developing web applications for 2 years now, and have been into simpler web pages for many more. I've been using Notepad, then ConText, then Crimson Editor (was my favorite for a long time) and I've been trying with Notepad++. I have NetDrive setup so I can edit and save files directly on the ftp server. On Firefox I use the We...

Users entering ampersand & character messing up my sites w3c validation

Hi guys, my social networking site is w3c xhtml valid however users are able to post blog reports and stuff and at times enter in ampersand characters which in turn mess up my validation. How can I fix this and are there any other single characters that I need to look out for that could mess up my validation? ...

[PHP/MySQL]: Is there a way to store text in Rich Text Format in MySQL table?

I have given en Entry Form to the user to input values that are stored in a MySQL table. There is one column called "Project Details", wherein the user can input upto 200 characters and this column is of type "varchar". Till here everything is fine. The problem starts when the project details contain a number of points that are to be li...

Help with PHP arrays and foreach

Hey guys. I'm building a simple blog and have my data returning from my database in an array. I want to show the comments associated with each blog post but I'm not sure how to organize this in a loop. This is my array: Array ( [author] => Administrator [post] => Testing entry number one [entry_date] => Fri, 23 Oct 2009 ...

SoapFault exception: [HTTP] Unsupported Media Type when accessing Java web-service from PHP

I'm trying to connect to a Java web-service using the Zend_Soap_Client from the Zend Framework v1.9.0: <?php include( 'Zend/Loader/Autoloader.php'); $autoloader = Zend_Loader_Autoloader::getInstance(); $client = new Zend_Soap_Client('https://webservice.com/webservice-war/webservice?wsdl' , array('encoding'=> 'UTF-8')); try{ $resul...

PHP cURL getting encoded data

I have downloaded page header and compressed body in one string by using cURL, problem is that I don't know how to split them from each other and how to decompress body? Thank you! ...

Variable functions and variable names in PHP

Hi, In PHP, say that you have some code like this: $infrastructure = mt_rand(0,100); if ($infrastructure < $min_infrastructure) $infrastructure = $min_infrastructure; //do some other stuff with $infrastructure $country->set_infrastructure($infrastructure); $education = mt_rand(0,100); if ($education < $min_education) $education = $min...

ASP.NET Learning Path for a PHP Programmer

I'm a beginning PHP programmer with little real-world experience (haven't even graduated yet), but I'd like to learn ASP.NET to possibly qualify for twice as many jobs in web development as opposed to knowing just PHP and having seen far too many !== false I love the idea of working with a strongly-typed language. I started using the MVC...

How to display a side nav menu with many sub-categories using PHP and MySQL?

Okay I was wondering how can you use PHP and MySQL to create and display a side nav menu with many categories and sub-categories? I just don't know where to begin coding the PHP code? <ul> <li><a href="" title="">First Nested Link</a></li> <li><a href="" title="">First Nested Link</a></li> <li><a href="" title="">First Nested ...

Execute PHP on clicking a link

My website's pages are (or will) all be identical, except for the content of the #main div. So I was thinking in the <head> I could do <?php $page = "home.html"?>, where home.html is the bare contents (not a full html page - no <html>, <head> etc.) of the main div for the home page. So then inside <div id="main"> and </div> I could have ...

Insert node in xml using php

Hi all, I want to insert text node and create element in xml using php for example XML <?xml version="1.0"?> <employees> <employee> <name>Albert</name> <age>34</age> <salary>$10000</salary> </employee> <employee> <name>Claud</name> <age>20</age> <salary>$2000</salary> </employee> </employees> I want ...

PHP Registration Form - SQL

Hey all, I want to make a Registration form from PHP to register their username and password into my SQL Database. Here is what I have: config.php: <?php $host['naam'] = 'localhost'; // my host $host['gebruikersnaam'] = 'root'; // my database username $host['wachtwoord'] = ''; // my database password $host['d...

cannot login on website from mobile browser nokia 5800

Hi, Does anyone recognize this problem. If I try to login on my mobile it reloads and sends me rightback to the index/login page. The script recognizes a mobile browser and it will show a different indexpage. I have tested everything with firefox while using the switch user-agent addon. So, No problems working from a normal browser, ...

PHP Class arguments in functions

Hi, I'm having trouble using an argument from my class in one of that class's functions. I have a class called company: class company { var $name; function __construct($name) { echo $name; } function name() { echo $name; } } $comp = new company('TheNameOfSomething'); $comp->name(); When I instantiate...

Magento, add Clothing size attribute without Configurable Product

I want a simple way to let my user pick there clothing size before buy but Configurable Product seems like to much overkill. you have to make a product of every size and then you have to make a configurable product. the shop is for my dad and if i have to explain him how he has to do this it would be weeks for him to know this, (it took...

Fastest PHP Type Jugling with settype() vs *val() functions?

I am trying to figure out the fastest way (in PHP 5) to check that a value is the type I need it to be. I created two lines of code which both do the same thing. The problem is that I can't figure out which is fastest based off of benchmarks. (is_scalar($value) ? intval($value) : 0); settype($value, 'integer'); I created the following...

PHP parsing simple_html_dom

Hello, I am stuck with a semi-hard problem with 'simple html dom' (php class used for html parsing). I've used it many times before so I know how to do simple parsing. PROBLEM: $k=0; for ($k = 0; $k < 15; $k++){ $link[$k] = 'www.madeupaddress.com/' . $test[1][$k]; print($link[$k]); $test = file_get_html('$link[$k]'); echo($test); } W...

how do you detect CGIproxy ?

i have cgiproxy (http://www.jmarshall.com/tools/cgiproxy/), which lets users use it to navigate pages. it seems like myspace.com detects it and forwards the user to google.com doing a quick test to determine my ip using the proxy fails, meaning it doesn't reveal my ip. it shows proxy server's ip. <?php if (getenv("HTTP_X_FORWARDED_FO...