webForumDet fria alternativet
Logga in / Bli medlem

header problem

PHP

1 svar · 235 visningar · startad av Leon

Medlem sedan nov. 200227 inlägg
Trådstart#1

Den vill inte svälja den här koden... säjer så här

Warning: Unable to create '..\PhotoArchive\A2-0.jpg': Permission denied in /home/leon/public_html/substitute/admin/adminphoto.php on line 56

Warning: Cannot add header information - headers already sent by (output started at /home/leon/public_html/substitute/admin/adminphoto.php:56) in /home/leon/public_html/substitute/admin/adminphoto.php on line 72

jag har satt CHMOD till 777 på katalogen jag föröker köra upp till,

sen får jag ju det här med headers already sent.. det fattar jag inte riktigt vad det innebär?! skulle nån kunna förklara.

:birp

<?php require_once('../Connections/subconn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "InsertPhoto")) {

########################################################
switch ($_FILES['file']['type']){
            case "image/gif":
                $fileext = ".gif";
            break;
            case $_FILES['file']['type']="image/jpeg" ||$_FILES['file']['type']="image/pjpeg":
                $fileext = ".jpg";
            break;
            case $_FILES['file']['type']="image/png" ||$_FILES['file']['type']="image/x-png":
                $fileext = ".jpg";
            break;
}

$i = 0;
$destinationfolder = "..\\PhotoArchive\\";
$destinationfile = "$SectionID-$i$fileext";

while (file_exists($destinationfolder.$destinationfile))
{
$i++;
}
copy($file, $destinationfolder.$destinationfile);

  $insertSQL = sprintf("INSERT INTO sphoto (SectionID, Name, Comments, Url) VALUES (%s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['SectionID'], "int"),
                       GetSQLValueString($HTTP_POST_VARS['Name'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['Comments'], "text"),
                       GetSQLValueString($destinationfile, "text"));

  mysql_select_db($database_subconn, $subconn);
  $Result1 = mysql_query($insertSQL, $subconn) or die(mysql_error());

  $insertGoTo = "adminmenu.php";
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

?>
Medlem sedan nov. 200013 890 inlägg
#2

Välkommen till wF Leon.
Det är alltid en bra ide att söka innan man postar sin fråga. Det här nog svar på din andra fråga:

http://www.webforum.nu/showthread.php?s=&threadid=56333

261 ms totalt · 4 externa anrop · v20260731065814-full.51f67c91
126 ms — deklarationer (db)
0 ms — hämta statistik (cache)
131 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)