Jump to content

[SOLVED] image upload and update script


happypete

Recommended Posts

As far as updating goes, are you actually connected to a database, I don't see mysql_connect or mysql_select_db anywhere in your code. I'd have expected to see it somewhere near where your declaring the attributes for it..

 

$db_name = "trek_trek";
$db_server = "localhost";
$db_user = "trek_user";
$db_pass = "intergreen";
// here-ish

I've already put in 'include ('testconfig.php');' and the post above shows the results with it added

 

// Check if button name "Submit" is active, do this
include ('testconfig.php');
if (isset($_POST['Update'])) {
    $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
    $result1 = mysql_query($sql1) or die(mysql_error());
    if ($result1) {
        header("location:index1.php");
    }
}

 

full code:

 

<?php
error_reporting(E_ALL);
// It double checks to see if I'm logged in
require_once 'sources/login/classes/Membership.php';
$membership = New Membership();
$membership->confirm_Member();
$db_name = "trek_trek";
$db_server = "localhost";
$db_user = "trek_user";
$db_pass = "intergreen";
$change = "";
$abc = "";
define("MAX_SIZE", "400");
$errors = 0;

$rank = $_POST['rank'];
$description = $_POST['description'];
$id = $_POST['id'];

// Check if button name "Submit" is active, do this
include ('testconfig.php');
if (isset($_POST['Update'])) {
    $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
    $result1 = mysql_query($sql1) or die(mysql_error());
    if ($result1) {
        header("location:index1.php");
    }
}
if (isset($_POST['Upload'])) {
    $image = $_FILES["file"]["name"];
    $uploadedfile = $_FILES['file']['tmp_name'];
    if ($image) {
        $filename = stripslashes($_FILES['file']['name']);
        $extension = getExtension($filename);
        $extension = strtolower($extension);
        if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) {
            $change = '<div class="msgdiv">Unknown Image extension </div> ';
            $errors = 1;
        } else {
            $size = filesize($_FILES['file']['tmp_name']);
            if ($size > MAX_SIZE * 1024) {
                $change = '<div class="msgdiv">You have exceeded the size limit!</div> ';
                $errors = 1;
            }
            if ($extension == "jpg" || $extension == "jpeg") {
                $uploadedfile = $_FILES['file']['tmp_name'];
                $src = imagecreatefromjpeg($uploadedfile);
            } else if ($extension == "png") {
                $uploadedfile = $_FILES['file']['tmp_name'];
                $src = imagecreatefrompng($uploadedfile);
            } else {
                $src = imagecreatefromgif($uploadedfile);
            }
            list ($width, $height) = getimagesize($uploadedfile);
            $newwidth = 600;
            $newheight = ($height / $width) * $newwidth;
            $tmp = imagecreatetruecolor($newwidth, $newheight);
            $newwidth1 = 200;
            $newheight1 = ($height / $width) * $newwidth1;
            $tmp1 = imagecreatetruecolor($newwidth1, $newheight1);
            imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
            imagecopyresampled($tmp1, $src, 0, 0, 0, 0, $newwidth1, $newheight1, $width, $height);
            $filename = "uploads/" . $_FILES['file']['name'];
            $filename1 = "uploads/tn/" . $_FILES['file']['name'];
            imagejpeg($tmp, $filename, 100);
            imagejpeg($tmp1, $filename1, 100);
            imagedestroy($src);
            imagedestroy($tmp);
            imagedestroy($tmp1);
        }
    }
}
//If no errors registred, print the success message
   if ($errors == 0) {
       $q = "INSERT into photo(description, src, tn_src) VALUES('$description', '$filename', '$filename1')";
       //$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
      //$result = $mysqli->query($q) or die(mysqli_error($mysqli));
      $result = mysql_query($q) or die(mysql_error());
       if ($result) {
           $change = '<div class="msgdiv">Image Uploaded Successfully!</div>';
       }
   }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Page</title>
<link rel="stylesheet" href="sources/styles.css" type="text/css" />
<link rel="stylesheet" href="admin.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<h1>Admin page</h1>
</div>
<div id="content">
<div id="page">

    <?php
    echo $change;
    ?>
