php

CodeIgniter questions: native PHP sessions, code flow, layout issues?

I am just getting stated with CodeIgniter and am trying to hash out my regular modules/functions and get them working properly within the mvc framework. I have a few specific questions, if anyone has a strong background with CI: SESSIONS The CI session stores session data on the client side in a cookie, which just isn't going to wor...

Application Using PhpBB Session Data - can't use the short code

I've built web apps before that utilize PhpBB session and user data. The common move is to use code like this: define('IN_PHPBB', true); //replace $phpbb_root_path with path to your forum $phpbb_root_path = '../forum/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session managem...

How to extend this simple DataMapper?

Can someone please derive a concrete example from the following: http://www.urdalen.com/blog/?p=210 ..that shows how to deal with one-to-many and many-to-many relationships? I've emailed the author some time ago but received no reply. I like his idea, but can't figure out how to implement it beyond simple single table relations. Not...

How do you connect to multiple MySQL databases on a single webpage?

I have information spread out across a few databases and want to put all the information onto one webpage using PHP. I was wondering how I can connect to multiple databases on a single PHP webpage. I know how to connect to a single database using: $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect...

Regex for names.

Hi there. Just starting to explore the 'wonders' of regex. Being someone who learns from trial and error, I'm really struggling because my trials are throwing up a disproportionate amount of errors... My experiments are in PHP using ereg(). Anyway. I work with first and last names separately but for now using the same regex. So far...

Allow only certain websites to access a PHP page

I am trying to make a basic API for my website so certain other websites that I approve of can show content from my site. I have a PHP script on my server that the other websites can access to pull content in XML format. How can I make sure that only certain websites can access this php page on my server? ...

How do I test on a Windows environment for a Linux server?

I have an Ubuntu Server (with all of LAMP and Subversion installed). I use Eclipse with Subclipse, PDT and a few other great addins and use those exclusively to develop applications. The problem I'm having is that I'm developing on a Windows Vista machine and transferring everything to the remote Linux server. However, developing fo...

php output showing little black diamonds with a question mark

I'm writing a php program that pulls from a db source. Some of the varchars have quotes that are displaying as black diamonds with a question mark in them (unkown charecters, I assume from microsoft word text). How can I use php to strip these charecters out? ...

Is there a guide to path referencing in PHP?

I know how to include files that are in folders further down the heirachy but I have trouble finding my way back up. I decided to go with the set_include_path to default all further includes relative to a path 2 levels up but don't have the slightest clue how to write it out. Is there a guide somewhere that details path referencing for ...

CodeIgniter doesn't like functions in views?

I'm playing around with CodeIgniter, hoping to convert some of my old, ugly PHP into a more maintainable framework. However, I've come across a rather frustrating roadblock - I can't seem to define functions in my views. Any time I try I get a completely blank page back, and when I look in the debug log the processing seemed to stop afte...

What is a good solution for deploying a PHP/MySQL site via FTP?

I am currently working on a web application that uses PHP and MySQL, but I do not have shell access to the server (working on that problem already...). Currently, I have source control with subversion on my local computer and I have a database on the local computer that I make all changes to. Then, once I've tested all the updates on m...

Deleting all directories in an FTP archive that have a certain name using PHP

How would one go about deleting all of the directories in a directory tree that have a certain name if the only access to the server available is via FTP? To clarify, I would like to iterate over a directory tree and delete every directory whose name matches a certain string via FTP. A way to implement this in PHP would be nice - where...

How do you connect/retrieve data from a MYSQL database using objects in PHP?

Generally I connect and retrieve data using the standard way (error checking removed for simplicity): $db = mysql_select_db("dbname", mysql_connect("host","username","passord")); $items = mysql_query("SELECT * FROM $db"); while($item = mysql_fetch_array($items)) { my_function($item[rowname]); } Where my_function does some useful ...

Is there an OpenID 2.0 plugin for Symfony?

I am using sfOpenID plugin for Symfony, which doesn't support OpenID 2.0. That means, for example, that people using Yahoo! OpenID can't login to my site. There is an OpenID 2.0 plugin that works with sfGuard, but I am not using nor planning to use sfGuard. Plus, it requires to install Zend framework, too, which is an overkill in my sce...

Is there something like a translating database for strings?

I am in search for a database with translations so I can have comonly used phrases and words translated by a machine and not by an expensive translator. Is there such a thing as a translation database with words and often used phrases? If you don't know any would you use such a service? edit: the database should only be monitored by pe...

Is there a way to measure parse time in PHP?

Optimization of PHP code via runtime benchmarking is straight forward. Keep track of $start and $end times via microtime() around a code block - I am not looking for an answer that involves microtime() usage. What I would like to do is measure the time it takes PHP to get prepared to run it's code - code-parse/op-code-tree-building tim...

WCF over HTTPS with PHP throws "Method Not Allowed" exception

I've created a .NET WCF service that is intended to always be over HTTPS. When I first created the service skeleton and ran it over HTTP, it worked fine. I used PHP5 to test the interoperability with the built in SOAP functions. However, once I switched to HTTPS, when I try to call the function from PHP, I get a fault back with the messa...

Multi file upload with PHP/Javascript and no flash

I'm trying to make a webpage that allows the uploading of multiple files at the same times. I will limit the file extensions to the most common images like JPG, JPEG, PNG and GIF. I've done some research on this and everywhere I look it's flash this and flash that. I don't want to use flash really. Especially with Flash 10, which disab...

How to keep a website with url routing directory independent

I'm developing a PHP website that uses url routing. I'd like the site to be directory independent, so that it could be moved from http://site.example.com/ to http://example.com/site/ without having to change every path in the HTML. The problem comes up when I'm linking to files which are not subject to routing, like css files, images and...

Parsing Domain From URL In PHP

I need to build a function which parses the domain from a url. So: http://google.com/dhasjkdas/sadsdds/sdda/sdads.html or http://www.google.com/dhasjkdas/sadsdds/sdda/sdads.html Would become "google.com" and http://google.co.uk/dhasjkdas/sadsdds/sdda/sdads.html would become "google.co.uk" ...