php

Super-light weight database engine to distribute part of tiny PHP script

I am looking for a super-light weight open-source database engine (could be a library that mimics one) to be packaged part of a tiny PHP script distributed to people without sudo access. Basic CRUD, no need for any complicated implementations with string search, etc. I found txtSQL (uses flat files, which I believe is the way to go) but...

syntax error, unexpected '<'

Seriously Parse error: syntax error, unexpected '<' on line 22 Code snippet from line 22: <?php //Submitting to ourselves via POST <form method="post" action="<?php echo $PHP_SELF; ?>"/> ?> Try this: This is not working either: <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" /> ...

PHP - UPLOAD_ERR_NO_TMP_DIR

I am using Cbeyond (www.cbeyond.com, some of you might be familiar with them) as a PHP Enabled webhost, I'm having issues with my PHP Upload functions, when I check as follows: $error = $_FILES['uploadedfile']['error']; echo $error; I get "6", for the error message: "UPLOAD_ERR_NO_TMP_DIR" I have a /tmp directory at my root, here i...

how to manage and queue background jobs

A web app that launches cpu intensive background jobs in the background whenever users call it. example: youtube.com. people upload videos, it gets converted in background job. how can you deal with many users simultaneously attempting to launch their own background jobs ? it must be queued correct? additionally, if the background job...

Insert Groups of Rows with PHP & MYSQL

I'm trying to load data from a few hundred text files into a database. I believe MYSQL is exiting out of the loop without inserting all the rows. Can anyone suggest how to insert blocks of 1000 rows to the end of data, with PHP code? $filenames_array = array(); foreach($filenames_array as $filename) { $file_array = file($fi...

Sending email on multi-step (2 page) form

I have a bit of a problem i am trying to sort out. I have 2-step form page 1 (mandatory): fill in your personal details page 2 (optional): complete your inventory At the moment the form sends 2 emails to the recipient, 1 after the first page is completed, and one if the second page is completed. The second email is identical to the f...

Can you list some free CRM webapps? Possibly in PHP, possibly with OpenID support.

Not much to add, the topic says it all. Crm Free PHP OpenID Mysql Oh, it would be nice if it was for php5 with a decent Template support. ...

php anchor tag regex

Hi, I have a bunch of strings, each containing an anchor tag and url. string ex. here is a link <a href="http://www.google.com"&gt;http://www.google.com&lt;/a&gt;. enjoy! i want to parse out the anchor tags and everything in between. result ex. here is a link. enjoy! the urls in the href= portion don't always match the link tex...

PHP - multiple users edit the same image simultaniously.

I am looking to have multiple users edit the same image using the gd library's imagecopymerge function. I am worried that two users might select to edit the image at the same time. The application then merge's the two users images seperately and finally saves them but one overwrites the other and thus one of the users images is missing....

How to overwrite array elements inside cookie if 'nr of elements > x' ?

I have a classifieds website, and when users click on an ad, an array element containing the ad id is set to a cookie. Then on the main page, the 'last visited ads' is shown. Problem is, I have a limit on the nr of 'last visited ads' ( set to 10 ). So, if the cookie array contains more than 10 elements, I want the elements to be repla...

Regular Expression In PHP

Hi i would like to parse following string to get the value "46.4400 INR" <div id=currency_converter_result>1 USD = <span class=bld>46.4400 INR</span> <input type=submit value="Convert"> </div> What regular expression do i need to use for this? Please help me out to get out of this Thanks in Advance KAMAL CHALLA ...

removing items from a dojo datagrid

Hi, I am struggling with a simple dojo datagrid in my Zend Framework project. I have a list of data from a mysql table that I can display, however I want users to be able to remove selected rows (and remove them from the db). I am using the example from Dojo DataGrid adding and deleting data. My code in my view for the datagrid looks...

PHP and scheduled tasks

I'm trying to come up with a list of different approaches to run scheduled tasks on PHP. My intention is to provide an universal way to run scheduled tasks in PHP. So far I have: 1) Analyze site traffic. If you receive 770 hits a day (which is one hit per 2 minutes), and you scheduled a task to run at 6:00 AM and a visitor requested a p...

In a PHP project, how do you store, access and organize your helper objects?

How do you organize and manage your helper objects like the database engine, user notification, error handling and so on in a PHP based, object oriented project? Say I have a large PHP CMS. The CMS is organized in various classes. A few examples: the database object user management an API to create/modify/delete items a messaging obje...

HTML to PDF vs. Programmatically creating PDF via PHP

I have a PHP application that needs to generate some PDF invoices and PDF timesheets with nice headers/footers. Some Stackoverflow users recommend using TCPDF to create the PDF documents. In my research, I discovered two approaches to generating PDFs: 1) Programmatically formatting the PDF like so: $tcpdf->SetFillColor(255, 0, 0)...

ImageCreateFromJPEG PHP Another image

How do you add another image to a image in php the itme i want to add is images/rank1.jpg? $rImg = ImageCreateFromJPEG("images/card/test.jpg"); $cor = imagecolorallocate($rImg, 255, 255, 255); imagestring($rImg,5,60,3,$username,$cor); ...

php validate user is over 18

Just wondering, can I do this to validate that a user has entered a date over 18? //Validate for users over 18 only function time($then, $min) { $then = strtotime('March 23, 1988'); //The age to be over, over +18 $min = strtotime('+18 years', $then); echo $min; if(time() < $min) { die('Not 18'); } } Just stumbled across this functio...

Find and edit text files via PHP

Hello, Let say a text file contain Hello everyone, My name is Alice, i stay in Canada. How do i use php to find "Alice" and replace it with "John". $filename = "C:\intro.txt"; $fp = fopen($filename, 'w'); //fwrite($fp, $string); fclose($fp); ...

Speedup a php web site

What's the best way (ways?) to speed up a php web site and how much faster it can using this or that way? ...

Create a modular website, allowing the user to select their page layout. PHP and jQuery advice?

Hello, I am looking to build a website that allows the user to fully customise the content that they see. I will be building this using CodeIgniter or Zend Framework and also jQuery. What I need to know and gain some advice on is how is the best way to create the content on the fly, When a user selects that they would like the blog s...