0){ //if user loaded a tripid from database $tripid = $_SESSION["_tripid"]; } else{ if($tripid . "" == ""){ //get a tripid for this sessionid, or generate a new one $query = "select * from tbl_trip_planner_trips where session='$sessionid' and saved='0';"; $rs = mysql_query($query); if($rs && mysql_num_rows($rs) > 0){ $row_rs = mysql_fetch_assoc($rs); $tripid = $row_rs["tripid"]; } else{ //do not generate a new tripid because it will be generate when adding first object into it } mysql_free_result($rs); } } if($tripid . "" != ""){ //get data for trip $query_rs = "SELECT * FROM tbl_trip_planner_trips where tripid=$tripid;"; $rs = mysql_query($query_rs, $conn) or die(mysql_error()); if($rs && mysql_num_rows($rs)> 0){ $row_trip = mysql_fetch_assoc($rs); } mysql_free_result($rs); } $savetrip = false; $retrievetrip = false; $forgotpassword = false; $trip_name = ""; if(isset($_SESSION["_trip_name"])) { $trip_name = $_SESSION["_trip_name"]; } if(isset($_GET["act"]) || isset($_POST["act"])){ if($_POST["act"] . "" == "savetrip"){ //the form save trip submit button has been pressed $savetrip = true;//in case of errors, show again the save trip $message = ""; if(isset($_POST["trip_name"]) && strlen(trim($_POST["trip_name"])) == 0) $message .= "Please fill the Trip Plan name field.
"; if(isset($_POST["mail"]) && strlen(trim($_POST["mail"])) == 0) $message .= "Please fill the Email field.
"; if(isset($_POST["mail"]) && strlen(trim($_POST["mail"])) > 0 && (strpos($_POST["mail"], "@") === false || strpos($_POST["mail"], ".") === false)) $message .= "Please insert a correct Email address.
"; if(isset($_POST["password1"]) && strlen(trim($_POST["password1"])) == 0) $message .= "Please fill the Password field.
"; if(isset($_POST["password2"]) && strlen(trim($_POST["password2"])) == 0) $message .= "Please fill the Retype Password field.
"; if(isset($_POST["password2"]) && isset($_POST["password2"]) && $_POST["password2"] != $_POST["password1"]) $message .= "Please insert the same password in both fields.
"; if(strlen($message) == 0){ $query = "update tbl_trip_planner_trips set name='".str_replace("'", "''", $_POST["trip_name"])."', password='".str_replace("'", "''", $_POST["password1"])."', mail='".str_replace("'", "''", $_POST["mail"])."', last_accessed=now(), saved='1' where tripid=$tripid;"; mysql_query($query); if(mysql_errno() == 0){ $message = ""; $savetrip = false; $_SESSION["_tripid"] = ""; unset($_SESSION["_tripid"]); $_SESSION["_trip_name"] = ""; unset($_SESSION["_trip_name"]); $message = "The Trip Plan has been saved."; $tripid = ""; } else{ $message = mysql_error(); } } } else{ if($_GET["act"] . "" == "savetrip"){//when user press save trip $savetrip = true;//to display in page the form } } if($_GET["act"] . "" == "cleartrip"){ $query = "delete from tbl_trip_planner_objects where tripid=$tripid;"; mysql_query($query); if(mysql_errno() == 0){ $query = "delete from tbl_trip_planner_trips where tripid=$tripid;"; mysql_query($query); if(mysql_errno() == 0){ $message = "All objects has been removed."; $_SESSION["_trip_name"] = ""; $_SESSION["_tripid"] = ""; unset($_SESSION["_trip_name"]); unset($_SESSION["_tripid"]); $tripid = ""; } else{ $message = "Error. Cannot clear the trip plan."; } } else{ $message = "Error. Cannot clear the trip plan."; } } if($_POST["act"] . "" == "forgotpassword"){ if(isset($_POST["trip_name"]) && strlen(trim($_POST["trip_name"])) == 0) $message .= "Please fill the Trip Plan name field.
"; if(isset($_POST["password"]) && strlen(trim($_POST["password"])) == 0) $message .= "Please fill the Password field.
"; $forgotpassword = true; if(strlen($message) == 0){ $query = "select * from tbl_trip_planner_trips where name='".str_replace("'", "''", $_POST["trip_name"])."' and mail='".str_replace("'", "''", $_POST["mail"])."' and saved='1';"; $rs = mysql_query($query); if(mysql_errno() == 0){ if($rs && mysql_num_rows($rs) > 0) { $row_rs = mysql_fetch_assoc($rs); $password = $row_rs["password"]; $mail_message = "Dear user,

\n\nYour requested password password for Trip Plan: " . $row_rs["name"] . " is " . $password . "

\n\nThank you for using our services.
ClarionGatlinburg.info Team"; include("mail.class.php"); $mailout = new mailer; $mailout->from('contact@clariongatlinburg.info', 'Sender'); // from $mailout->add_recipient($row_rs["mail"]);//add a recipient in the to: field $mailout->subject("Trip Plan password at ClarionGatlinburg.info");//set subject $mailout->message($mail_message);//set message body $mailout->send();//send email(s) //header("Location:contact_us.html"); //mail($row_rs["mail"], "Trip Plan password", $mail_message); $message = "A message has been sent to you email address containing the password for this trip. Thank you!"; $forgotpassword = false; } else{ $message = "Error. Cannot retrieve the password. \nData incorrect or Trip Plan cannot be found."; } } } } else{ if($_GET["act"] . "" == "forgotpassword"){ $forgotpassword = true; } } if($_POST["act"] . "" == "retrievetrip"){ if(isset($_POST["trip_name"]) && strlen(trim($_POST["trip_name"])) == 0) $message .= "Please fill the Trip Plan name field.
"; if(isset($_POST["mail"]) && strlen(trim($_POST["mail"])) == 0) $message .= "Please fill the Email field.
"; if(isset($_POST["mail"]) && strlen(trim($_POST["mail"])) > 0 && (strpos($_POST["mail"], "@") === false || strpos($_POST["mail"], ".") === false)) $message .= "Please insert a correct Email address.
"; if(isset($_POST["password"]) && strlen(trim($_POST["password"])) == 0) $message .= "Please fill the Password field.
"; $retrievetrip = true; if(strlen($message) == 0){ $query = "select * from tbl_trip_planner_trips where name='".str_replace("'", "''", $_POST["trip_name"])."' and password='".str_replace("'", "''", $_POST["password"])."' and mail='".str_replace("'", "''", $_POST["mail"])."' and saved='1';"; $rs = mysql_query($query); if(mysql_errno() == 0){ if($rs && mysql_num_rows($rs) > 0) { $row_rs = mysql_fetch_assoc($rs); $message = ""; $retrievetrip = false; $_SESSION["_tripid"] = $row_rs["tripid"]; $_SESSION["_trip_name"] = $row_rs["name"]; $tripid = $row_rs["tripid"]; $trip_name = $row_rs["name"]; } else{ $message = "Error. Cannot retrieve the Trip Plan. \nData incorrect or Trip Plan cannot be found."; } } else{ $message = mysql_error(); } } } else{ if($_GET["act"] . "" == "retrievetrip"){ $retrievetrip = true; } } if($_GET["act"] . "" == "removefromplanner"){ //verify if interestid is indeed associated with tripid $interestid = $_GET["i"]; if(is_numeric($interestid)){ $query = "select tbl_trip_planner_interests.* from tbl_trip_planner_objects inner join tbl_trip_planner_interests on tbl_trip_planner_objects.interestid=tbl_trip_planner_interests.interestid where tripid=$tripid and tbl_trip_planner_objects.interestid=$interestid;"; $rs = mysql_query($query); if(mysql_errno() == 0){ if($rs && mysql_num_rows($rs) > 0){ $row_rs = mysql_fetch_assoc($rs); //ok $query = "delete from tbl_trip_planner_objects where tripid=$tripid and interestid=$interestid;"; mysql_query($query); if(mysql_errno() == 0) { $message = $row_rs["title"] . " has been removed from Trip Plan."; } } else{//fraud } mysql_free_result($rs); } else{//fraud } }else{ //fraud } } } ?> Trip Plan
You are here : Home ►Trip Plan
Interests
Contact Us
Name:
E-Mail:
Project Overview:

'.$message.'

'; } if($forgotpassword){ ?>
Please fill the following fields for retrieving a Trip Plan
Trip Plan name " maxlength="255"/>
Email address " maxlength="255"/>
 
Please fill the following fields for retrieving a Trip Plan
Trip Plan name " maxlength="255"/>
Email address " maxlength="255"/>
Password
Please fill the following fields for saving the Trip Plan
Trip Plan name " maxlength="255"/>
Email address " maxlength="255"/>
Password
Retype password
SAVED TRIP PLAN:
0){ while ($row_rs = mysql_fetch_assoc($rs)){ //title echo '

'.$row_rs["title"]."
"; echo '
Remove '.htmlentities($row_rs["title"]).' from Trip Plan

'; //contact details echo ''.str_replace("\n", "
", $row_rs["text_contact"]) . ""; if(strpos(strtolower($row_rs["link"]), "http://") === 0) { echo " ".$row_rs["link"]."\n"; } echo "\n"; echo '

'.$row_rs["text_description"]."

\n"; }//while } else{ if(!$savetrip && !$retrievetrip){ echo '

There are no objects of interest in your Trip Plan

'; } } mysql_free_result($rs); } else{ if(!$savetrip && !$retrievetrip){ echo '

There are no objects of interest in your Trip Plan

'; } } ?>