View Single Post
Old 07-11-2008, 11:25 AM   #1 (permalink)
galleeandfarel
The Wanderer
 
galleeandfarel's Avatar
 
Join Date: Jun 2008
Posts: 15
Thanks: 4
galleeandfarel is on a distinguished road
Default registrarion form help...

in my registration form,i have two php files,one is register.php that is used to connect the database,and post my registration values into database,and another one is upload.php it used to upload the files int to one folder,how can i place these two php files,and get the output from the same form.....

my register.php is:
<?php
session_start();
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$dbselect = mysql_select_db('anand')or die("Can not select ");
if(!$dbselect){
die('Could not connect: ' . mysql_error());
}
if($_REQUEST["Check"] == 1)
{
$companyname = $_POST["companyname"];
$email = $_POST["email"];
$password = $_POST["password"];
$confirmpassword = $_POST["confirmpassword"];
$landlineareacode = $_POST["landlinearecode"];
$landline = $_POST["landline"];
$mobile = $_POST["mobile"];
$contact1 = $_POST["contact1"];
$contact2 = $_POST["contact2"];
$contact3 = $_POST["contact3"];
$contactpin = $_POST["contactpin"];
$corporate1 = $_POST["corporate1"];
$corporate2 = $_POST["corporate2"];
$corporate3 = $_POST["corporate3"];
$corporatepin = $_POST["corporatepin"];
$turnover = $_POST["turnover"];
$help1 = $_POST["help1"];
$help2 = $_POST["help2"];
$help3 = $_POST["help3"];
$profile = $_POST["profile"];
$upload_profile = $_POST["upload_profile"];
$query = "insert into employerstep1(companyname,email,password,confirmpa ssword,landlineareacode,landline,mobile,contact1,c ontact2,contact3,contactpin,corporate1,corporate2, corporate3,corporatepin,turnover,help1,help2,help3 ,profile,upload_profile) values('$companyname','$email','$password','$confi rmpassword','$landlineareacode','$landline','$mobi le','$contact1','$contact2','$contact3','$contactp in','$corporate1','$corporate2','$corporate3','$co rporatepin','$turnover','$help1','$help2','$help3' ,'$profile','$upload_profile')";
}
$result = mysql_query($query);
mysql_close($link);

?>



my upload.php is:

<?php
// Configuration - Your Options
$allowed_filetypes = array('.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation.
$max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB).
$upload_path = './files/'; // The place the files will be uploaded to (currently a 'files' directory).

$filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension).
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename.

// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');

// Now check the filesize, if it is too large then DIE and inform the user.
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');

// Check if we can upload to the specified path, if not DIE and inform the user.
if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');

// Upload the file to your specified path.
if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here[/url]'; // It worked.
else
echo 'There was an error during the file upload. Please try again.'; // It failed Sad.

?>
please help me to solve this....
galleeandfarel is offline  
Reply With Quote