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
https://forums.phpfreaks.com/topic/209121-santax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.