Expand|Select|Wrap|Line Numbers
- <?php
- include('auth.php');
- ob_start();
- include('config.php');
- $title=$_POST['title'];
- $content=$_POST['text1'];
- $titles=$_POST['title1'];
- $contents=$_POST['text2'];
- $file = basename($_FILES['img']['name']);
- if($file)
- {
- //exit(var_dump($_FILES));
- $file=time().$file;
- $target_path = dirname(_FILE_). '/img/';
- $hh=move_uploaded_file($_FILES['img']['tmp_name'],$target_path.$file);
- //echo $hh."lipu";
- }
- $name="img/".$_FILES['img']['name'];
- //we verify if the image has been uploaded, and print error instead
- if(isset($_POST['Submit']) && !$errors)
- {
- header("location:aboutus.php?msg=success");
- }
- $sql="INSERT INTO aboutus(title,des,subtitle,descr,img)VALUES('$title','$content','$titles','$contents','$file')";
- $result=mysql_query($sql);
- if(!$sql)
- die(mysql_error());
- // close connection
- mysql_close();
- ?>