$hostname ='localhost';
$port = '3306';
$usernam = 'ndc_db'; //ndc_db
$pass = 'm7Q6cs$7'; //ndc_db2214$!
$db = 'ndc_db';
$conn = mysql_connect("$hostname:$port", "$usernam", "$pass") or die("Invalid server or user.");
mysql_select_db("$db", $conn);
putenv("TZ=Asia/Tehran");
mysql_query("SET CHARACTER SET utf8;");
//$ip=@$REMOTE_ADDR;
$ip=$_SERVER['REMOTE_ADDR']; //IP address if the register_global is off
?>
$succ = "";
$error = "";
/////////////////up///////////////////////////
if($_FILES["file"]["name"] != "")
{
$allowedExts = array("pdf","docx","doc");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "application/pdf") || ($_FILES["file"]["type"] == "application/msword")
|| ($_FILES["file"]["type"] == "text/plain") || ($_FILES["file"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document"))
&& ($_FILES["file"]["size"]/1024 < 1000)
&& in_array($extension, $allowedExts))
{
if (file_exists("contentkw/employment/" . $_FILES["file"]["name"]))
$error='Duplicate file';
else
move_uploaded_file($_FILES["file"]["tmp_name"],
"contentkw/employment/" . $_FILES["file"]["name"]);
$insertfilename = $_FILES["file"]["name"];
//echo $insertfilename;
}
else
{
echo $errormessage='
Attach file is not correct
';
}
}
///////////////////////////////////////////////////////////
if (empty($_POST['firstname'])==FALSE && empty($_POST['lastname'])==FALSE &&
empty($_POST['email'])==FALSE && empty($_POST['tel'])==FALSE && empty($_POST['address'])==FALSE)
{
if (isset($_POST['firstname']) && isset($_POST['lastname']) &&
isset($_POST['email']) && isset($_POST['tel']) && isset($_POST['address']))
{
if (isset($_POST["verify"]))
{
if ($_SESSION["verifycode"] == $_POST["verify"])
{
$sql="insert into job_tb values ('',
'".$_POST['education']."',
'".$_POST['graduate']."',
'".$_POST['applying']."',
'".$_POST['relocate']."',
'".$insertfilename."',
'".$_POST['salary']."',
'".$_POST['firstname']."',
'".$_POST['lastname']."',
'".$_POST['gender']."',
'".$_POST['email']."',
'".$_POST['tel']."',
'".$_POST['address']."',
0)";
$result=mysql_query ($sql, $conn);
// echo $sql;
if ($result)
{
$succ = '
با تشکر اطلاعات شما بررسی می شود
';
}
}
else
$error = "کد تایید صحیح نمی باشد";
}
else
$error = "لطفا کد تایید را وارد نمایید";
}
else
$error = "لطفا تمام فیلدهای ستاره دار را پر کنید";
}
?>