php

Zend Framework Problem

Hi, i get sometimes this error: Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session.php:462 Stack trace: #0 /www/htdocs/w00a1ed7/autospin/redaktion/library/...

static class inheritant not work in PHP?

abstract class base { abstract public function test(); public function run() { self::test(); } } class son extends base { public function test() { echo 1; } } son::run(); It reports: Fatal error: Cannot call abstract method base::test() But son::test() works,why and is there a way to...

Using SSL to connect to mySQL from PHP

Hi folks, I have a security consultant demanding that we implement encrypted connections to mySQL. He is concerned that the username and pass for the db are being sent cleartext when we connect. The mysql server is on the same network as the scripts though not the same physical machine. So the credentials will not be passed externally...

Is it bad practice to query two different databases on one page?

I'm working with a programmer who doesn't want me touching his database... I would like work with a database instead of hard coding my content but don't want the sites performance to suffer. Is it bad practice to query two different databases on one page? If its not a problem is there a limit to how many databases you can query per pa...

what is the concept for clustering web apps ?

Hi, I am going to built a web apps that (hopefully) someday it could serve thousand or may be millions users. Now, I need to know concept of clustering web apps. I have no experience about this in the past. For example, I have 2 servers, one located in Australia and the other located in USA. Both will be a cluster so they share the s...

Salesforce - Update/Upsert custom object entry

UPDATE: It's working as expected just needed to pass the correct Id, DUH!~ I have a custom object in salesforce, kind of like the comments section on a case for example. When you add a new comment it has a date/time stamp for that entry, I wanted to update the previous case comment date/time stamp when a new case comment is created. I ...

When should I use require_once vs include?

When should I use require_once vs include? (The code is in a custom wordpress theme if that matters) ...

sfDoctrineGuardPlugin: login with email

Hi, I'm building a webapp with symgony1.4 and doctrine1.2, and I wanna use the sfDoctrineGuardPlugin, but I have a little problem. sfDoctrineGuardPlugin is built to authenticate by username, but I need to change it to ask for an email. Any idea how to do it? ...

Asynchronous call doesn't return json

I am running wamp on an xp box. I am fairly new to web programming, this is for a student project, and have run out of avenues to try to solve this problem. Problem We have client side JavaScript code that uses GDownloadUrl- from the Google api- to wrap xmlHttpRequest calls to a php server side program that is accessing our database....

PHP: How to determine Unix Timestamp of midnight tomorrow?

I have the following code to determine the unix timestamp of midnight tomorrow. It seems pretty hacky to me and I wondered if anyone had a more elegant solution. date("U", strtotime(date("Y-m-d 00:00:00", strtotime("tomorrow")))); ...

Remove encoding using PHP

I have the following text: We%27re%20proud%20to%20introduce%20the%20Amazing I'd like to remove the encoding using PHP, but using html_entity_decode() does not work. Any suggestions? ...

Need to merge multiple pdf's into a single PDF with Table Of Contents sections

Will have 50-100 single PDF's that we'll be generating with a php script. PDF's are generally grouped into groups of 10-20. Each group needs to have it's own Table of Contents or Index, and then there also needs to be a Master Table of Contents or Index at the beginning. Or if that is too difficult we could get away with a single Table...

How do I store and retrieve language specific text in PHP?

I'm currently in the process of building a web application which will be used by people in different countries Currently all the messages that I output (i.e. errors etc) are in English. What is the best way to store language constants and retrieve them? It's quite likely that the messages may need bits of information injected into th...

How to construct a string based on regex and related parameters in PHP?

(?P<id>\d*)(/(?P<title>.*))? Most of the time,we use regex to match something,but how to generate the matching string if we have id and title already? Example,if id=4 and title='hello world',the result should be: 4/hello world But if we only have id=4,it should be: 4 Because as the regex indicates,title is optional. Two answers...

Drupal permissions not showing for custom content type

I have a custom content type in Drupal which was created using CCK. The create/edit permissions for this type are not showing up in the node module permissions, although other cck types are. This content type is also bound to a module, but this module doesn't have any admin screens, all node creation is done through the standard cck in...

Why do we need to base64 encode images before transmitting?

I've seen many code fragments that base64 encode images before transmitting over HTTP protocol. I am wondering why do we need it? ...

Converting UTF8 text for use in a URL

I'm developing an international site which uses UTF8 to display non english characters. I'm also using friendly URLS which contain the item name. Obviously I can't use the non english characters in the URL. Is there some sort of common practice for this conversion? I'm not sure which english characters i should be replacing them with. S...

How to remove new line (and some other) characters for csv output?

Hi I have some data (which users input using WYSIWYG editor). I have created a tool to create a csv copy of the data for some backup purposes. For each record I $csv_data .= str_replace( array('<br />','<br/>', '\n', ','), '', strip_tags($db_data['description']) ).","; for...

How to create TIMESTAMPS for SQL query for it to be sortable by date from PHP?

How to create TIMESTAMPS for SQL query for it to be sortable by date from PHP? So I have table created by such SQL script CREATE TABLE `Keys` ( `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `KEY` INT NOT NULL , `TIMESTAMP` DATE NOT NULL , UNIQUE ( `KEY` ) ) What sript should I write to: Add timestamps To sort\search thru that ...

MYSQL/PHP How do I insert a null value?

I'm having problems updating records to contain NULL values - in particular, a field which is of type Date. I'm using prepared statements and I've tried the following: // Fails $value = NULL; // Fails $value = ""; // Fails $value = "NULL"; all 3 of the above result in a date of 1969-12-31 being entered (0). How do I insert NULL val...