php

reCAPTCHA (Zend_Service_ReCaptcha) throws "Unable to Connect to tcp://api-verify.recaptcha.net:80"

Hi, I am using reCAPTCHA on this page but when I submit I get following error in my apache log: This started happening after I set ssl to true (i have to use it, becouse website is SSL) [Wed Jul 28 18:47:54 2010] [error] [client X.X.31.80] PHP Fatal error: Uncaught exception 'Zend_Http_Client_Adapter_Exception' with message 'Unable to...

how to handle online status. guest, users etc

Whats the best way to keep track of how many users and guests are online? Im making a forum for fun and learning Right Now I have a 2 fields in the users table called is_online and last_access_time. If current time is 5 minutes or more than last_access_time i set is_online it to zero. And if the signed in user refreshes browser i set i...

PHP stop closing tag being automatically added

When I add the string below to an array in PHP and output it, $spineArray[$i]="<itemref idref='part-$i' linear='yes'/>"; It looks like this when outputted. Why is the closing tag automatically added and can I stop it? Thanks. <itemref idref='part-$i' linear='yes'> </itemref> ...

Including a PHP class file only once

I'm using methods from a PHP class all over my code and I don't want to do "require_once" in every file I'm using that class. Is there a way to include the class in a single file, and then access it from everywhere in the code? Thanks! ...

php include statement

I'm working on my first website using php. I came up with a good way, or so I thought, to deal with including the css sheet depending on where I am. For example, I have a form that I submit to with this code: $root = '../'; function died($error) { include '../includes/header.php'; echo "We are very sorry, but there were erro...

Comparing large numbers in php and sql

I need to compare a very large number in php (30 digits long) with 2 numbers in my database. Whats a good way to do this? I tried using floats but its not precise enough and I don't know of a good way to use large numbers in php. ...

How can I enable use of math in my html web page

I have a blog where people can post their comments. My problem is that I need to enable people to be able to use math formulas using latex syntax. I cannot make any changes to the server. I can only embed a script in my HTML page. Kindly help. ...

PHP Object Oriented Way

So I am thinking of doing my PHP in OO way. Can someone tell me the advantage/ disadvantage of this? I think one advantage will be that my codes will be cleaner and easier to maintain. What about performance? How does doing PHP in OO way compare to just writing codes in non-OO way. My idea of an OO style is, for example, when handling e...

PHP+GD: imagecopymerge not retaining PNG transparencies

I have two PNG files, "red.png" and "blue.png"; they are both mostly transparent, but there is a few pixels of red or blue splotches in various places. I want to make a PHP script that merges the two; it should be as simple as something like: $original = getPNG('red.png'); $overlay = getPNG('blue.png'); imagecopymerge($original, $over...

PHP- HTML parsing :: How can be taken charset value of webpage with simple html dom parser?

Hi, PHP:: How can be taken charset value of webpage with simple html dom parser (utf-8, windows-255, etc..)? remark: its have to be done with html dom parser http://simplehtmldom.sourceforge.net Example1 webpage charset input: <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> result:utf-8 Example2 webpage ch...

.htaccess fix for a pretty permalink in PHP?

Maybe I'm going about this in the wrong way, but I have some pages in our homegrown CMS that I want to convert to using pretty permalinks. Currently, their page URLs look this this: http://ourdomain.com/articles/?permalink=blah-blah-blah I want to convert these to: http://ourdomain.com/articles/blah-blah-blah I have a column in the d...

how to generate javascript embed code

how to generate embd code/blgger like widget with CodeIgniter? please give me the idea how to make ...

Numeric order when returning results from MySQL

I have the following types of titles in a table in my db: Topic 1 blah blah Topic 2 blah blah Topic 3 blah blah ... Topic 10 blah blah Topic 11 blah blah etc... The select query will always return the results like this: Topic 1 blah Topic 10 blah blah Topic 11 blah ...leaving out Topic 2, Topic 3 etc... until after all the teens...

PHP - CSV file overwriting based on UID.

I know I know, a database would be the better idea with what I want to do, but I don't want the hassle of dealing with a database and learning stuff. I have a CSV that has something similar to TestUser,2010/07/27 13:26:25,2010/07/27 13:26:29,0.0011,0.0006,0.06 TestUser,2010/07/27 14:22:12,2010/07/27 14:22:24,0.0033,0.0027,0.27 TestUse...

Observer Pattern Logic Without OOP ?

Hi Stackoverflow, I was thinking about implementing a logic similar to observer pattern on my website, for implementing hooks. What I am looking for is something similar to this http://stackoverflow.com/questions/42/best-way-to-allow-plugins-for-a-php-application However the code there is too limited, as I cant attach multiple hooks t...

PHP 2 ASP cross domain script translation

Hi Everyone! I need to call via Ajax a routine on my PHP server from my clients site on his server. If my client has PHP, I have a short PHP script used to call a PHP from one server to another and avoid cross-scripting issues using CURL: <?php $q=$_GET["q"]; $q=str_replace(" ","^",$q); $ch = curl_init(); curl_setopt($ch, CURLOPT_U...

counting http requests

I want to count the number of all *.png requests on my site. Where/what files do I modify? Both 'success' and 'Not found' results should be counted. ...

Any Difference Between (int) 1 and 1 in PHP?

I was reading some code that a consultant provided us. It's a bit convoluted, and at the end of a function, it reads: return (int) 1; Instead of: return 1; PHP has a lot of magic in it; is this as bone-headed as it looks, or is there a valid reason to cast an integer as an integer? ...

modules on drupal sub-domains

My drupal site gets very heavy and slow as new modules are loaded. Some of these modules aren't needed except for the store section of the site. I'm thinking to create a store sub-domain and somehow load those modules only in that sub-domain. Does that mean that I have to install drupal twice, once on store.mydrupalsite.com and once ...

PHP: Creating Extensible CMS System

Hello, I have been given a new task from the client which is basically creating a CMS for actors/singers and the like that client will be selling out to them. It will basically be a package and would work out-of-box pretty much similar to WordPress, you just hand over to whoever buys it but of course this is not going to be a blogging ...