} //Διεύθυνση********************************************************************************************************* if (isset($_POST['chk3'])) { $address_num = isset($_POST['address_num']) ? $_POST['address_num'] : 0; $country = isset($_POST['country']) ? $_POST['country'] : 0; $region = isset($_POST['region']) ? $_POST['region'] : 0; $city = isset($_POST['city']) ? $_POST['city'] : 0; $location = isset($_POST['location']) ? $_POST['location'] : 0; $comment = isset($_POST['addresscomnt']) ? $_POST['addresscomnt'] : 0; $streets = isset($_POST['streets']) ? $_POST['streets'] : 0; $numbers = isset($_POST['numbers']) ? $_POST['numbers'] : 0; $exist_address = isset($_POST['existaddress']) ? $_POST['existaddress'] : 0; for ($row = 0; $row <= $address_num; $row++) { $addressid = insert_address_for_user($country[$row], $region[$row], $city[$row], $location[$row], $comment[$row], $streets[$row], $numbers[$row], $userid); if ($addressid) { insert_relation("persons", "addresses", $personid, $addressid); } } } //Απασχόληση******************************************************************************************************** if (isset($_POST['chk4'])) { } //Σπουδές*********************************************************************************************************** if (isset($_POST['chk5'])) { } $msc = microtime(true) - $msc; $msc = number_format($msc, 2); $_SESSION['message'] = "<b>insert.php:</b><br>Έγινε εισαγωγή της επαφής: " . $name . " " . $surname . ", αναγνωριστικό id: " . $personid . "<br />Χρόνος ολοκλήρωσης: {$msc} δευτερόλεπτα."; } else { $_SESSION['warnings'] = "<b>insert.php:</b><br>Δεν έγινε εισαγωγή επαφής!"; }
function insert_address_for_user($country = 0, $region = 0, $city = 0, $location = 0, $comments = 0, $streets = 0, $numbers = 0, $userid = 0) { $comments = $comments; if ($userid) { $not_null = 0; $countryid = 0; if ($country) { $not_null = 1; $countryid = insert_country($country); } $regionid = 0; if ($region) { $not_null = 1; $regionid = insert_region($region); } $cityid = 0; if ($city) { $not_null = 1; $cityid = insert_city($city); } $locationid = 0; if ($location) { $not_null = 1; $locationid = insert_location($location); } if (NULL != ($addressid = exists_address_for_user($countryid, $regionid, $cityid, $locationid, $comments, $streets, $numbers, $userid))) { $nextaddressid = get_next_auto_increment_for_table("contacts", "addresses"); for ($col = 0; $col < count($streets); $col++) { $streetid = 0; if ($streets[$col]) { $not_null = 1; $streetid = insert_street($streets[$col]); $relationid = insert_relation("addresses", "streets", $nextaddressid, $streetid); if ($numbers[$col]) { insert_streetnum($relationid, $numbers[$col]); } } } if ($not_null) { return Query("INSERT INTO addresses (`countryid`,`regionid`,`cityid`,`locationid`,`comments`) VALUES ('" . $countryid . "','" . $regionid . "','" . $cityid . "','" . $locationid . "','" . $comments . "')", debug_backtrace()); } else { return NULL; } } return $addressid; } else { return NULL; } }