php5

Moving from NuSOAP to PHP5 SOAP

Hi, I have been working on a script with PHP4 that relies on NuSOAP. Now, I'm trying to move this to PHP5, and use the buildin support for SOAP there. $wsdlPath = ""; // I have obviously set these variables to something meaningful, just hidden for the sake of security $apiPath = ""; $username = ""; $password = ""; // PHP5 style $cl...

PHP 3 to PHP 5 Upgrade... Variables in 3 didn't have $ in front... is there a setting for back compat?

OK, this is an odd request, and it might not even be fully true... but I'm upgrading someone's system ... and they are using OSCommerce (from a long time ago). It appears their variables are referrenced without a dollar sign in front of them (which is new to me). I haven't done PHP in about 7 years, and I've always used dollar signs. I...

How To Generate PDFs with PHP

I have some HTML that includes bolding, italics, small tag, big tag, blockquote tag, bullets, and numbered items. I need to convert it to PDF via PHP. I tried FPDF, but it was entirely too complex. I tried html2pdf PHP library, which uses FPDF, but it was very buggy and unreliable. What do you recommend? Note: Imagine your typical resum...

What is the best way to get config variables into a class in php 5?

This is for my DB class. I am new to OO, been a procedural lad for some time, so I'm still a bit murky. My first idea was using a bunch of setter functions/methods.. but after writing a whole bunch, I thought about using PHP's define function, like so. define('MYSQL_USERNAME', 'jimbo'); Is this an accepted practice? What is the best ...

PHP5 Classes - Can you get a calling class's variables?

Okay, so I'm new to OO and still kinda new to PHP5. I have a class Page that creates an instance of DB, which is named $db. In the __construct() of Page, I create the new $db object and I pull a bunch of config data from a file. Now the DB class has a method _connectToDB() which (attempts) to connect to the database. Is there a way i...

How to redirect to (or enforce) SSL connection?

I am using Zend Framework(MVC part of it), and need to either redirect user to SSL enabled page or to force SSL from controller somehow and don't quite see how to do that? Maybe someone can share the knowledge? Thanks! ...

PHP: Process a CSV or XLS file

I need to let users pick a CSV or XLS file from their filesystem and press Submit and have PHP open it, look at it, decide if it is valid and then put the data in MySQL. I am stuck on how the server gets the file they pick from their desktop? Do I have to upload the file they pick to a temp directory? Can I just take a copy and check...

How can I have over loaded constructor in Php5?

I have two constructor : function clsUsagerEmailUserName($nickName, $email) { $this->nickName = $nickName; $this->email = $email; } function clsUsagerEmailUserName($email) { $this->email = $email; } But this is not working? What's wrong, isn't supposed to be OO at this version of ...

PHP 5 and ImageTTFText() suddendly stopped working with XFILES.TTF

Hi We have a very weird problem concerning the use of a TTF-font with a specific name(!) in PHP5 running in Apache: ... $ttf = "./XFILES.TTF"; //Schriftart ImageTTFText($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text); The font file doesn't work anymore when it is named XFILES.TTF - no errors are displayed, the text just is...

character-based pagination - inserting page breaks on text, not punctuation or code

Hi guys. I'm writing code to generate character-based pagination. I have articles in my site that I want to split up based on length. The code I have so far is working albeit two issues: It's splitting pages in the middle of words and HTML tags; I want it to only split after a complete word, tag, or a punctuation mark. In the pagina...

Best solution for __autoload

As our PHP5 OO application grew (in both size and traffic), we decided to revisit the __autoload() strategy. We always name the file by the class definition it contains, so class Customer would be contained within Customer.php. We used to list the directories in which a file can potentially exist, until the right .php file was found. T...

Can PHP do a fairly trivial inheritance thing?

I have the following code: abstract class AbstractParent { function __construct($param) { print_r($param); } public static function test() { return new self(1234); } } class SpecificClass extends AbstractParent {} When I invoke SpecificClass::test(), I am getting an error: Fatal error: Cannot instantiate abstract class Abstract...

changing a class name throughout a development

Hi I'm in a situation where I have the class "progress" - trouble is that I'm interested in incorporating some open source that also has the class "progress". I remember very vaguely some reference to an app that's able to inspect the various files in a development for a given class name ... and either return it ... or change it. Have y...

Converting a filepath to a url securely and reliably

I'm using php and I have the following code to convert an absolute path to a url. function make_url($path, $secure = false){ return (!$secure ? 'http://' : 'https://').str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['HTTP_HOST'], $path); } My question is basically, is there a better way to do this in terms of security / reliabilit...

PHP5 and Microsoft Live Search 2.0

I'm trying to use Live Search 2.0 but even a simple example doesn't seem to work. Microsoft only has example code for 1.1 and they're not giving out AppIDs for that version. Here's what I'm trying with: <?php $server = new SoapClient('http://soap.search.msn.com/webservices.asmx?wsdl'); class Search { public $Request; } class Sear...

Zend Framework - Zend_Form Decorator Issue

I have a class that extends Zend_Form like this (simplified): class Core_Form extends Zend_Form { protected static $_elementDecorators = array( 'ViewHelper', 'Errors', array('Label'), array('HtmlTag', array('tag' => 'li')), ); public function loadDefaultDecorators() { $this->set...

Zend_Pdf - Text On Top of Shapes?

Is it possible to draw text over top of a drawn shape with Zend_Pdf? No matter what order I execute the draw statements, the shape is always on top of my text. ...

PHP Class Scope

I am fairly new to PHP. What is the best way to control access to a class throughout a PHP application and where is the best place to store these classes that will need to be accessed throughout the entire application? Example; I have a user class that is created on during the login process, but each time the page post it appears tha...

Refactoring To Remove Static Methods Code Smell

I have the current basic structure for each domain object that I need to create: class Model_Company extends LP_Model { protected static $_gatewayName = 'Model_Table_Company'; protected static $_gateway; protected static $_class; public static function init() { if(self::$_gateway == null) { self::...

What PHP coding in a website allows the user get to the next page and make changes?

I think I have to enter a function in the blank space, but I'm not sure because I am a beginner: =\" .php\">Add Or Delete Product In Your System I don't know what should be written in the blank space,after the (=\") so that the user will be brought to the next page and will be able to change the settings. I know I have to make it ...