php

Reading a document from Rackspace CloudFiles using API

Hi - i have been using RackSpace CloudFiles to store certain images. I have the upload code working perfectly but when I try and read the image from CloudFiles it wont display it. The images wont render into the browser. The file is definitely being read as I can see the actual data from it but if I try and put in a header to render it o...

Drupal authcache - load dynamic content through ajax

I'm using Drupal 6 with authcache. I've read that you can load dynamic content by using ajax, even when the whole page is cached with authcache. In my template files, I've used this code to show Edit and Delete links: <?php if ($user->uid == $node->uid || in_array('moderator', array_values($user->roles))|| $user->uid == 1): ?> <span cla...

How to start a foreach loop at a specific index in php

Hello, I am writing a foreach that does not start at the 0th index but instead starts at the first index in my array is there anyway to offset the loop's starting point? ...

Load a picture in a webpage from Flash

I'm editing a web page to access it only after login, so now it's a php page with an inital <?php session_start(); ?> and in the body of the page I test the value of a session variable. All works fine but in the header there is flash animation that don't load background picture. In the old version of the page this picture was loaded f...

What is the best way to monitor subscribers to my ATOM feeds

I have a bunch of ATOM feeds, some generated dynamically others not, and I would like to be able to monitor the subscribers to each one. For the dynamic ATOM feeds, it is the same php file echoing different xml dependent on the $_GET data. Can someone tell me an efficient way to monitor the subscribers to my feeds? ...

Addressing multiple access conditions for a menu?

I'm in the middle of implementing permissions on a multi-level tabbed/dropdown menu navigation setup. Is there a better method to implementing permissions compared to wrapping each menu item in an if statement? User permissions are stored in a table and pulled in to an array, there are 10 menu items and each menu item has numerous sub-m...

Replacing accents with their counterparts

For some reason (it's a long story) I need to change the accents with their 'normal' counterparts. I'm doing this: $array = array( 'ò' => 'o', 'ó' => 'o', 'à' => 'a', 'è' => 'e', 'é' => 'e', 'ù' => 'u', ); return str_replace(array_keys($array), array_va...

Do I need to use mysql_real_escape_string on database data for re-insert?

Hello and thanks in advance. I am retrieving data from the db. The data already went through mysql_real_escape_string when it was added to the db. Once retrieved I am comparing it to a raw variable and depending upon the result I may be re-inserting the original db data back into the db into another, different, field. My question is, ...

Accessing $_COOKIE immediatly after setcookie()

I'm trying to access cookie value (using $_COOKIE) immediately after setcookie() function in PHP. But, $_COOKIE['uname'] returns blank. Why? Whereas, $_COOKIE['uname'] returns actual value when trying to access in next execution of the script. setcookie('uname', $uname, time()+60*30); echo "Cookie value: ".$_COOKIE['uname']; ...

Improve Preloader for img tags present in document

The main goal of this code is to run throw all img tags and load the image to the client cache. During this, I've got and image that will appear by hiding div's above it... Now, This are the answers I'm looking for: Is this really caching the images ? How to simulate the current animation with a less evasive code ? Can this code be r...

CSV to MYSQL parse issue

I am trying to parse a .csv file into a mysql database, and it's not fun. Some rows look like this: "Value", Value, "Value3", ,"Value,Value" And some look like this: Value, Value, , Value, , Value This preg_split worked well except for fields that were empty: foreach ($row as $item) { $item = preg_split( "/[,]*\\\"([^\\\"]+)\\...

Integrate PHP Applications (forms etc) into an CMS

Following scenario: We have to develop a lot of different forms and small or big php applications with Zend Framework. Those should be used in "any" kind of CMS System. Is there a best practice to load remote content (internal network!) One CMS Server - One Application server running apache with php. PHP renders the html and returns...

How to Add Columns to a Nested HTML Table

Good Morning All, I'm admittedly a DIV guy, but am working on a project that uses nested tables. I have a need to move some fields that already exist, and create new fields, into what I would describe as a grid (think gridview in .NET). What is the most painless way to add columns to the nested HTML tables? Alternatively, should I in...

Filter all types of whitespace in PHP

Hi, I know that there are many types of space (em space, en space, thin space, non-breaking space, etc), but, all these, that I refered, have HTML entities (at least, PHP's htmlentities() return something like &emsp;. But, what about those spaces that have no HTML entities? Example: http://iorbix.com/social/display-profile.php?id=71123...

Generate colors based on letters in PHP

How would I generate a color based on what letter a string begins with - perhaps A could be blue, Z could be green and the other letters would be the gradually changing spectrum in between? Thanks in advance. ...

Symfony propel:insert-sql with specified user?

I am running Symfony 1.3.6 on Ubuntu Lucid. My db connections for Symfony are made with a user with reduced priveleges (no need for CREATE or DROP for example) - for security reasons. I want to be able to run the propel task propel:sql-insert as root, so that I can create/drop tables at will. The brain dead way to do this would be to m...

Using java System.currentTimeMillis() with a php script and mysql table?

Hi, I've got a webapp (using php), my clients are java-based and are submitting dates to me using: System.currentTimeMillis(); so my web app gets it via a post, so it's a string, like: $submittedTime = "9734367890508"; I want to insert it into a mysql table field, I think either a DATETIME or TIMESTAMP field can store it. What t...

How to add per day and total visitors counter

I am developing a website using php, mysql, javascript, html, css. I want to add a counter in this website. I already added a counter in this website, that counter counts every visitor and show total visitors. But my client requirement is different, he wants different counters. Example: Online user = 2 Today visitor = 20 Total visito...

APNS PHP Sandbox Feedback

Hi, I've been reading this forum http://stackoverflow.com/questions/1278834/php-technique-to-query-the-apns-feedback-server And have done most everything that they have mentioned. I have the following code... $apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamC...

How can I get tidy to allow my custom attributes?

function myTidy($content) { $tidyConfig = array( 'indent' => false, //don't indent 'doctype' => 'omit', //don't include doctype 'wrap' => 0, // don't line wrap 'show-body-only' => true, //don't include <html><head><tit...