Skip to main content

Posts

File Upload by PHP - Ajax

AJAX FILE UPLOAD - Uploading local files with AJAX/Javascript to a server Many people say uploading files with AJAX is impossible! Well, they're wrong :-) Granted this solution only works with FireFox/Mozilla. And the user has to change a setting in "about:config" and accept the advanced access privileges. Anyway, such an AJAX file upload is only suitable for restricted area stuff, such as Content Management Systems, Group-Ware etc., so users can be briefed before actually using it. FireFox/Mozilla settings: Open about:config and check that signed.applets.codebase_principal_support is set to "true" Otherwise Firefox will display something like this Error: uncaught exception: A script from "http://www.captain.at" was denied UniversalXPConnect privileges. Also make sure you check the checkbox "Remember this decision", when FireFox will display this message A script from "http://www.captain.at" is requesting enhanced abilities that ...

Disable session IDs passed via URL

URL based session management does not only have additional security risks compared to cookie based session management, but it can cause also real problems when search engines index your pages. Your visitors may send an URL that contains an active session ID to their friends or they may save the URL that contains a session ID to their bookmarks and access your site with the same session ID always. The same way your visitors can store URL's with sessions ID's, search engines may index them as well, this means new users will access your site with an older session ID. But not only that, most search engines want to provide relevant results for their users, so different pages (URL's) with the same content can be penalized or even banned. We must all admit, SESSID or PHPSESSID added to the end of an URL doesn't look very nice and it's even not easy to remember. For this reason and all the above, you should disable URL based session management on your sites, and keep se...

Find MAC address of user by PHP

That's a small function that basically parses the arp table and returns the mac address of the client. Be sure to understand the basics of arp, since this script will work only on a linear network, without gateways; i.e.: to be sure that i'm get ting the exact mac address , the client should be connected DIRECTLY to the php server; there can be as many switches and hubs you want, but no natting gateways, no routing should be made thanks to Marcus [riptide@digitaltorque.com] for some hacks on this code function return mac address () { // This code is under the GNU Public Licence // Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot com // Tested only on linux, please report bugs // WARNING: the commands 'which' and 'arp' should be executable // by the apache user; on most linux boxes the default configuration // should work fine // get the arp executable path $location = `which arp`; $location = rtrim($location); // Execute the arp comm...

PHP Coding Standard

The PHP Coding Standard is with permission based on Todd Hoff's C++ Coding Standard. Rewritten for PHP by Fredrik Kristiansen / DB Medialab, Oslo 2000-2003. Using this Standard . If you want to make a local copy of this standard and use it as your own you are perfectly free to do so. Before you start please verify that you have the most recent document . You can also download a this standard as a word document (maintained by Chris Hubbard ). Introduction Standardization is Important It helps if the standard annoys everyone in some way so everyone feels they are on the same playing field. The proposal here has evolved over many projects, many companies, and literally a total of many weeks spent arguing. It is no particular person's style and is certainly open to local amendments. Good Points When a project tries to adhere to common standards a few good things happen: programmers can go into any code and figure ou...

PHP set for enterprise growth

PHP (Hypertext Preprocessor) is moving beyond hobbyist and academic realms and into the enterprise, the CEO of Zend Technologies stressed Tuesday during a keynote presentation at the 2008 Zend/PHP Conference ( ZendCon ) in Santa Clara, Calif. Citing a list of enterprise users of the server-side scripting platform, including Kargo Mobile Technology and Shaklee, Zend CEO Harold Goldberg emphasized PHP growth. PHP has "grown up to be a mainstay enterprise language," he said. PHP is "poised for widespread enterprise adoption," said Goldberg, whose company specializes in PHP tools. "The community, the market, the partners, the ecosystems have never been better," he said. Goldberg offered brief PHP user profiles. Kargo, for example, had been using Java but found it could not expand without adding a lot of hardware. The company decided to redo its entire Web site using...

MIME message with mail

Content-ID and Message-ID Uniform Resource Locators Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited. Abstract The Uniform Resource Locator (URL) schemes, "cid:" and "mid:" allow references to messages and the body parts of messages. For example, within a single multipart message, one HTML body part might include embedded references to other parts of the same message. 1. Introduction The use of [MIME] within email to convey Web pages and their associated images requires a URL scheme to permit the HTML to refer to the images or other data included in the message. The Content-ID Uniform Resource Locator, "cid:", serves...

Remote Scripting with IFRAME

As web sites become more and more like traditional applications, the call-response-reload model used in HTTP transactions becomes increasingly cumbersome. Instead of delivering a single dynamic page, the DHTML or JavaScript developer must create a series of separate pages. The flow of the application is interrupted by page reloads whenever the client communicates with the server. Remote scripting provides a solution to this problem, easing development of complex JavaScript applications, and providing a better experience for the end user. What is Remote Scripting? Remote Scripting is the process by which a client-side application running in the browser and a server-side application can exchange data without reloading the page. Remote scripting allows you to create complex DHTML interfaces which interact seamlessly with your server. If you're not clear on exactly what this means, think of the ever-present JavaScript image swap (you've coded one of those, haven't you?). I...