<table width="502" cellpadding="0" cellspacing="0" id="main">
   <tbody>
      <tr>
         <td width="500" height="238" valign="top" id="main_right">
         <div id="posts">
         <form method="post" action="" enctype="multipart/form-data"   name="form1">

         <table width="500" border="0" align="center" cellpadding="0"
            cellspacing="0">
            <tr>
               <Td style="height: 25px"> </Td>
            </tr>
            <tr>
               <td width="150">
               <div align="right" class="titles">Picture :</div>
               </td>
               <td width="350" align="left">
               <div align="left"><input size="25" name="file" type="file" style="font-family: Verdana; font-size: 10pt" class="box" /></div>
               </td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px" class="help">Image maximum size <b>400
               </b>kb</span></Td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px"><label for="description">Description</label><br />
               <input type="text" name="description" value="" /><br />
               </Td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px"><input type="submit" id="mybut" value="Upload" name="Upload" /></Td>
            </tr>
            <tr>
               <td width="200"> </td>
               <td width="200">
               <table width="200" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="200" align="center">
                     <div align="left"></div>
                     </td>
                     <td width="100"> </td>
                  </tr>
               </table>
               </td>
            </tr>
         </table>
         </form>
         </div>
         </td>
      </tr>
   </tbody>
</table>


<form method="POST" action="">
<?php
include ('testconfig.php');
$result = mysql_query("SELECT * FROM photo ORDER BY rank ASC") or die("Bad query: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
    ?>
<input type="text" name="id" size="2" value="<?php print $row['id']; ?>">
<input type="text" name="rank" size="2" value="<?php print $row['rank']; ?>">
<input type="text" name="description" size="" value="<?php print $row['description']; ?>">
<?php
    echo "<img src=\"" . $row['tn_src'] . "\"/>";
    echo " <a href=delete1.php?id={$row['id']}>Delete</a><br>";
} // END WHILE
?>
<input type="submit" value="Update" name="Update">
</form>

</div>1.0

<?php
function getExtension ($str)
{
    $i = strrpos($str, ".");
    if (! $i) {
        return "";
    }
     $l = strlen($str) - $i;
     $ext = substr($str,$i+1,$l);
     return $ext;
}
?>

Just move the if ($errors == 0) in side previous if block

            imagedestroy($tmp1);
        }
    }
}
//If no errors registred, print the success message
if ($errors == 0) {
    	$q = "INSERT into photo(description, src, tn_src) VALUES('$description', '$filename', '$filename1')";
    	//$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
	//$result = $mysqli->query($q) or die(mysqli_error($mysqli));
	$result = mysql_query($q) or die(mysql_error());
    if ($result) {
        $change = '<div class="msgdiv">Image Uploaded Successfully!</div>';
    }
}
?>

to

            imagedestroy($tmp1);
        }
    }
//If no errors registred, print the success message
if ($errors == 0) {
    	$q = "INSERT into photo(description, src, tn_src) VALUES('$description', '$filename', '$filename1')";
    	//$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
	//$result = $mysqli->query($q) or die(mysqli_error($mysqli));
	$result = mysql_query($q) or die(mysql_error());
    if ($result) {
        $change = '<div class="msgdiv">Image Uploaded Successfully!</div>';
    }
}
}
?>

awesome, nearly there  :D

 

It uploads fine and displays the thumbnails and editable descriptions, but only the original description is editable/updatable, the others don't update, so I assume there is something that needs to be done to the bit of code below to make it update all entires: 'array' / 'for each' ???

 

if (isset($_POST['Update'])) {
    $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
    $result1 = mysql_query($sql1) or die(mysql_error());
    if ($result1) {
        header("location:index.php");
    }
}

 

all the code:

 

<?php
error_reporting(E_ALL);
// It double checks to see if I'm logged in
require_once 'sources/login/classes/Membership.php';
$membership = New Membership();
$membership->confirm_Member();
$db_name = "trek_trek";
$db_server = "localhost";
$db_user = "trek_user";
$db_pass = "intergreen";
$change = "";
$abc = "";
define("MAX_SIZE", "400");
$errors = 0;

$rank = $_POST['rank'];
$description = $_POST['description'];
$id = $_POST['id'];

