php

Check for valid gravatar (PHP)

I'm pretty new to PHP, so if you have any thoughts or suggestions to point me in the right direction, I'd be grateful. Trying to make a simple function to check if a user's email address translates into a valid Gravatar Image, but it seems gravatar.com has changed their headers. Using get_headers('[email protected]') ret...

Can I add extensions to PHP on windows that are not DLL files?

I've asked this somewhere else, but the people there don't seem to understand what I am talking about. When I go to the PECL website, all extensions found there are inside TGZ files. Which is not a problem, any modern archiving program can open it. Inside is always a .tar file and inside that are the source files. So, what do I do with...

When to use static vs instantiated classes

PHP is my first programming language. I can't quite wrap my head around when to use static classes vs instantiated objects. I realize that you can duplicate and clone objects. However in all of my time using php any object or function always ended up as a single return (array, string, int) value or void. I understand concepts in books ...

What means a class name in constructor of other class?

I read some scripts and I cannot understand why they put a class name in a constructor of other class: public function __construct(AclassName $foo){ $this->foo=$foo; } ...

Why is $count not updating?

$dir_handle = @opendir($url) or die("Unable to open $url"); $count = "0"; while ($file = readdir($dir_handle)) { if (!is_dir($url.'/'.$file) && ($file="*.jpg" || $file="*.gif" || $file="*.png") && $file!="picture0.*") { $galleryEventFile[$count] = $file; $count++; } } closedir($dir_handle); ...

Magpie RSS / User Authorization

How can I get Magpie RSS to identify itself as a user? HTTP Response: HTTP/1.1 401 Unauthorized is the error that i'm getting returned ...

Storing, Updating, Retrieving settings for a PHP Application without a Database

I need to be able to store data for a php application in a file. I need to be able to do this without any sort of external dependencies other than PHP itself. Here are the requirements I have: Settings will not be updated/added/removed very often. So updating of settings does not have to be very efficient. However, I do want to be abl...

How can I execute CGI files from PHP?

I'm trying to make a web app that will manage my Mercurial repositories for me. I want it so that when I tell it to load repository X: Connect to a MySQL server and make sure X exists. Check if the user is allowed to access the repository. If above is true, get the location of X from a mysql server. Run a hgweb cgi script (python) cont...

PHP set selected value of dropdown box

Hey everyone, I have a dropdown box that I construct with PHP. Here is the code: $region_result = mysql_query("SELECT * FROM region ORDER BY region"); $dropdown = "<select name='region'>"; while($row = mysql_fetch_assoc($region_result)) { $rid = $row["id"]; $region = $row["region"]; $dropdown .= "\r\n<option value='{$row['ri...

PHP/MySQL SELECT Statement - Slight Issue

Hello all, I have recently found a hole in my SELECT statement for a private messaging system that I am developing. Here's the basic structure of my table: tblpm: unique_id thread_id subject content receiver_id sender_id date_sent The page I am developing is the inbox, where all most recent messages are displaye...

Simple XML - Dealing With Colons In Nodes

Im trying to read an RSS feed from Flickr but it has some nodes which are not readable by Simple XML (media:thumbnail, author flickr:profile, ...) How do I get round this? Im trying to get the thumbnail by the way. P.S. My head hurts when I look at the documentation for the DOM. So I'd like to avoid it as I dont want to learn. ...

Why are PHP developers cheaper than .NET developers?

This is a two part question; firstly, does anyone out there have some insight as to why PHP contract developers would be available at a much lower rate than their .NET counterparts (around a 30% premium for the Microsoft guys)? I have some theories relating to ease of learning and cost of tools and servers but would like to get some feed...

Splitting a string up into parts

I have a list of questions in a table, some of which are only to be displayed if certain criteria are met. A record might have criteria as simple as 4002=Y where 4002 is the question number and Y is the answer. If 4002=Y then the question is to be displayed. For records with only one criteria I have no problem. But then there are reco...

php codeigniter assembling query results

My setup is as follows: Table 'data': 'title','body',...,'user_id',... Table 'users': 'user_id','some_val'... Basically I want to somehow join the tables 'data' and 'users' on the user_id field so that I can pull 'some_val' from the 'users' table. My problem is that not every user_id in the 'data' table has a corresponding entry in...

Measure the pronounceability of a word?

I'm tinkering with a domain name finder and want to favour those words which are easy to pronounce. Example: nameoic.com (bad) versus namelet.com (good). Was thinking something to do with soundex may be appropriate but it doesn't look like I can use them to produce some sort of comparative score. PHP code for the win. ...

PHP: Sorting array with natsort

I have a PHP script that creates a thumbnail and lists an image gallery. The problem I'm having is that it lists it by timestamp on the server but I want it to list 'naturally'. <?php # SETTINGS $max_width = 100; $max_height = 100; $per_page = 24; $page = $_GET['page']; $has_previous = false; $has_next = false; function getPictures()...

Php foreach loop on multiple objects?

I am using php/codeigniter, and typically to loop over query results I would do something like this: <?php foreach($data as $row):?> //html goes here <?php endforeach;?> But, say I have another object array, $data2, with the same number of objects as $data: is there any valid php syntax that would allow me to simultaneously access "ro...

Accessing database from bootstrap.php in CakePHP.

Is there any standard method of accessing the database in the bootstrap.php file with CakePHP? Specifically I want to set "putenv()" to a time zone that's stored in the database. Is there another way of achieving the same thing that I should be using instead? Thanks. ...

Parsing HTTP data into PHP variables

I have a reasonably large number of variables encoded in the form: foo=bar&spam[eggs]=delicious&... These are all in a single string (eg, $data = "foo=bar&spam[eggs]=delicious&..."). The variables are arbitrarily deeply nested -- easily four or five levels deep ("spam[eggs][bloody][vikings]=loud"). Is there an easy, reliable way to ...

Monthly Bill Payment Workflow

Hi All I am trying enable monthly billing module(just key the transactions no payment gateways) in the existing web based application and i am looking for any resource/info for bill payment workflow or is there any general standard or rule or best practice for bill payment workflow ? ...