Sie sind nicht angemeldet.
![]() |
Quellcode |
1 |
Avatar (Max 100x100): <input type="file" name="pic" /> |
![]() |
Quellcode |
1 2 3 4 5 |
$pic = $_FILES['pic']; blabla $sql = "INSERT INTO user VALUES (null, '$username', '$password', '$mail', '$age', '$pic'" |
![]() |
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
switch ($_GET['orderby']) { case "name": $sql = "SELECT highscore.username, highscore.money, highscore.date, highscore.version, user.pic FROM highscore WHERE money!=0 ORDER BY username ASC, money DESC"; $cnt2=500; break; blabla} dbconnect(); $res = mysql_query($sql) or dietrace(mysql_error()); if(mysql_num_rows($res)) { $cnt =1; while($cin = mysql_fetch_array($res)) { if ($cnt<=$cnt2) { ?> <tr> <td> <?php echo $cnt . "."; ?> </td> <td> <?php echo $cin['username']; ?> </td> <td> <?php echo $cin['money']; ?> </td> <td> <?php echo $cin['date']; ?> </td> <td> <?php echo $cin['version']; ?> </td> <td> <?php echo '<img="'$cin['pic']'">s'; ?> </td> </tr> <?php $cnt++; } } |
![]() |
Quellcode |
1 |
move_uploaded_file($_FILES['pic']['tmp_name'], "pics/".$_SESSION["USER_ID"].".jpg") |
![]() |
Quellcode |
1 |
echo "<img=\"/pics/".$cin['id'].".jpg\">"; |
![]() |
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<?php session_start(); require_once('common.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/url] <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Change Details</title> </head> <body> <?php $pic = $_FILES['pic']; if(file_exists("pics/".$_SESSION['username'].".jpg"){ echo "File already exists"; } else{ move_uploaded_file($_FILES['pic']['tmp_name'], "pics/".$_SESSION['username'].".jpg"); echo "Picture uploaded"; } ?> Here you can add an Image/Avatar to your account: <form method="post" action="change.php" /> <table border="0" cellpadding="0" cellspacing="4"> <tr> <td align="right">Avatar: </td> <td><input type="file" name="pic" /></td> </tr> <tr> <td><td align="right"><input type="submit" value="Register" /></td></td> </tr> </form> </body> </html> |
![]() |
Quellcode |
1 |
$filename = sprintf('user%04d.jpg', $user_id); |
![]() |
Quellcode |
1 2 |
upload_picture($_FILES['file'], $filename); delete_picture($filename); |
Zitat von »Wudel«
Hmm nunja, jetzt hab ich hier die change.php zurechtgepfuscht. Und mein Apache von XAMPP will nicht laufen, sodass ichs mal testen kann, schoise!
![]() |
Quellcode |
1 |
echo "<img=\"/pics/".$cin['username'].".jpg\">"; |
Zitat von »Wudel«
ich wollte die bilder auch nicht nach dem schema 0000xxx.jpg speichern, sondern username.jpg
Zitat von »Wudel«
aber unabhängig davon, wird ein definitiv vorhandenes bild in dem verzeichnis mit der zeile code nicht angezeigt. hmm mal weitersuchen.
![]() |
Quellcode |
1 |
<?php echo "<img src=\"pics/".$cin['username'].".jpg\">"; ?> |
-