Jump to content

Santax Error


ajicles

Recommended Posts

So for some reason when I put mysql close inside of a function if give me a santax error in DreamWeaver CS5 and with the mysql close isn't inside of the function its fine.. All I am trying to do it if the user get the captcha wrong it will not do the function.

 

$captcha = rand(1,10);



    if(isset($_POST['MultiPowUpload_browserCookie']))
{
$cookies = split(";", $_POST['MultiPowUpload_browserCookie']);
foreach($cookies as $value)
{
	$namevalcookies = split("=", $value);	
	$browsercookie[trim($namevalcookies[0])] =  trim($namevalcookies[1]);
}
$_COOKIE = $browsercookie;
}
//restore session if possible
if(isset($browsercookie) && isset($browsercookie['PHPSESSID']))
{	
session_id($browsercookie['PHPSESSID']);
session_start();
}

if (isset($_POST['submit'])) {}

function upload_form(){
$uploaddir = dirname($_SERVER['SCRIPT_FILENAME'])."/UploadedFiles/";
if(count($_FILES) > 0)
{
$arrfile = pos($_FILES);
$uploadfile = $uploaddir . basename($arrfile['name']);
$filename = basename($arrfile['name']);

if (move_uploaded_file($arrfile['tmp_name'], $uploadfile))
   echo "File " . basename($arrfile['name']) . " was successfully uploaded.";
	//$filename = basename($arrfile['name'];
}
echo '<br> '; // At least one symbol should be sent to response!!!


$ip_address = $_SERVER['REMOTE_ADDR'];
$file_hash = hash('ripemd160', '$filename');

echo 'Link to your file: <a href="http://localhost/filehosting/?d='.$file_hash.'">http://localhost/filehosting/?d='.$file_hash.'</a>';

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("filehosting");

$sql="INSERT INTO data(ID, file_location, file_hash, file_ip_address) VALUES ('','$filename','$file_hash','$ip_address')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
}
mysql_close($con)

 

And this doesn't work:

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

mysql_close($con)
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.