// NAME: login_cookie.php // DESCRIPTION: All common functions needed to manage a partner's login cookie. // Creation: 3/2/2006, © One Bad Ant // Create the login cookie for a partner following authentication // The key to the partner's "PERSON" record is passed in function create_login($partner_rec_key) { $ci2i_login_cookie = "loginkey=".$partner_rec_key.","; setcookie ("ci2ipartner", $ci2i_login_cookie, time() + 3600, "/", false); // expire in one hour } // Ci2i Logout (expire the login cookie) function expire_login() { setcookie ("ci2ipartner", "", time() - 3600, "/", false); // expire (one hour ago) } // This procedure parses a partner's login cookie, verifying that she has logged in. // This procedue will return the record key to the partner record or a "no_cookie" flag. function verify_login() { $ci2i_login_value = ""; // verify that the login cookie exists (= valid log in) if (isset($_REQUEST['ci2ipartner'])) { $ci2i_login_value = $_REQUEST["ci2ipartner"]; $end_of_log_cookie = strlen($ci2i_login_value); // make sure the cookie has been set if ($end_of_log_cookie != 0) { $login_begin = strpos($ci2i_login_value,"=") + 1; $login_end = strpos($ci2i_login_value,","); $login_length = $login_end - $login_begin; // get the key to the logged in partner record $partner_key = substr($ci2i_login_value,$login_begin,$login_length); return $partner_key; } } // if we reach this point then no valid login cookie exists return "no_cookie"; } ?> // NAME: dbconnect.php // DESCRIPTION: This procedure is called as an include by any other scripts that need to access the Ci2i Survey database tables. // Creation: 2/23/2006, © One Bad Ant // connect to the database @ $ci2i_db = mysql_connect("mysql3.brinkster.com","antci2i","ne03731P"); if (!$ci2i_db) {return 0;} else { mysql_select_db("antci2i"); return 1; } ?> // NAME: survey_functions.php // DESCRIPTION: this file contains scripts needed for the Ci2i survey question and answer pages. // Creation: 3/14/2006, © One Bad Ant // Get the person's survey record function get_persons_survey($partner_key) { $survey_key_query = "SELECT survey_key FROM survey WHERE person_fkey = '".$partner_key."'"; $survey_key_result = mysql_query($survey_key_query); $survey_key = mysql_result($survey_key_result,0,"survey_key"); return $survey_key; } // Get the person's survey partnership record function get_persons_survey_partnership($partner_key) { $partnership_query = "SELECT promotion_code FROM survey_partnership WHERE partner1_fkey = '".$partner_key."' OR partner2_fkey = '".$partner_key."'"; $partnership_result = mysql_query($partnership_query); $promotion_code = mysql_result($partnership_result,0,"promotion_code"); return $promotion_code; } // get the answer to the given survey item for the given factor on the given page for the given survey function get_survey_answer($page,$factor,$item,$this_survey_key) { $survey_item_query = "SELECT metric, open_answer FROM survey_item WHERE survey_fkey = '".$this_survey_key."' AND page_appearance = '".$page."' AND factor_key = '".$factor."' AND item_key = '".$item."'"; $survey_item_result = mysql_query($survey_item_query); $survey_item_found = mysql_num_rows($survey_item_result); $survey_answer = ""; if ($survey_item_found > 0) { if ($page != 7) // page 7 has open ended (text) answers, not simple metrics { // question 3 and 8 on page 6 are open ended answers, the rest are metrics if ($page == 6) { if (($item == 3) || ($item == 8)) {$survey_answer = mysql_result($survey_item_result,0,"open_answer");} else { // Page 6: radio button selections $page6_radio_answer = mysql_result($survey_item_result,0,"metric"); switch ($item) { case 1: if ($page6_radio_answer == 1) {$survey_answer = "Be more appreciative and loving myself";} if ($page6_radio_answer == 2) {$survey_answer = "Wonder what is going on";} if ($page6_radio_answer == 3) {$survey_answer = "Tell my partner or myself that I don’t deserve it";} if ($page6_radio_answer == 4) {$survey_answer = "Thank my partner";} if ($page6_radio_answer == 5) {$survey_answer = "Other";} break; case 2: if ($page6_radio_answer == 1) {$survey_answer = "Be more appreciative and loving to me";} if ($page6_radio_answer == 2) {$survey_answer = "Wonder what is going on";} if ($page6_radio_answer == 3) {$survey_answer = "Tells me that he/she doesn’t deserve it";} if ($page6_radio_answer == 4) {$survey_answer = "Thanks me";} if ($page6_radio_answer == 5) {$survey_answer = "Other";} break; case 4: if ($page6_radio_answer == 1) {$survey_answer = "Argue with her/him until I 'win'";} if ($page6_radio_answer == 2) {$survey_answer = "Leave the scene";} if ($page6_radio_answer == 3) {$survey_answer = "Listen and talk together to solve the issue";} if ($page6_radio_answer == 4) {$survey_answer = "Shut down and go quiet";} if ($page6_radio_answer == 5) {$survey_answer = "Give in to whatever he/she wants or says";} if ($page6_radio_answer == 6) {$survey_answer = "Other";} break; case 5: if ($page6_radio_answer == 1) {$survey_answer = "Argue until he/she 'wins'";} if ($page6_radio_answer == 2) {$survey_answer = "Leave the scene";} if ($page6_radio_answer == 3) {$survey_answer = "Listen and talk together to solve the issue";} if ($page6_radio_answer == 4) {$survey_answer = "Shut down and go quiet";} if ($page6_radio_answer == 5) {$survey_answer = "Give in to whatever I want or say";} if ($page6_radio_answer == 6) {$survey_answer = "Other";} break; case 6: if ($page6_radio_answer == 1) {$survey_answer = "He/She doesn’t love me";} if ($page6_radio_answer == 2) {$survey_answer = "He/She doesn’t understand me";} if ($page6_radio_answer == 3) {$survey_answer = "A situation we really need to and can figure out";} if ($page6_radio_answer == 4) {$survey_answer = "He/She is 'just upset again'";} if ($page6_radio_answer == 5) {$survey_answer = "He/She is right to be upset with me";} if ($page6_radio_answer == 6) {$survey_answer = "He/She is the problem";} if ($page6_radio_answer == 7) {$survey_answer = "Other";} break; case 7: if ($page6_radio_answer == 1) {$survey_answer = "Not good enough";} if ($page6_radio_answer == 2) {$survey_answer = "Not loveable enough";} if ($page6_radio_answer == 3) {$survey_answer = "Smart enough to figure this out with him/her";} if ($page6_radio_answer == 4) {$survey_answer = "A hero/heroine because I put up with this";} if ($page6_radio_answer == 5) {$survey_answer = "A target for his/her issues";} if ($page6_radio_answer == 6) {$survey_answer = "Never going to please him/or her anyway";} if ($page6_radio_answer == 7) {$survey_answer = "Other";} break; } // current page (from the report we want text returned, from survey - the metric) if ($_SERVER['PHP_SELF'] == "/survey/page6.php") {$survey_answer = $page6_radio_answer;} } // 3 and 8 } // page 6 else {$survey_answer = mysql_result($survey_item_result,0,"metric");} } else {$survey_answer = mysql_result($survey_item_result,0,"open_answer");} } else {$survey_answer = "";} return $survey_answer; } // Get the number of days remaining in a person's survey period function get_days_remaining($partner_key) { $survey_date_query = "SELECT end_date FROM survey_partnership WHERE partner1_fkey = '".$partner_key."' OR partner2_fkey = '".$partner_key."'"; $survey_date_result = mysql_query($survey_date_query); $survey_end_date = mysql_result($survey_date_result,0,"end_date"); $unix_endtime = strtotime($survey_end_date); // convert survey partnership end date to unix time $unix_todaytime = strtotime(date("Y-m-d")); // convert today to unix time $diff = $unix_endtime - $unix_todaytime; $days_remaining = floor($diff / (24 * 60 * 60)); // convert from seconds to days return $days_remaining; } ?>
WHAT Ci2i for Couples IS and WHAT IT IS NOT:
Ci2i Couples Communication Tool
Kit |
|
Building Trust Accounts: | Worksheets and information for awareness and building trust in your partnership. |
Loving to Listen: | Listening skills for couples. |
Gimme Some Feedback: | Make it a point to ask for and appreciate honest feedback from your partner, friends, and family. |
Conflict, What Conflict? | Recognizing that conflict is normal and that it can actually be used to strengthen relationships is a valuable concept. |