php

Multiple PHP Warnings in XSLTProcessor::importStylesheet()

Errors: Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: Undefined variable in /transform.php on line 24 Warning: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error: file /protocols.xsl line 18 element template in /transform.php on line 24 Warning: XSLTProcessor::import...

Authenticate against Active Directory/ISA from php

I have a complicated problem, exacerbated by the fact I don't really know where to start! Over the last few years, I've developed a number of php web-based systems. When I built them, our network was ropey at best, so I thought nothing of creating my own username/password stuff. Since then, our network has become a lot more robust, our...

How does filepaths in php work?

Hi. The problem is that I use the method file _ get _ contents("body.html") in a class that is in the same folder as body.html. The problem is that I get an error saying that the file could not be found. This is because I from another class require the file that uses the method file _ get _ contents("body.html"), and suddenly I have to...

Best practices / info: Writing a PHP4 ORM

For a number of reasons (all of which can, basically, be broken down to bad management decisions) we're unable to switch to PHP5, meaning we'll have to support PHP4 for probably a few more years. Since a lot of our applications (as with a lot of web apps) are glorified CRUD apps, and because I like to pick up the occasional home project...

Validating a URL in PHP

I need a basic regular expression for validating a url, such that: Both http:// and http://www. are allowed (and the same thing with https:// and https://www.). All common tld like .com, .net. .org, .cc, .my, etc are allowed. Things like http://site.com/dir/dir2/page.html etc are allowed Only characters allowed in a url are allowed (su...

Pulling data from SQL, and writing to a text file.

I am trying to pull data from SQL, and then write it to a text file. This does that, to an extent, but it only pulls 1 from the table, which reads test:test<br> on the text file. I want to be able to pull all the data from the table, and then post to the text file in a list format such as this... test:test test2:test...

PHP: Files or database

What's better? I want to share a script where some data (4 ints (between 0 and 2000) and a string (length up to 200)). Should I store them in files or in a MySQL database? I use normally databases, but in this case are files also not that bad (to handle). The problem is that there are partial in one day over 100.000 inserts. That are s...

PHP script to parse directory, list all images and add class="last" to the last image in the directory

I'm able to parse through the directory and list all images with any of the functions below. I just need to insert a class="last" attribute into the img tag of the last element in the loop. Also, which of these functions works best for what I'm trying to do? Any help much appreciated! function get_images1() { $exts = 'jpg jpeg png gi...

Regular Expression Question

I have a regular expression in PHP that looks for the date in the format of YYYY-MM-DD What I have is: [\d]{4}-[\d]{2}-[\d]{2} I'm using preg_match to test the date, the problem is that 2009-11-10 works, but 2009-11-1033434 works as well. It's been awhile since I've done regex, how do I ensure that it stops at the correct spot? I've ...

Tables were deprecated? And JavaScript has libraries? Help me catch up!

I need to tweak the web interface of an in-house print system, but it's going on a decade since I touched HTML. Could anyone recommend some tutorials on writing HTML forms and processing them in PHP? Google only gets me eight-year-old resources with big "for historical purposes only" banners on top, possibly because all my vocabulary is ...

PHP MVC Best Practices/"Rules" for Success

I'm sure that someone already posted this question; however, I would like to get all kind of recommendations for MVC on PHP. I know there are many experts out there willing to share their knowledge with people who has doubts about their coding best practices. How should you organize your Controller? How should you organize your Model? ...

Calling another constructor from a constructor in PHP

I want a few constructors defined in a PHP class. However, my code for the constructors is currently very similar. I would rather not repeat code if possible. Is there a way to call other constructors from within one constructor in a php class? Is there a way to have multiple constructors in a PHP class? function __construct($service, $...

[PHP] Is there an equivalent to $this for static classes? ( kind of super but for the current class where it is used )

I know it wouldn't be exactly equivalent to $this, but is there a way to reference a static class from within itself without using the name of the class itself? ( like super but for itself ) This is just a way to avoid having to refactor all the class references if the class is renamed. Example: class foo { function bar() { static_this...

Open custom IE window from Flex or Can a window customize itself?

Is it possible to open a custom IE window (i.e no status bar or address bar etc) from within flex? or if i call a php file or html file can the page customize itself when loaded? ...

What am I doing wrong? PHP script with nothing visibly wrong

<?php $file = fopen("configuration.conf","w+"); $settings['LogEnabled'] = "true"; $settings['Pass'] = "pass"; $settings['ShowWarning'] = "true"; fwrite($file,serialize($settings)); $path = "configuration.conf"; $file2 = file_get_contents($path); $settings2=unserialize($file2); echo($settings2['LogsEnabled']); ?> It ought to show "...

Syntax help! Php and MYSQL

Original: $sql = "SELECT DATE(TimeAdded) AS Date, $column_name FROM Codes ORDER BY TimeAdded ASC"; Altered: $sql = "SELECT DATE("m", TimeAdded ) AS Date, ColumnName FROM TableName ORDER BY TimeAdded ASC"; TimeAdded was added using NOW() and basically, I am trying to make it months. The problem I have here is the quotations is messi...

Is it possible to store the fields of one Array as a new array?

Hi everyone, In my CakePHP app, I'm pulling in the results of a table called 'Timesheets'. This table has an athlete_id and a few split times for a race. I need to do some calculations on one athlete's times compared to another athlete (for instance, calculate the difference between the fastest finish time and slowest). I thought the ...

Image resizing question using php?

I was wondering how can I create a piece of PHP code that will check a jpg, gif, png or any other types of images using the getimagesize() . And then check if the images width is smaller then the width in the following CSS code below if so then the PHP code should re-size the image all while keeping the images aspect ratio, no matter if...

Minimalistic visitor stats based on PHP?

Does anybody know a minimalistic, nice-looking visitor statistics suite based on PHP that displays visitor stats in a end-user friendly way. I know Google Analytics, and the big names in PHP and Perl based traffic analysis; they are all too complicated and feature-rich for what I need. I am looking for something that is already totally ...

HTML2FPDF print page results as pdf..

Hi all, I'm trying to user HTML2FPDF (http://html2fpdf.sourceforge.net/) to create a PDF of a page, but I can't seem to get it to work properly. My page consists of jQuery to show a graph. I want the graph and other text on the page to be exported as a PDF. http://portal.flyingstartlifestyle.360southclients.com/leanne/leanne.php <- th...