php

php explode every third instance of character

How can I explode every third semicolon (;) as a piece? example data: $string = piece1;piece2;piece3;piece4;piece5;piece6;piece7;piece8; example output would be: $output[0] = piece1;piece2:piece3; $output[1] = piece4;piece5;piece6; $output[2] = piece7;piece8; Thanks! ...

Authenticate in PHP with OS username/password?

I'm wondering if there's a way to use PHP (or perhaps some other CGI, but preferably PHP) to authenticate a user with their OS (in this case, Linux, Debian 5) username and password. Possible? Difficult? Thanks! ...

trying to crop and upload an image to a folder.

i used to do this by uploading the image to the database but later learned its the wrong way because when you try to export the database if ur moving it from localhost to the server the images dont come along :( so anywho, the script i have here is to get the image , crop it, give it a random name and drop it into the gallery folder. but...

To see the types of login variables in PHP's sessions

How can you see the type of variables: POST, GET, cookie, other?, after running var_dump($_REQUEST)? I run the following start_session(); --- other code here -- var_dump($_REQUEST); It gives me array(3) { ["login"]=> string(0) "" ["sid"]=> string(32) "b3408f5ff09bfc10c5b8fdeea5093d3e" ["PHPSESSID"]=> string(32) "b340...

Get info after fileReference upload?

Normally when I send information to PHP scripts via URLLoader, I have the PHP return various success codes so I can have my Flash files respond according to whatever success code the PHP returns (0 is a failure, 1 a success, 2 is some other error code, etc.). Now I'm trying to submit a form with a bunch of data in it (name, email, birth...

jQuery DatePicker - 2 Fields

Hello, I'm currently working with jQuery and using the datepicker. I have two input fields: Start Date and End Date. When each is clicked, the datepicker pops out. For the "End Date" field, I would like the jQuery date picker to highlight the same day. For example, if a user picks 8/12/09 as their start date, for the End Date, ...

Manage a codebase or offline PHP.net information

This is a 2 part question. 1) Is there some sort of program that will download all the php.net documentation with user contributed comments in tact for ofline viewing? 2) I really love using stackoverflow and adding questions that are useful to me as a favorite. This gave me the idea, it would be extremely useful if I had a software o...

All-in-one PHP / MySQL registration/login form isn't working

I am making an all in one registration / login script, which will first display the registration form if $_POST is not set. If it is, but the required fields are not filled, it redirects to the page again, re-setting $_POST. If all the fields are filled in, then if the name of the submit button $_POST["login"] is set, the form confirms t...

Best way to send 10,000+ emails with PEAR/Mail_Queue

I have a cron which generates the whole mail info and puts in a database table using $mail_queue->put(.....) with an option to delete emails after they're sent. Here's where I need a little help: What is the best way to send the emails after I have the above info? Running the $mail_queue->sendMailsInQueue() right away, using other cron ...

PHP and online payments

Is there any php tutorials online that can show me how to build my own php shopping cart and payment system for paying for digital goods without having to use PayPal or any other online payment system. So basically what I'm trying to say I guess is there a way that I can build my own payment service using PHP? ...

search & replace on 3000 row, 25 column spreadsheet

I'm attempting to clean up data in this (old) spreadsheet and need to remove things like single and double quotes, HTML tags and so on. Trouble is, it's a 3000 row file with 25 columns and every spreadsheet app I've tried (NeoOffice, MS Excel, Apple Numbers) chokes on it. Hard. Any ideas on how else I can clean this thing up for import ...

Tracking PHP Object property changes

I'm trying to track all changes made to a PHP variable. The variable can be an object or array. For example it looks something like: $object = array('a', 'b'); This object is then persisted to storage using an object-cache. When php script runs again. So when the script runs the second time, or another script runs and modifies tha...

Books for Email Marketing software development

Hey guys, I've searched and searched and can't find anything on books for developing email marketing software. There are a bunch on CMS development amongst other things, but all I get are ads for email marketing software, not books on how to do it. I'm looking for one on an advanced level preferably with PHP, MySQL (or PGSQL) in a Lin...

php - multiple requests with curl (NOT 'multi-threaded')

If i want to do multiple things (that require cookies) with curl, for example: login to (my own) blog then automatically submit a blog post do I do this in one curl instance before curl close or do i close first session and then start second one for second task? (Sorry if it's dumb question but i can't quite get it. Generally all exa...

foreach: "in" v. "as"

What is the difference between these two usages of foreach? foreach ($nodes as $node) { //do stuff } foreach ($odp in $ftw) { //do more stuff } ...

Block auto-refreshers without CAPTCHA?

I am developing a web-based game, and there are some areas of the site that could be taken advantage of fairly easily by setting a simple auto-refresher on the user's browser. What would be the best way to detect this without having to have a CAPTCHA when just generally browsing the site? The site is built using PHP and Javascript/AJAX...

Can someone explain the limitations of cron job scripts to me?

I think I'm confused about exactly what the difference is between running a PHP script as a cron job versus accessing it with a browser. When I test test.php by hitting it with Safari, it writes to a text file as expected, makes DB entries, etc. When it runs as a cron job, it does everything except write to a text file. I already dealt ...

Prepared Statements in a Database class.

The Problem So I'm writing my web based application and it dawns on me "Durr, your stuff is wide open to SQL injection and whatnot! Rewrite db class!" I'm currently re-writing my $db class and I am having a significant amount of trouble understanding how I'm supposed to implement prepared statements. Previously... I used to use somet...

Tag <? Misbehaving in PHP

I'm working with a legacy code that someone had left, and it happens to be my task to re-deploy the code. I'm using Windows Server 2003, Apache 2.0.63 and PHP 5.2.10. It doesn't work. At least, not in the way I had expected it to work. Call it bugs, if you will. Upon inspecting, I had a suspicion that this code (which appears numerous ...

How can I use PHP's isset() in addition to empty()?

How would I add isset() and keep the empty() on my code below? $pagesize = (!empty($_GET['pagesize'])) ? $_GET['pagesize'] : 20; UPDATE: I am just wanting to make sure php doesn't produce any notices or warnings ...