<?php
include 'connection.php';
include 'connection_local.php';
date_default_timezone_set('Asia/Calcutta');
$today = date("Y-m-d");
$time = date("h:i A"); 
$currentyear = date("Y");
$f_year = $_REQUEST['f_year'];
?>
<?php
if($_REQUEST['unique_id']=='') {
function randomPassword() {
    $alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+%^@!*~";
    $pass = array(); //remember to declare $pass as an array
    $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
    for ($i = 0; $i < 10; $i++) {
        $n = rand(0, $alphaLength);
        $pass[] = $alphabet[$n];
    }
    return implode($pass); //turn the array into a string
}
$unique_id = randomPassword();
}else { 
$unique_id = $_REQUEST['unique_id'];
}
?>

<?

$querylogin = "select * from  temp_order where unique_id = '". $_REQUEST["unique_id"]."'";
$resultlogin = mysql_query($querylogin,$conn);
while($row=mysql_fetch_array($resultlogin))
{
$offer_price = $row['offer_price'];
$qty = $row['qty'];
$total_cost += $qty*$offer_price;
$pro_id = $row['pro_id'];
}

?>



<?php
$customer_id = $_REQUEST['customer_id'];
$contact_id = $_REQUEST['contact_id'];


$saul = $_POST['saul'];
$name = $_POST['name'];
$gender = $_POST['gender'];
$bday = $_POST['bday'];
$department = $_POST['department'];
$designation = $_POST['designation'];
$contact_types = $_POST['contact_types'];
$email = $_POST['email'];
$office_phone = $_POST['office_phone'];
$mobile_no = $_POST['mobile_no'];
$linkedinid = $_POST['linkedinid'];
$twitterid = $_POST['twitterid'];
$remark = $_POST['remark'];
$query3 = "update contact_person set saul = '$saul', name= '$name', gender = '$gender', bday = '$bday',department='$department',designation='$designation',contact_types='$contact_types',email='$email',office_phone='$office_phone',mobile_no='$mobile_no',linkedinid='$linkedinid',twitterid='$twitterid',remark='$remark',customer_name='$customer_name' where customer_id = '".$_REQUEST['customer_id']."' AND contact_id='".$_REQUEST['contact_id']."'";
//echo $query3;
$r3=mysql_query($query3,$conn);
//exit();
?>


<script>
javascript:window.location.href="view_all_contacts.php";
</script>
