php

How can I validate CSS within a script?

Is there a library out there which will validate CSS? The only tools I can find to do so are web sites. If one of these sites has an API, that would fit the bill, too. I have a script that serves as a CSS compiler. It sets various variables according to settings for a theme, and generates and writes a CSS file. Before committing to wri...

PHP Include calling other files.

I realized I used a particular function over and over again in my PHP files, so I took the function out of all of them and put it in a seperate PHP file and included it where I need it. Now when I make updates to the function, all the files that use it get updated. Great. Now there is just one problem, the function itself uses relative...

how do i get a all flickr photosets of a user using YQL ?

all i need to do is to find all photosets of a user_id and then get all photos within that photoset if one clicks on the photoset using YQL ...

Converting binary to string then back to binary

Hello all, This is the synopsis: the PHP code is an interpreter of commands given in a terminal-like fashion, so as a string. Basically PHP receives a string argument, interprets it based on a given regular expression and then execute it. Here, the code receives a string similar to ftp>fput -file(contents-of-file) In this case, the ...

PHP Return Section of a Multidimentional Array

I have an array with a series of event IDs organized like this: $event['year']['month']['day'] = $event_id (full structure below). Basically, I want to output the next 5 events (or so) from a given date (such as today). I've gone through the PHP manual, but haven't found a suitable solution. I suppose I could just iterate through each ...

Retrieve data Mysql / Php where date

hey, I'm wondering how to retrieve data from my database using php to get the top songs today. Right now I'm just getting the top songs using $result = mysql_query("SELECT tag, COUNT(*) AS the_tags FROM tags GROUP BY tag ORDER BY the_tags DESC LIMIT 16"); I am also storing the date in the tags table aswell, in the format 07-25-201...

Trouble using MySQL transactions with loops in PHP

Hello all, I am trying to set up a MySQL transaction such that I can loop through a bunch of queries (see below) and if any of them fail, rollback all of the changes. I am finding however that if one fails, not all of the queries are rolled back. Am I doing anything wrong here? mysql_query("START TRANSACTION"); foreach($array1 as...

PHP: Error trying to run a script via Cron job

Hi all, I have setup a cron job via my Control panel. I have uploaded the script via my FTP, set up it's permission as 777 (is it safe to do so?) & gave the path to this script in the job. Now the script makes use of dependent scripts to be able to run the job. Confusing? Here's what it's like: cron.php <?php require("some_file1.php")...

__get/__set/__call performance questions with PHP

I have a custom-built MVC PHP framework that I am in the process of rewriting and had a question about performance and magic methods. With the model portion of the framework, I was thinking if __get/__set magic methods would cause too much performance hit to be worth using. I mean accessing (reads and writes) model data is going to be ...

PHP: how do I know the caller of a function ?

how do I know the caller of a function in php ? ...

Implementing Gravatar into custom Commenting System.

Hi guys! I'm in the process of coding my very first blog. With the help of various tutorials, and other forums I have managed to gather a semi-working code. Right now I have a code that takes and displays the comment, but the problem is I wish to display Gravatars beside each comment. I was just wondering how exactly I would go about im...

Using multiple feeds in simplepie with codeigniter

I'm trying to get simplepie to loop through a few rss feeds using codeigniter but I can only get it to display the feed items from the last feed in the array. I think it is to do with the foreach loop in the _get_feed function but everything I've tried has failed to fix it. In my controller I have this class Main extends Controller{ ...

Create link in PHP with Get Parameters

I'm really new to php, but I'm working on a simple web page. This page is quite configurable with different parameters. So, it may be called like: www.example.com/index.php?test=1&foo=3&bar=4 Now my question is, what is the idiom for generating a link to the current page but with one parameter changed? For example, I'd like to change...

Looking for super simple but effective BUG/Feature list that users can vote.

I am looking for some javascript or php code where it allows anyone to enter something in a list, and allows people to vote (1 vote per IP or cookie) or rate (not important, OK, important). There would be two lists, one for people suggest features and also rate features up and down in the list. The other would be bugs, for people to vot...

How to extract a UTF-8 string (In Arabic) from a MySQL DB and echo to screen using PHP

Hi, I have a MySQL db, i've set collation = utf8_unicode_ci. I'm trying to fetch the value through PHP but i'm getting "???" instead of the actual string. I have read about this subject and tried using mb_convert_encoding but it didn't work, what am I missing? Can someone please post a code snippet that actually pulls a value from a ...

Creating a regex to parse some HTML

Possible Duplicates: How to get string from HTML with regex? RegEx match open tags except XHTML self-contained tags Hey there. So i have some HTML code that i need to parse. I was wondering what the regex would look like to do this? Basically the HTML is a large HTML document. The structure looks something like this. //Ra...

PHP: Code checker since PHP is a loose type / dynamic language?

I have a small PHP web-based application that is beginning to grow moderately in size. I'm starting to become concerned with managing my PHP code base, given PHP is a loosely/weak typed, dynamic language. How do others manage their code based for loosely/weak typed, dynamic languages? Do pre-parsers exist for PHP that allow me to runs...

regular expression help

Possible Duplicate: Programmatically access currency exchange rates Hi . I need a help again. The deal is that i want to load a postbank.bg homepage, then just catch the HTML table where the exchange rate is , and to get the rates in an undertandable array which i can then process... Any ideas , which is the easyest way ...

PHP 5 - Securing an admin area of a site

I'm currently writing a couple of MVC sites using Kohana as my framework. Each has a simple admin area where the admin can upload and edit content. I'm currently storing the admin's user model in a session and checking whether or not they're an administrator with the following method: private function checkAdmin() { if (!isset($_S...

Listserv functionality catchall or not?

I am looking to create a listserv functionality for my website in the style of google groups. That is, someone creates a group and thus, a group email address is born. Should i be using a catchall or should i come up with some way to automatically create a mailbox when someone creates a group? ...