want ik heb een upload script van sitemasters aangepast maar steeds krijg ik een foutmelding. heb ik jouw oplossing verkeerd neergezet of ligt het aan iets anders?
dit is de (aangepaste) code:
<?php
if(!empty($_POST)){
$locatie="images/$memberid/"; //of een andere map, vergeet niet de w-rechten
if(is_uploaded_file($_FILES['afbeelding']['tmp_name']))
{
//controleer grootte
if($_FILES['afbeelding']['size']>15000)
{ //bepaal zelf de max. grootte in bytes
echo "Het bestand is te groot";
exit;
}
//controleer extensie, voeg maar andere toe
if(!eregi("((.gif|.jpg)$)", $_FILES['afbeelding']['name']))
{
echo "het bestand is niet van het juiste type";
exit;
}
if(!move_uploaded_file($_FILES['afbeelding']['tmp_name'],
$locatie.$_FILES['afbeelding']['name']))
{
echo" het bestand kan niet worden verplaatst";
exit;
}
echo "Uw bestand ".$_FILES['afbeelding']['name']." is nu uw Avatar.";
$een = http://members.lycos.nl/tijgerbas3/PHPBBLZ/avatar/images/$memberid/
$twee = $_FILES['afbeelding']['name']
$locatie = $een.$twee
$query ="UPDATE members SET avatar='$locatie' WHERE memberid = '$memberid'" or die(mysql_error());
mysql_query($query);
}
else
{
echo "Het uploaden is mislukt";
}
}
else{
?>
ik krijg telkens deze foutmelding:
"Parse error: parse error in /data/members/free/tripod/nl/t/i/j/tijgerbas3/htdocs/PHPBBLZ/avatar/index.php on line 162"
<script language="javascript" type="text/javascript">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
<?
session_start();
require("../config.php");
if(!$login){
?>
<html>
<head>
<meta http-equiv="Content-Language" content="nl">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Avatar</title>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
</head>
<font size="1" face="Verdana">
Als je van deze service gebruik wilt maken moet je eerst inloggen of aanmelden als je nog niet lid bent.
</font>
</font>
</html>
<?
}
if($login AND session_is_registered('memberid')){
$query = mysql_query("SELECT * FROM members WHERE memberid = '$memberid'");
while($object = mysql_fetch_object($query)){
$gebruikersnaam = $object->gebruikersnaam;
$priveberichten = $object->pm;
$credits = $object->credits;
}
$query = mysql_query("SELECT * FROM priveberichten WHERE naar = '$memberid'");
$result = mysql_num_rows($query);
?>
<html>
<head>
<meta http-equiv="Content-Language" content="nl">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Avatar</title>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
</head>
<body link="black" vlink="black" alink="black">
<font size="1" face="Verdana">
<?php
if(!empty($_POST)){
$locatie="images/$memberid/"; //of een andere map, vergeet niet de w-rechten
if(is_uploaded_file($_FILES['afbeelding']['tmp_name']))
{
//controleer grootte
if($_FILES['afbeelding']['size']>15000)
{ //bepaal zelf de max. grootte in bytes
echo "Het bestand is te groot";
exit;
}
//controleer extensie, voeg maar andere toe
if(!eregi("((.gif|.jpg)$)", $_FILES['afbeelding']['name']))
{
echo "het bestand is niet van het juiste type";
exit;
}
if(!move_uploaded_file($_FILES['afbeelding']['tmp_name'],
$locatie.$_FILES['afbeelding']['name']))
{
echo" het bestand kan niet worden verplaatst";
exit;
}
echo "Uw bestand ".$_FILES['afbeelding']['name']." is nu uw Avatar.";
$een = "http://members.lycos.nl/tijgerbas3/PHPBBLZ/avatar/images/$memberid/";
$twee = "$_FILES['afbeelding']['name']";
$locatie = "$een.$twee";
$query ="UPDATE members SET avatar='$locatie' WHERE memberid = '$memberid'" or die(mysql_error());
mysql_query($query);
}
else
{
echo "Het uploaden is mislukt";
}
}
else{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
<input type="file" name="afbeelding"><br>
<input type="submit" name="submit" value="Avatar Uploaden">
</form>
</font>
</body>
</html>
<?php
}
}
?>
<script language="javascript" type="text/javascript">
<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://
www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-
w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-
h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/
2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") ||
pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
// -->
</script>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/
index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts,
visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
<?
session_start();
require("../config.php");
if(!$login){
?>
<html>
<head>
<meta http-equiv="Content-Language" content="nl">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Avatar</title>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/
index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts,
visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
</head>
<font size="1" face="Verdana">
Als je van deze service gebruik wilt maken
moet je eerst inloggen of aanmelden als je nog niet lid bent.
</font>
</font>
</html>
<?
}
if($login AND session_is_registered('memberid')){
$query = mysql_query("SELECT * FROM members WHERE memberid =
'$memberid'");
while($object = mysql_fetch_object($query)){
$gebruikersnaam = $object->gebruikersnaam;
$priveberichten = $object->pm;
$credits = $object->credits;
}
$query = mysql_query("SELECT * FROM priveberichten WHERE naar =
'$memberid'");
$result = mysql_num_rows($query);
?>
<html>
<head>
<meta http-equiv="Content-Language" content="nl">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Avatar</title>
<script language="javascript">
/*
Auto center window script- Eric King (http://redrival.com/eak/
index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts,
visit http://dynamicdrive.com
*/
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
</head>
<body link="black" vlink="black" alink="black">
<font size="1" face="Verdana">
<?php
if(!empty($_POST)){
$locatie="images/$memberid/"; //of een andere map, vergeet niet
de w-rechten
if(is_uploaded_file($_FILES['afbeelding']['tmp_name']))
{
//controleer grootte
if($_FILES['afbeelding']['size']>15000)
{ //bepaal zelf de max. grootte in bytes
echo "Het bestand is te groot";
exit;
}
//controleer extensie, voeg maar andere toe
if(!eregi("((.gif|.jpg)$)", $_FILES['afbeelding']['name']))
{
echo "het bestand is niet van het juiste
type";
exit;
}
if(!move_uploaded_file($_FILES['afbeelding']['tmp_name'],
$locatie.$_FILES['afbeelding']['name']))
{
echo" het bestand kan niet worden verplaatst";
exit;
}
echo "Uw bestand
".$_FILES['afbeelding']['name']." is nu uw Avatar.";
$een = "http://members.lycos.nl/tijgerbas3/PHPBBLZ/avatar/images/
$memberid/";
$twee = $_FILES['afbeelding']['name'];
$locatie = $een.$twee;
$query ="UPDATE members SET avatar='$locatie' WHERE memberid =
'$memberid'" or die(mysql_error());
mysql_query($query);
}
else
{
echo "Het uploaden is mislukt";
}
}
else{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];
?>" enctype="multipart/form-data">
<input type="file" name="afbeelding"><br>
<input type="submit" name="submit" value="Avatar Uploaden">
</form>
</font>
</body>
</html>
<?php
}
}
?>
Bedankt! Het uploaden gaat nu goed maar het opslaan in de MySQL database niet. hij hoort bij members onder avatar de url neer te zetten bij de rij van degene die ingelogd is maar dat doet hij niet.
Is er iets fout met de code of moet ik iets wijzigen in mijn mysql database bij avatar?