Timelines :: Create Timeline\n"; $errorArray=array(); /************************************************************* Start by figuring out who is logged in *************************************************************/ if(user_logged_in() && !$doingLogout){ $username=$_COOKIE['sclcr']; } else{ // the user isn't logged in ?>

 

 

Log in up there

Not Logged In

You must be logged in before you can create timelines.

=5 && strlen($t)<=255 && str_word_count($t)>=1 ){ return true; } else{ return false; } } //validate object descriptions function validate_description($d){ if( strlen($d)>=5 && strlen($d)<=2000 && str_word_count($d)>=2 ){ return true; } else{ return false; } } //let's see if they submitted any values and if so, we validate and process them if( isset($_POST['submitTimeline']) ){ //they submitted data so let's check it if( isset($_POST['title']) && isset($_POST['description']) ){ //they did include a title and description $title=trim(strip_tags($_POST['title'])); $description=$_POST['description']; //let's validate the description and title if(validate_title($title)){ if(validate_description($description)){ //the title and description are good //echo "

TITLE and DESCRIPTION are GOOD

\n"; //everything is valid and ready to roll //format and clean the variables $title=sanitize($title); $description=sanitize($description); $sqlInsertString="INSERT INTO Timelines (title, description, contributor, created) VALUES ('$title', '$description', '$username', NOW())"; $resultArray=database_query($sqlInsertString, 2, true); if($resultArray){ $result=$resultArray['db']; $newTimelineID=$resultArray['id']; if($result){ echo "

\n"; echo "

 

\n"; $title=""; $description=""; } } else{ $errorArray[]="databaseInsertFail"; } } else{ //something was wrong so we refuse to insert the new object into the database $errorArray[]="invalidDescription"; } } else{ //description invalid $errorArray[]="invalidTitle"; } } else{ //they did not submit these required values so fail $errorArray[]="missingTitleOrDescription"; } } else{ //they didn't submit anything //$errorArray[]="noData"; } //if there were errors we need to display messages if(count($errorArray)>=1){ echo "
\n"; echo "\n
\n"; } ?>
Title:
Description:
2000 Characters Remaining
You will select items to include on the timeline later.

Similar Timelines in the Database