// Check if button name "Submit" is active, do this
include ('testconfig.php');
if (isset($_POST['Update'])) {
    $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
    $result1 = mysql_query($sql1) or die(mysql_error());
    if ($result1) {
        header("location:index.php");
    }
}
if (isset($_POST['Upload'])) {
    $image = $_FILES["file"]["name"];
    $uploadedfile = $_FILES['file']['tmp_name'];
    if ($image) {
        $filename = stripslashes($_FILES['file']['name']);
        $extension = getExtension($filename);
        $extension = strtolower($extension);
        if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) {
            $change = '<div class="msgdiv">Unknown Image extension </div> ';
            $errors = 1;
        } else {
            $size = filesize($_FILES['file']['tmp_name']);
            if ($size > MAX_SIZE * 1024) {
                $change = '<div class="msgdiv">You have exceeded the size limit!</div> ';
                $errors = 1;
            }
            if ($extension == "jpg" || $extension == "jpeg") {
                $uploadedfile = $_FILES['file']['tmp_name'];
                $src = imagecreatefromjpeg($uploadedfile);
            } else if ($extension == "png") {
                $uploadedfile = $_FILES['file']['tmp_name'];
                $src = imagecreatefrompng($uploadedfile);
            } else {
                $src = imagecreatefromgif($uploadedfile);
            }
            list ($width, $height) = getimagesize($uploadedfile);
            $newwidth = 600;
            $newheight = ($height / $width) * $newwidth;
            $tmp = imagecreatetruecolor($newwidth, $newheight);
            $newwidth1 = 200;
            $newheight1 = ($height / $width) * $newwidth1;
            $tmp1 = imagecreatetruecolor($newwidth1, $newheight1);
            imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
            imagecopyresampled($tmp1, $src, 0, 0, 0, 0, $newwidth1, $newheight1, $width, $height);
            $filename = "uploads/" . $_FILES['file']['name'];
            $filename1 = "uploads/tn/" . $_FILES['file']['name'];
            imagejpeg($tmp, $filename, 100);
            imagejpeg($tmp1, $filename1, 100);
            imagedestroy($src);
            imagedestroy($tmp);
            imagedestroy($tmp1);
        }
    }
//If no errors registred, print the success message
   if ($errors == 0) {
       $q = "INSERT into photo(description, src, tn_src) VALUES('$description', '$filename', '$filename1')";
       //$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
      //$result = $mysqli->query($q) or die(mysqli_error($mysqli));
      $result = mysql_query($q) or die(mysql_error());
       if ($result) {
           $change = '<div class="msgdiv">Image Uploaded Successfully!</div>';
       }
   }}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Page</title>
<link rel="stylesheet" href="sources/styles.css" type="text/css" />
<link rel="stylesheet" href="admin.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<h1>Admin page</h1>
</div>
<div id="content">
<div id="page">

    <?php
    echo $change;
    ?>
<table width="502" cellpadding="0" cellspacing="0" id="main">
   <tbody>
      <tr>
         <td width="500" height="238" valign="top" id="main_right">
         <div id="posts">
         <form method="post" action="" enctype="multipart/form-data"   name="form1">

         <table width="500" border="0" align="center" cellpadding="0"
            cellspacing="0">
            <tr>
               <Td style="height: 25px"> </Td>
            </tr>
            <tr>
               <td width="150">
               <div align="right" class="titles">Picture :</div>
               </td>
               <td width="350" align="left">
               <div align="left"><input size="25" name="file" type="file" style="font-family: Verdana; font-size: 10pt" class="box" /></div>
               </td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px" class="help">Image maximum size <b>400
               </b>kb</span></Td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px"><label for="description">Description</label><br />
               <input type="text" name="description" value="" /><br />
               </Td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px"><input type="submit" id="mybut" value="Upload" name="Upload" /></Td>
            </tr>
            <tr>
               <td width="200"> </td>
               <td width="200">
               <table width="200" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="200" align="center">
                     <div align="left"></div>
                     </td>
                     <td width="100"> </td>
                  </tr>
               </table>
               </td>
            </tr>
         </table>
         </form>
         </div>
         </td>
      </tr>
   </tbody>
</table>


