php

Janrain's PHP-OpenID and Google/Yahoo

I'm using Janrain's PHP-OpenID 2.1.3, and I've managed to get it working with all the providers I have tried except for Google and Yahoo. The major difference here seems to be that Google and Yahoo, unlike most other providers, don't use a user-specific URL, but rather have the user discovery framework all on their end - which throws the...

Best way to organize this structure?

I have a database of foods, which I would like to divide into a tree structure of categories, subcategories and sub-subcategories. For example, fruits -> apples -> fuji, or fruits -> apples -> cortland I would like each parent page to show its immediate children (fruits page shows apples, oranges and all other fruit; apples page shows ...

Step by step tutorial for xinc?

I am trying to get into CI development for a php project, after I failed with phpUnderControl because Java seemed to explode at me I wanted to try xinc. I got xinc installed just fine (mainly because I am good at php and knew what the errors it gave out ment). Is there a step by step tutorial for a project? I have only found this: http:/...

PHP To Perl Socket Communication

So far I have written a Perl server that runs constantly in the background, when it receives inbound connections a process is forked and that then handles that one connection. What I ultimately want it to be able to do is accept inbound php connections through the socket of course run these commands and then relay and information back. S...

PHP: is JSON or XML parser faster?

I'm building classes that interface with the Twitter API, and I'm wondering whether PHP's built-in XML or JSON parser is faster? Twitter will send me the same data in either format, so PHP performance will determine my choice. I'm using php_apc, so you can disregard parse time and assume I'm running off bytecode. Thanks! more: I'm jus...

Parse Error for a MySQL query in PHP

I got this error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/oznola38/public_html/code/classifieds.php on line 30 for this code: $qry = "INSERT INTO classified (name, address, city, state, zip, phone, fax, email, section, weeks, ad_text, link, display) VALUES ...

Basic JQgrid question - how do I get the examples to work?

Hi, I'm trying to replicate the inline editing jqgrid examples given at http://trirand.com/jqgrid/jqgrid.html I have tried reading the documentation http://www.secondpersonplural.ca/jqgriddocs/index.htm but I can't get the inline examples to work. . What am I doing wrong? I have created the database and have the default example worki...

Is there a PHP function to call all variables from a form?

Hey, I'm programming a feedback form on a website for a client, however, there are over 100 inputs (all uniquely named). I was wondering if there was a loop I could run to get all of the variables, do you have to call them like this: $variable = $_REQUEST['variable']; EDIT: I'm going with $_POST as recommended by everyone here - than...

AMFPHP + Drupal Setup Error

Hello, hopefully someone can help me with this headache I have. I'm currently running Drupal 6 and am trying to integrate AMFPHP so I can do some stuff with Adobe Flex. Anyway, I downloaded the AMPHP module and the other required modules. I go to my domain/admin/build/services and see the following expected data: Servers * AMFPHP -...

including php file change layout?

i have the strangest bug. in my php file i include several php files: <?php include("a.php"); include("b.php"); include("c.php"); ?> <html> <head> <link rel="stylesheet" type="text/css" href="src/main.css" ></link> <script src="src/jquery-1.3.2.js" type="text/javascript" ></script> </head> <body> some more code here... when the page ...

Using PHP and MySQL (or other means), how should I detect an abusive visitor?

What I would like to do is implement a system that would track how many times a visitor has requested a page from my website and then based on some sort of threshold, block the visitor if I deem them abusive (i.e.: attempting a DoS). My question lies in the implementation of such a system... What would be a good way to track the activi...

How can I put the results of a MySQLi prepared statement into an associative array?

I have a sql query and a mysqli prepared statement: $sql = 'SELECT photographers.photographer_id, photographers.photographer_name FROM photographers'; $stmt = $conn->stmt_init(); if ($stmt->prepare($sql)) { $stmt->bind_result($photographer_id, $photographer_name); $OK = $stmt->execute(); $stmt->fetch(); } How can...

How do you implement the "one step build" for a LAMP project?

Having the "one push build" to take your changes from development environment to live server is one thing that is very nice to have and often advocated. I came on board with a small team running in a LAMP stack and use SVN for version control, currently deployed on a single production server (another server for development and soon to...

DOMNode to DOMElement in php

I want to convert a DOMNode object from a call to getElementsByTagName to a DOMElement in order to access methods like getElementsByTagName on the child element. In any other language, I would cast and it would be easy, but after some quick looking, PHP does not have object casting. So what I need to know is how to get a DOMElement objec...

loading 'modules' data into views on a per user basis dynamically from one controller (codeigniter)

Hi, First off I am pretty new to this whole thing so feel free to tell me to bugger off. I am trying to load the views for a set of 'modules' for a user who has selected any number of available 'modules'. I can get the name of the module (or any column) from the database and load->view($name . '_view'); but can't seem to figure a way ...

I want to change Content-Type of the default in php

I mention it in httpd.conf as follows to let you interpret css as php <FilesMatch "\.css$"> ForceType application/x-httpd-php </FilesMatch Content-Type is output as text/html and is troubled. Therefore I added the next cord to the top of the css file. <?php header("Content-Type: text/css"); ?> It's not cool... Do you know how to...

Which one is less costly in terms of resources?

Im on an optimization crusade for one of my sites, trying to cut down as many mysql queries as I can. Im implementing partial caching, which writes .txt files for various modules of the site, and updates them on demand. I've came across one, that cannot remain static for all the users, so the .txt file thats written on the HD, will nee...

PHP Function to replace symbols with character codes to stop SQL Injection

I am trying to write a php function to stop MySQL injection attempts. What I am doing is using str_replace() to remove symbols and replace them with with their HTML character code. My issue is that the codes all contain &#; but I also want to replace those symbols with their codes. How can I do this without changing the code into somet...

reCaptcha Widget using PHP/Curl

Hello, I'm looking to build a small script that can load reCaptcha images from another website. Seeing as the reCaptcha widget works using Javascript, is there anyway for one to capture the image generated using CURL? ...

PHP Form Generator

How would I generate parts of a form using PHP? I would like to make a form that allowed the user to enter a date through drop-down menus of month, day, and year respectively without typing every single option of the menu, how would I automatically do so with PHP? For example, how would I generate the days 1-31 for January, 1-28 for Fe...