gkazhus Posted June 4, 2010 Report Share Posted June 4, 2010 (edited) Man ir šāds kods! Doma ir tāda ka būtu iespēja uploudot kaut kādu baneri un pielikt banerim linku. Kad uzspiež uz banera jaunā logā atveras saite kas norādīt pie banera uploudošanas. Baneris tiek uploudots gan uz servera gan noglabāts MYSQL DB. Bet kaut kas nav lāgā ar šo kodu! Varat kāds zinošs palīdzēt? Kods: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("../banners/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../banners/" . $_FILES["file"]["name"]); echo "Stored in: " . "../banners/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } $DatabaseHost = ""; $DatabaseUsername = ""; $DatabasePassword = ""; $DatabaseName = ""; $connection = mysql_connect($DatabaseHost, $DatabaseUsername, $DatabasePassword) or die("Cannot connect to MySQL!"); mysql_select_db($DatabaseName, $connection) or die("Cannot find database!"); $sql = " INSERT INTO right_side_banners (ID, active, banner, link_URL) VALUES (0, 1, \"file", \"link_URL\");"; $rs = mysql_query($sql); print mysql_error(); } ?> Edited June 4, 2010 by gkazhus Quote Link to comment Share on other sites More sharing options...
Code Posted June 4, 2010 Report Share Posted June 4, 2010 Izmanto, lūdzu, koda tagus vai http://paste.php.lv/ Vieglāk uztvert būs un lielāks stimuls lasīt kodu. :) Quote Link to comment Share on other sites More sharing options...
gkazhus Posted June 4, 2010 Author Report Share Posted June 4, 2010 (edited) Izmanto, lūdzu, koda tagus vai http://paste.php.lv/ Vieglāk uztvert būs un lielāks stimuls lasīt kodu. :) http://paste.php.lv/8e2d42c50627de55dbffa63d7af348e0?lang=php Edited June 4, 2010 by gkazhus Quote Link to comment Share on other sites More sharing options...
codez Posted June 4, 2010 Report Share Posted June 4, 2010 (edited) 1) mjā, varbūt vēl ftp pieejas paroles publicē? 2) Tut taču saproti, kas citi nevar šo kodu tā vienkārši palaist uz sava servera, tāpēc vienmēr vajag pateikt, nevis ka kaut kas nav kārtībā, bet kas nav kārtība: kļūdu paziņojumi, kas strādā kā vajag un kas kā nevajag, utt. Edited June 4, 2010 by codez Quote Link to comment Share on other sites More sharing options...
aldis Posted June 4, 2010 Report Share Posted June 4, 2010 Kāds errors metas? Pēc pirmā acu uzmetiena viss oki-doki.. P.S. - izvāc vismaz passwordu laukā no koda! :D (Pirms rādi citiem) :D Quote Link to comment Share on other sites More sharing options...
gkazhus Posted June 4, 2010 Author Report Share Posted June 4, 2010 Kāds errors metas? Pēc pirmā acu uzmetiena viss oki-doki.. P.S. - izvāc vismaz passwordu laukā no koda! :D (Pirms rādi citiem) :D Erroru nav nekaadu! Balta lapa! Quote Link to comment Share on other sites More sharing options...
gkazhus Posted June 4, 2010 Author Report Share Posted June 4, 2010 ok ar uplaudu esmu ticis galaa, bet kaa lai pareizi nodefinee mainiigo link_URL lai ierakstiitos DB banera URL Quote Link to comment Share on other sites More sharing options...
Pentiums Posted June 4, 2010 Report Share Posted June 4, 2010 $link_url = $_POST['urla']; Quote Link to comment Share on other sites More sharing options...
Kemito Posted June 4, 2010 Report Share Posted June 4, 2010 Pentiums - Skaisti apzīmēts padotais dats :D Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.