<form method="POST" action="">
<?php
include ('testconfig.php');
$result = mysql_query("SELECT * FROM photo ORDER BY rank ASC") or die("Bad query: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
    ?>
<input type="text" name="id" size="2" value="<?php print $row['id']; ?>">
<input type="text" name="rank" size="2" value="<?php print $row['rank']; ?>">
<input type="text" name="description" size="" value="<?php print $row['description']; ?>">
<?php
    echo "<img src=\"" . $row['tn_src'] . "\"/>";
    echo " <a href=delete1.php?id={$row['id']}>Delete</a><br>";
} // END WHILE
?>
<input type="submit" value="Update" name="Update">
</form>

</div>1.0

<?php
function getExtension ($str)
{
    $i = strrpos($str, ".");
    if (! $i) {
        return "";
    }
     $l = strlen($str) - $i;
     $ext = substr($str,$i+1,$l);
     return $ext;
}
?>

Should be simple, *untested or proof read*

 

update form

<form method="POST" action="">
<?php
include ('testconfig.php');
$result = mysql_query("SELECT * FROM photo ORDER BY rank ASC") or die("Bad query: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
    ?>
<input type="text" name="id" size="2" value="<?php print $row['id']; ?>">
<input type="text" name="rank" size="2" value="<?php print $row['rank']; ?>">
<input type="text" name="description" size="" value="<?php print $row['description']; ?>">
<?php
    echo "<img src=\"" . $row['tn_src'] . "\"/>";
    echo " <a href=delete1.php?id={$row['id']}>Delete</a><br>";
} // END WHILE
?>
<input type="submit" value="Update" name="Update">
</form>

 

to

<?php
include ('testconfig.php');
$result = mysql_query("SELECT * FROM photo ORDER BY rank ASC") or die("Bad query: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
    ?>
<input type="text" name="rank[<?php print $row['id']; ?>]" size="2" value="<?php print $row['rank']; ?>">
<input type="text" name="description[<?php print $row['id']; ?>]" size="" value="<?php print $row['description']; ?>">
<?php
    echo "<img src=\"" . $row['tn_src'] . "\"/>";
    echo " <a href=delete1.php?id={$row['id']}>Delete</a><br>";
} // END WHILE
?>
<input type="submit" value="Update" name="Update">
</form>

 

and add loop

if (isset($_POST['Update'])) {
    $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
    $result1 = mysql_query($sql1) or die(mysql_error());
    if ($result1) {
        header("location:index.php");
    }
}

 

to

if (isset($_POST['Update'])) {
  foreach($_POST['description'] as $id => $description){
      $rank = $_POST['rank'][$id];
      $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
      $result1 = mysql_query($sql1) or die(mysql_error());
      if ($result1) {
          header("location:index.php");
      }
    }
}

 

 

:DAWESOME :D

 

Thanks MadTechie, cags, PFMaBiSmAd it's finally working, I've spent over a week trying to get it to work....

 

Here is the final code:

 

<?php
error_reporting(E_ALL);
// It double checks to see if I'm logged in
require_once 'sources/login/classes/Membership.php';
$membership = New Membership();
$membership->confirm_Member();
$db_name = "trek_trek";
$db_server = "localhost";
$db_user = "trek_user";
$db_pass = "intergreen";
$change = "";
$abc = "";
define("MAX_SIZE", "400");
$errors = 0;

$rank = $_POST['rank'];
$description = $_POST['description'];
$id = $_POST['id'];

