noh..
<?php
if(!isset($mainfile)) { include("mainfile.php");
}
if(!is_user($user)) {
Header("Location: modules.php?name=Your_Account");
exit();
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
/**********************************/
/* Configuration */
/* */
/* You can change this: */
/* $index = 0; (right side off) */
/**********************************/
$index = 0;
$subject = "$sitename "._FEEDBACK."";
/**********************************/
include("header.php");
include("navbar.php");
global $AllowableHTML, $prefix, $user, $cookie, $anonymous, $currentlang, $multilingual, $db, $module_name;
if (is_user($user)) getusrinfo($user);
$cookie[0] = intval($cookie[0]);
if ($cookie[1] != "") {
$row = $db->sql_fetchrow($db->sql_query("SELECT name, username, user_email FROM ".$user_prefix."_users WHERE user_id='$cookie[0]'"));
if ($row['name'] != "") {
$sender_name = $row['name'];
} else {
$sender_name = $row['username'];
}
$sender_email = $row['user_email'];
}
function uploadform(){
global $user, $userinfo, $cookie, $module_name, $bgcolor2, $bgcolor3;
getusrinfo($user);
$tulemus = mysql_query("SELECT * FROM songlist WHERE lisas='$userinfo[name]'");
$song = mysql_fetch_array($tulemus);
$Form_plokk="<center>Siin saad vahetada oma pildi igal sinu lool võib olla erinev pilt.</center>
<form enctype=\"multipart/form-data\" action=\"modules.php?name=radio&file=uppilt\" method=\"POST\">
<b><center><img src=\"modules/radio/pictures/$song[picture]\" alt=\"Sinu praegune pilt\" border=0></center><br>
nimi<input type=text name=A size=40 VALUE=\"$userinfo[username]\"><br>
sinu email<input type=text name=B size=40 VALUE=\"$userinfo[user_email]\"><br>
<BR><BR>
<input type=\"hidden\" name=\"LooID\" value=\"$song[ID]\">
<input type=\"hidden\" name=\"tee\" value=\"tegevus\">
Vali fail oma arvutist: <input name=\"uploadedfile\" type=\"file\" /> kogu nimi väikeste tähtedega<br><br>
<input type=\"submit\" value=\"Upload File\" />
</form>";
opentable();
echo $Form_plokk;
closetable();
//on kataloog
//enne seda paned siis näiteks mkdir("mp3");
}
//or if(substr($filename, strlen($filename)-3, strlen($filename)) == "mp3"){
// echo "on jah mp3"; savemine } else { echo "ei ole mp3"; }
function teeupload(){
$filename = basename( $_FILES['uploadedfile']['name']);
if(substr($filename, strlen($filename)-3, strlen($filename)) == "jpg"){
$target_path = "D:/lasteraadio/modules/radio/pictures/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
opentable();
echo "<h1>Fail ". basename( $_FILES['uploadedfile']['name']). " on edukalt lisatud.</h1><br>"
."See kuvatakse sinu loo juures.";
closetable();
} else{
opentable();
echo "Faili lisamisel tekkis viga, palun proovi uuesti!";
closetable();
}
} else {
opentable();
echo "<font color=red><h1>Sinu lisatud fail ei ole *.jpg!</h1></font><br> Fail peab kindlasti olema jpg laiendiga.";
closetable();
}
$ID = $_POST["LooID"];
echo "$filename";
mysql_query("UPDATE songlist SET picture='$filename' WHERE ID='$ID'");
echo mysql_error();
}
switch($tee){
case "tegevus":
teeupload();
break;
default:
uploadform();
break;
}
include("footer.php");
?>
//mis see teeb ja kus kasutatkse?