php

PHP Object Creation and Memory Usage

A basic dummy class: class foo { var $bar = 0; function foo() {} function boo() {} } echo memory_get_usage(); echo "\n"; $foo = new foo(); echo memory_get_usage(); echo "\n"; unset($foo); echo memory_get_usage(); echo "\n"; $foo = null; echo memory_get_usage(); echo "\n"; Outputs: $ php test.php 353672 353792 353792 3537...

php and MySQL: 2 requests or 1 request?

I'm building a wepage in php using MySQL as my database. Which way is faster? 2 requests to MySQL with the folling query. SELECT points FROM data; SELECT sum(points) FROM data; 1 request to MySQL. Hold the result in a temporary array and calcuale the sum in php. $data = SELECT points FROM data; EDIT -- the data is about 200-500 ...

function functionName(if clause here) possible?

function getTemplate($tpl if ($vars) echo ", $vars";)...function Is this possible somehow? The above wont work. Thanks ...

Has anyone ever created a shopping cart on the Expression Engine?

Well I'm building a site for a client on the Expression Engine CMS and just wondering if anyone had any experience building a shopping cart on it, either custom or via a plug in. ...

What are the pros and cons of the various date/time field types in MySQL?

Date and time in MySQL can be stored as DATETIME, TIMESTAMP, and INTEGER (number of seconds since 01/01/1970). What are the benefits and drawbacks of each, particularly when developing under a LAMP stack? ...

Unable to connect to msSQL database via PHP

I am using the current code in attempt to access a msSQL 2005 db: <?php $myServer = "[server]"; $myUser = "[username]"; $myPass = "[password]"; $myDB = "[db]"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $s...

Drupal form being rendered before submit action

I have a Drupal module page where I am populating a form with a drop-down that contains a list of available parts of a set of files that the user can upload. Once the user uploads a file of a certain type, it removes that option from the list, and when all the available files are uploaded the form will not be rendered. The problem is t...

Web Application Architecture: Future Proofing

Hello all, I have a web application that currently sends emails. At the time my web applications sends emails (sending of emails is based on user actions - not automatic), it has to run other processes like zipping up files. I am trying to make my application "future proof" - so when there are a large number of users I don't want the ...

Tools to convert Microsoft Access to an online PHP/mySQL system

We have a Microsoft Access database that has been used for many years. Our staff is very used to using the Access tables and forms to query, view, update and add to the data. But the database is at the end of its lifetime. We want to convert it to a PHP/mySQL solution. I have found tools that can convert the Access database to mySQL. ...

Handling multiple file downloads from Amazon S3?

I have a private bucket that stores full sized images for clients, all thumbnails and smaller sizes are on the webserver. When the user has multiple images they would like to download, I'd like to zip the aforementioned images, then deliver them as one file to the user. Currently, the only way I can think of this happening is by transf...

PHP Caching without messing with file permissions (Also, How to emulate ASP Application variables in PHP)

I'm trying to implement some kind of caching in a PHP script that will go out to many different clients/sites, which will be deployed by fairly non-technical users, using a variety of web hosts. Due to the non-technical nature of the users, I'd like to avoid asking them to tweak file permissions. The caching needs to be across session...

Can I encrypt PHP source or compile it so others can't see it? and how?

I need to encrypt some PHP source that I've released to the public. Is this possible? Can PHP be "compiled" ? ...

Regular expression for parsing CSV in PHP

I already managed to split the CSV file using this regex: "/,(?=(?:[^\"]\"[^\"]\")(?![^\"]\"))/" But I ended up with an array of strings that contain the opening and ending double quotes. Now I need a regex that would strip those strings of the delimiter double quotes. As far as I know the CSV format can encapsulate strings in double q...

Get current date and time in PHP

What PHP function file can return the current date/time? ...

embedding audio in html - ie and firefox using php...

I'm trying to create an audio captcha system for the visually impaired. I have a system that will glue several wave files together, but I'm having trouble embedding them in ie and firefox. <script type="text/javascript"> function EvalSound(soundobj) { var thissound=document.getElementById(soundobj); thissound.Play(); } </script> <embe...

Filename is different to the filename that exists in DB even though a session is being used

Hello all, I save a file with part of the filename as the session_id using PHP, like this: $newFileName = 'upload_160687_'.session_id().'_160687_'.$originalFileName; I then save the filename as a string using PHP in the DB and it looks like this: upload_160687_l4eef6nqlekhbirv2pvmuf5660_160687_Apple_Microsoft_desktop1-1.jpg Howeve...

Application access server load

Hello. I have developed an application in PHP + Javascript. I'm using MySQL as database support. Every account for this app will come with a subdomain... so the client Stardust would have stardust.mysite.com. I want to put the application files in a folder outside public_html and link every account from every subdomain created to this fi...

Code Translation: ASP.NET Server.Transfer in PHP

How would I do this in PHP? Server.Transfer("/index.aspx") (add ';' for C#) EDIT: It is important to have the URL remain the same as before; you know, for Google. In my situation, we have a bunch of .html files that we want to transfer and it is important to the client that the address bar doesn't change. ...

Comparing strings in PHP the same way MySQL does

I'm storing a varchar in a utf8 MySQL table and using utf8_general_ci collation. I have a unique index on the varchar. I'd like to do a string comparison in PHP that is equivalent to what MySQL will do on the index. A specific example is that I'd like to be able to detect that 'a' is considered equivalent to 'À' in PHP before this ha...

What is the best way to get RSS Feeds into a MySQL Database

I am trying to take several RSS feeds, and put the content of them into a MySQL Database using PHP. After I store this content, I will display on my own page, and also combine the content into one single RSS Feed. (Probably after filtering) I haven't dealt with RSS Feeds before, so I am wondering the best Framework/Method of doing this ...