Your Account mit Bild funktioniert nicht immer-Uploadfunktion

Begonnen von modelportal, 28 Oktober 2002, 17:44:50

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.

modelportal

Mal eine Frage.
Das Bild ist korrekt.Richtige Größe und auch das Dateiformat stimmt.Dennoch bekommt der User eine Fehlermeldung,das er eine Emailadresse angeben muß.
Ich bin der Meinung das es daran liegt,das nicht alle User beide Felder der Emailadressen ausfüllen.Wie kann ich das Script ändern,das das Script mit der Emailadresse arbeitet,die angegeben wird? Hier das Script:
-----------------------------------------------------------------------------------------------------------
<?php

/********************************************************/
/* Members Photo Upload v1.0 for PHP-Nuke 5.2.0         */
/* By: Joseph Howard                                    */
/* http://www.viadome.net                               */
/*                                                      */
/* This program is opensource so you can do whatever    */
/* you want with it.                                    */
/********************************************************/

global $lang, $newlang, $adminmail;
$modname = "Members_Photo_Upload";
if(!IsSet($mainfile)) { include ("mainfile.php"); }
if (!$user) { include("user.php"); }
if (!eregi("modules.php", $PHP_SELF)) { die ("You can't access this file directly..."); }

if (isset($newlang)) {
    $language = $newlang;
} elseif (isset($lang)) {
    $language = $lang;
}

if(file_exists("modules/$modname/language/$language.php")) {
   include("modules/$modname/language/$language.php");
} else {
   include("modules/$modname/language/lang-german.php");
}

$index = 1;
// Set server Directory (NO TRAILING SLASH)
$server_dir = "/home/www/doc/500/setcard4you.de/www/modules/My_eGallery/gallery/members";
// Your email
$youremail=$adminmail;
// Thank you page:
$thankspage="modules.php?op=modload&name=$modname&file=thanks";
// Email message on or off ? 1 = on, 0 = off
$emailmessages = "0";

global $uploadfile1;
global $uploadfile1_name;
global $upload_dir, $thetime, $user, $designname;

//If they don't specify a file to upload, die.
if (! $uploadfile1_name) {
echo "No file specified or file outside guidelines.\n
<a href=javascript:history.back(-1)>Return to the form</a>
";
exit;
}


cookiedecode($user);
$check = $cookie[1];
$result = mysql_query("SELECT uname, email FROM $prefix"._users." WHERE uname='$check'");
list($uname, $email) = mysql_fetch_row($result);

$user = $uname;
if ($user == ""){ // If no name, then return error.

echo _MEMNAME;
exit;
} else {

// Check for valid email address

$x = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email);

if($x==0)

// if no valid email address entered, display no email message
{
echo _MEMEMAIL;
exit;
}
else {

// This sets the time and creates a directory to upload to $startdate = time();
$thetime = date("m-d-Y_H-i-s", $startdate);

// Wherever you have write permission below...
$upload_dir = "$server_dir";

// Gets the temp_name in to a string variable
$uploadtemp1 = $uploadfile1;

// Gets those names into an array to be called later
$original = array(
"$uploadtemp1"
);

// Same as above except gets the real file name
$uploadreal1 = $uploadfile1_name;

$file = array(
"$uploadreal1"
);

// Copy handler for the above arrays
for($I = 0; $I <=6; $I++){
$file[$I] = ereg_replace(" ", "_", $file[$I]);
$file[$I] = ereg_replace("%20", "_", $file[$I]);
$copyfile = "$upload_dir/$file[$I]";
@move_uploaded_file($original[$I], $copyfile);
@unlink($original[$I]);


// This will rename the uploaded file to their username, no matter what file name they use.
// You can change $user.jpg to $user.gif or whatever you want.
rename ("$upload_dir/$file[$I]", "$upload_dir/$user.$type");


//return thank you page
Header("Location: $thankspage");

}
}

// Set Upload email thanks message for USER
$uptymessage="$user, thank you for uploading your photo.\n\nYour image will automatically be added to your articles.";
// Set Upload email thanks message for OWNER
$ownermessage="Username: $user\nEmail: $email\nDirectory: $upload_dir\nPhoto: $uploadreal1\n";

// Send Email
if ($emailmessages == "1") {
//mail you to let you know a new uploaded file
mail("$youremail", "Uploaded photo", "$ownermessage", "From: $email\nX-Mailer: PHP/" . phpversion());
//mail user to thank them
mail("$email", "Uploaded photo", "$uptymessage", "From: $youremail\nX-Mailer: PHP/" . phpversion());
}

}
?>

-------------------------------------------------------------------------------------------------
Ich habe es probiert,nur immer wieder das Script versaut.Ich hoffe,das mir geholfen werden kann.


MfG
http://www.setcard4you.de



EDIT: Name gelöscht

modelportal


dom

öhm, hab jetzt das script nicht ganz durchgeschaut, aber ist folgende zeile nur ein tipfehler?:
 
Zitat$x = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$e mail);  

ich meine das '$e mail' am schluss. sollte $email heißen!?

achja hab noch was vergessen:

 
ZitatIch bin der Meinung das es daran liegt,das nicht alle User beide Felder der Emailadressen ausfüllen.Wie kann ich das Script ändern,das das Script mit der Emailadresse arbeitet,die angegeben wird?

das script arbeitet mit der email die angegeben werden muss! (liest ja auch das feld email und nicht femail aus!)

[Editiert am 30/10/2002 von dom]