Jump to content

lambik

Members
  • Posts

    24
  • Joined

  • Last visited

Profile Information

  • Location
    Slovakia

lambik's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Check my code now I have edited it as you suggested. Still the same result though.
  2. Hi guys, once again I am unable to solve my problems so I post them here. Here is my code which shows photoalbums and it is a little bit complicated because it is checking if there exist album with given number $pocet then it also checks if there is cover photo, if not it will show up original photo from folder images. But I get this error message and I can't solve it and what's more interesting is that my page is all good just as I want it except this error. Hmmm. echo("<div class=\"article\">"); if ($albums>0) { echo(" <h2>Albumy používateľa <a href=\"user_profile.php?meno=".$_REQUEST['meno']."\">".$_REQUEST['meno']."</a></h2> "); while ($pocet<$albumy+1) { $albumid=$pocet-1; $profil='nie'; $album=mysql_query("SELECT * FROM fotky WHERE meno='".$_REQUEST['meno']."' && albumid='".$pocet."' ") or exit(mysql_error()); while ($riadok=mysql_fetch_array($album)) { if ($riadok['profilova']=='ano') { $profil='ano'; $album=$riadok['album']; $last=$riadok['last']; $ext=$riadok['ext']; } $albumid=$riadok['albumid']; } if ($albumid==$pocet) { if ($profil=='ano') { echo(" <a href=\"view_album.php?meno=".$_REQUEST['meno']."&albumid=".$pocet."\"> <img src=\"users/".$_REQUEST['meno']."/".$pocet."/".$last.".".$ext."\" height=\"165\" width=\"165\" alt=\"\" style=\"margin:0px 15px 15px 0px;\" title=\"Album ".$album."\"/> </a> "); } else { echo(" <a href=\"view_album.php?meno=".$_REQUEST['meno']."&albumid=".$pocet."\"> <img src=\"images/userpic.gif\" height=\"165\" width=\"165\" alt=\"\" title=\"Tento album nemá nastavený obal\" style=\"margin:0px 15px 15px 0px;\"/> </a> "); } } $pocet=$pocet+1; } } else { if ($_REQUEST['meno']==$_SESSION['user']) { echo(" <h2>Zatiaľ nemáte žiadny fotoalbum!</h2> <h3>Vytvorte si ho pomocou tlačidla výše.</h3>"); } else{ echo(" <h2>To je škoda!</h2> <h3>Radi by sme vám ukázali nejaké nahotinky tohto užívateľa alebo aspoň jeho fotky o zrkadlo, ale bohužiaľ si ešte nevytvoril žiadny album.</h3>");} } echo("</div>"); } The selected part is what's giving me error.
  3. Ok this time it is little bit more difficult for me. I am creating settings panel which is working well for me but it is not saving space. For example i have a few options there - male/ female, employed/ unemployed, ... they are all radio buttons. But the problem is I can only create form for each pair of them because i cant find out how to do it in one form. Lets say i will put all these options in one form and it will store all checked buttons in mysql database. I can do that. But everytime my user wants to change some of these informations he must check again all boxes so it is very time consuming. And what I want is to use script which will somehow read mysql database and based on informations stored in table it will chceck these boxes automatically so user wont have to do it all by himself every time he wants to change one thing there. I hope I wrote it clear enough I am not sure if this is going to be solved with javascript but it is definitely using php mysql database so i put it here dont blame me for that please. Thanks
  4. Thanks for help, although it is still not working as i expected i can see my progress now so i will try to handle this. ThanksEDIT: I stored it as a jpg but now i only need to give it username.EDIT2: Buala, its working perfectly now, i really appreciate your help.
  5. Because I don't understand which part of this block should I edit and where do I have to put $_SESSION[user] (that is the name i want for it but it must also have original extension). Can you describe it please little bit more?
  6. Hi! This time I am working on file upload for my website (profile images). And what I want is to rename the uploaded file to username, so if user uploads file named image.jpg it will rename itself to username.jpg. So far I have this working code but I cant solve how to rename it and store to folder. <?php$ftp_server = "********";$ftp_user_name = "********";$ftp_user_pass = "******";header('Content-Type: text/html;charset=UTF-8'); $spojenie=mysql_connect("*****", "******", "******"); if (!$spojenie) { die("Chyba pri pripájaní k databáze."); } $db=mysql_select_db("******",$spojenie); if (!$db) { die("Chyba pri výbere databázy."); }// set up a connection or die$conn_id = ftp_connect($ftp_server) or die("Nemožno pripojiť k $ftp_server"); $text =$_REQUEST['meno'];$dir = $text;// set up basic connection$conn_id = ftp_connect($ftp_server);// login with username and password$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);// try to create the directory $dirif (@ftp_mkdir($conn_id, $dir)) { $destination_path = getcwd().DIRECTORY_SEPARATOR."".$_REQUEST['meno']."".DIRECTORY_SEPARATOR; $result = 0; $target_path = $destination_path . basename($_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $result = 1; } sleep(1); echo(" <script language=\"javascript\" type=\"text/javascript\">window.top.window.stopUpload(<?php echo $result; ?>);</script> ");}else{ $destination_path = getcwd().DIRECTORY_SEPARATOR."".$_REQUEST['meno']."".DIRECTORY_SEPARATOR; $result = 0; $target_path = $destination_path . basename($_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $result = 1; } sleep(1); echo(" <script language=\"javascript\" type=\"text/javascript\">window.top.window.stopUpload(<?php echo $result; ?>);</script> ");}// close the connectionftp_close($conn_id);?> I will appreciate any help. Thanks
  7. Thanks, Ill try.EDIT: Thanks for advices, it is working perfectly now. :)EDIT2: Yet my problem with database coding is still actual, please check that topic if you can help me.
  8. Hi. This time I have another problem with logging on on my website. I created username lambik and registered. When I try registering new username as LaMBik, it doesnt count, but if I try log on as LaMBik it is accepted and it is causing a lot of problems. For example I cant send message to myself but when I am logged as LaMBik I can and then it causes a lot of bugs...In login form I tried this code $sql="SELECT * from users WHERE meno=='$_POST[login]' && heslo=='$_POST[heslo]'";$result=mysql_query($sql,$spojenie) or die(mysql_error());return mysql_num_rows($result); If the last line is equal to 1 it will log me on. But there is an error which says You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=='' && heslo==''' at line 1 and that means I must change that code to this $sql="SELECT * from users WHERE meno='$_POST[login]' && heslo='$_POST[heslo]'";$result=mysql_query($sql,$spojenie) or die(mysql_error());return mysql_num_rows($result); And if I have that code it allows me to log on using both nicks or I can combine big and small letters it doesnt matter. Anyone know how to solve this? Thanks
  9. Nobody who can help me?EDIT: I tried everything as you suggested me above, yet nothing has worked for me...at least I just found out how to get my ftp server show me that symbols right (ľ,š,č,ť,ž,ý,á,...) but the problem lays in the database, dont know where. I set collation of tables to utf8_slovak_ci, tried unicode, same result,... but whats interesting is, it shows me properly á,ý,í,é,ä even if it has saved them to table as ˇA" or something like that...but when it saves č as ˇA? it is not shown properly. Damn.EDIT2: Now, it is working properly. I must switched table collation to latin2_czech_cs case-sensitive type and it is somehow working now. Czech language isnt so different from Slovak so I suppose it wont cause problems anymore.
  10. This line didn't help me...still when I try edit my file in ftp server it shows me that weird symbols and so it is in mysql database...
  11. Still actual...EDIT: Ok so my beatiful code now looks like this: <?php$ip=@$REMOTE_ADDR;header('Content-Type: text/html;charset=UTF-8');$spojenie=mysql_connect("localhost", "menus_ee-p_eu", "52624513");if (!$spojenie) { die("Chyba pri pripájaní k databáze.");}$db=mysql_select_db("menus_ee-p_eu", $spojenie);if (!$db) { die("Chyba pri výbere databázy.");}$sql = "SELECT * FROM komentare WHERE autor='$_REQUEST[autor]' && nadpis='$_REQUEST[nadpis]' && kam='$_REQUEST[kam]' ORDER BY ID DESC";$vysledok2 = mysql_query($sql);$sql2 = "SELECT * FROM komentare WHERE autor='$_REQUEST[autor]' && nadpis='$_REQUEST[nadpis]' && kam='$_REQUEST[kam]' ORDER BY ID DESC";$vysledok = mysql_query($sql2);?> Let's see if this is gonna work.
  12. Hey, thanks, but I am newbie to this (just 3 days) and I don't know how to configure this. Only thing I got is when I create a new table I always set character set to utf8_slovak_ci to varchar arrays, but this doesn't solve the problem.
  13. http://mysql.ee-p.eu/ that's my MySQL database and I have problem with character sets. Sometimes it displays characters like ľ,š,č,ť,ž,ý,á,í,é,ä,ň,ď properly but it never displays them all properly at once. Can anybody tell me how to change this setting to utf8 slovak set? ThanksEDIT: when i write code on a page, i save it as utf8 coding. When i upload it to database and i press edit in it, it opens up in ancii coding and characters like á are shown as AÄ or something like this. Ive changed setting in my tables to utf8 slovak ci but it doesnt seem to help. Thanks for help
  14. lambik

    SOLVED

    Solved
×
×
  • Create New...