// Check if button name "Submit" is active, do this
include ('testconfig.php');
if (isset($_POST['Update'])) {
  foreach($_POST['description'] as $id => $description){
      $rank = $_POST['rank'][$id];
      $sql1 = "UPDATE photo SET rank='$rank', description='$description' WHERE id=$id";
      $result1 = mysql_query($sql1) or die(mysql_error());
      if ($result1) {
          header("location:index.php");
      }
    }
}
if (isset($_POST['Upload'])) {
    $image = $_FILES["file"]["name"];
    $uploadedfile = $_FILES['file']['tmp_name'];
    if ($image) {
        $filename = stripslashes($_FILES['file']['name']);
        $extension = getExtension($filename);
        $extension = strtolower($extension);
        if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) {
            $change = '<div class="msgdiv">Unknown Image extension </div> ';
            $errors = 1;
        } else {
            $size = filesize($_FILES['file']['tmp_name']);
            if ($size > MAX_SIZE * 1024) {
                $change = '<div class="msgdiv">You have exceeded the size limit!</div> ';
                $errors = 1;
            }
            if ($extension == "jpg" || $extension == "jpeg") {
                $uploadedfile = $_FILES['file']['tmp_name'];
                $src = imagecreatefromjpeg($uploadedfile);
            } else if ($extension == "png") {
                $uploadedfile = $_FILES['file']['tmp_name'];
                $src = imagecreatefrompng($uploadedfile);
            } else {
                $src = imagecreatefromgif($uploadedfile);
            }
            list ($width, $height) = getimagesize($uploadedfile);
            $newwidth = 600;
            $newheight = ($height / $width) * $newwidth;
            $tmp = imagecreatetruecolor($newwidth, $newheight);
            $newwidth1 = 200;
            $newheight1 = ($height / $width) * $newwidth1;
            $tmp1 = imagecreatetruecolor($newwidth1, $newheight1);
            imagecopyresampled($tmp, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
            imagecopyresampled($tmp1, $src, 0, 0, 0, 0, $newwidth1, $newheight1, $width, $height);
            $filename = "uploads/" . $_FILES['file']['name'];
            $filename1 = "uploads/tn/" . $_FILES['file']['name'];
            imagejpeg($tmp, $filename, 100);
            imagejpeg($tmp1, $filename1, 100);
            imagedestroy($src);
            imagedestroy($tmp);
            imagedestroy($tmp1);
        }
    }
//If no errors registred, print the success message
   if ($errors == 0) {
       $q = "INSERT into photo(description, src, tn_src) VALUES('$description', '$filename', '$filename1')";
       //$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());
      //$result = $mysqli->query($q) or die(mysqli_error($mysqli));
      $result = mysql_query($q) or die(mysql_error());
       if ($result) {
           $change = '<div class="msgdiv">Image Uploaded Successfully!</div>';
       }
   }}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Page</title>
<link rel="stylesheet" href="sources/styles.css" type="text/css" />
<link rel="stylesheet" href="admin.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<h1>Admin page</h1>
</div>
<div id="content">
<div id="page">

    <?php
    echo $change;
    ?>
<table width="502" cellpadding="0" cellspacing="0" id="main">
   <tbody>
      <tr>
         <td width="500" height="238" valign="top" id="main_right">
         <div id="posts">
         <form method="post" action="" enctype="multipart/form-data"   name="form1">

         <table width="500" border="0" align="center" cellpadding="0"
            cellspacing="0">
            <tr>
               <Td style="height: 25px"> </Td>
            </tr>
            <tr>
               <td width="150">
               <div align="right" class="titles">Picture :</div>
               </td>
               <td width="350" align="left">
               <div align="left"><input size="25" name="file" type="file" style="font-family: Verdana; font-size: 10pt" class="box" /></div>
               </td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px" class="help">Image maximum size <b>400
               </b>kb</span></Td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px"><label for="description">Description</label><br />
               <input type="text" name="description" value="" /><br />
               </Td>
            </tr>
            <tr>
               <Td></Td>
               <Td valign="top" height="35px"><input type="submit" id="mybut" value="Upload" name="Upload" /></Td>
            </tr>
            <tr>
               <td width="200"> </td>
               <td width="200">
               <table width="200" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="200" align="center">
                     <div align="left"></div>
                     </td>
                     <td width="100"> </td>
                  </tr>
               </table>
               </td>
            </tr>
         </table>
         </form>
         </div>
         </td>
      </tr>
   </tbody>
</table>

<form method="POST" action="">
<?php
include ('testconfig.php');
$result = mysql_query("SELECT * FROM photo ORDER BY rank ASC") or die("Bad query: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
    ?>
<input type="text" name="rank[<?php print $row['id']; ?>]" size="2" value="<?php print $row['rank']; ?>">
<input type="text" name="description[<?php print $row['id']; ?>]" size="" value="<?php print $row['description']; ?>">
<?php
    echo "<img src=\"" . $row['tn_src'] . "\"/>";
    echo " <a href=delete1.php?id={$row['id']}>Delete</a><br>";
} // END WHILE
?>
<input type="submit" value="Update" name="Update">
</form>

</div>1.0

<?php
function getExtension ($str)
{
    $i = strrpos($str, ".");
    if (! $i) {
        return "";
    }
     $l = strlen($str) - $i;
     $ext = substr($str,$i+1,$l);
     return $ext;
}
?>

 

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.