Saturday, June 03, 2006

Adding an item to the database

Links, etc. can now be added to the database via /php/additem.php. It currently has no validation in it, so try to call it correctly.

Variables that may be sent to it:

user: the identification number of a user or group - optional, but if you send it then you must also send usertype. If you do not send these then it is assumed that you want it associated with the current user and the userid is taken out of the session variables and usertype is set to "person."
usertype: says whether the user is a person or a group. Valid values are "person" and "group".
title (optional)
description (optional)
comment (optional)
tags (optional): all tags to be associated with the item in a comma-separated list (e.g. tag1,tag2,tag3)
year (optional): the expiration year, must be four-digit (e.g. 2006)
month (optional): the expiration month, must be two-digit (e.g. 06)
day (optional): the expiration day, must be two-digit (e.g. 03)
Note: year, month, and day must all occur together or the expiration date will be put in the database as an empty string. The creation date is created automatically.
Media (optional): this isn't implemented yet. When it is it will be an uploaded file. I have no idea how I'm going to process this.

If the user is not logged in, additem.php returns "success=false" and "loginfailure=true". When the item is successfully entered into the database it returns "success=true". There is no other error checking, so there are no other points that might return something. (this should perhaps be changed...)

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home