WeeD* Posted January 17, 2009 Author Report Share Posted January 17, 2009 atkal errors :( INSERT INTO lietotaaji (vaards,uzvaards,epasts,parole) VALUES ('Viktors','Ganago',''vknok@inbox.lv'',''97611ed40e4b628c98f39fdb39f9643d'') Link to comment Share on other sites More sharing options...
Val Posted January 17, 2009 Report Share Posted January 17, 2009 paskaties kodā, kāpēc tev mainīgajiem $epasts un $parole uzrodas vēl pa ' katrā galā. Link to comment Share on other sites More sharing options...
WeeD* Posted January 18, 2009 Author Report Share Posted January 18, 2009 nesapratu! Link to comment Share on other sites More sharing options...
bubu Posted January 18, 2009 Report Share Posted January 18, 2009 Tev to mainīgo $epasts un $parole vērtības satur apstrofus abos galos. Bet nevajag manuāli kautkādas pēdiņas tur kabināt klāt. Link to comment Share on other sites More sharing options...
WeeD* Posted January 18, 2009 Author Report Share Posted January 18, 2009 vari uzralstīt no šī kā ir pareizi : mysql_query("INSERT INTO lietotaaji (vaards,uzvaards,epasts,parole,bilde) VALUES ($vards,$uzvards,$epasts,$parole,'$bilde')"); Link to comment Share on other sites More sharing options...
anonīms Posted January 18, 2009 Report Share Posted January 18, 2009 mysql_query("INSERT INTO lietotaaji (vaards,uzvaards,epasts,parole,bilde) VALUES ('$vards','$uzvards','$epasts','$parole','$bilde')") or die(mysql_error()); ja met erroru, tad izlasi, ko bubu rakstija. Link to comment Share on other sites More sharing options...
WeeD* Posted January 19, 2009 Author Report Share Posted January 19, 2009 es nesaprotu kads nevar palidzet pateikt prieksha pa solim kas man jadara !!!!~ erors atkal :::: 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 'vknok@inbox.lv'',''97611ed40e4b628c98f39fdb39f9643d'')' at line 1 Link to comment Share on other sites More sharing options...
Grey_Wolf Posted January 19, 2009 Report Share Posted January 19, 2009 es nesaprotu kads nevar palidzet pateikt prieksha pa solim kas man jadara !!!!~ 1. iemaaacies Lasiit !!! 2. Izlasii kaads ir kljuudas pazinjojums !!! 3. ja ar to nepietiek tad izlasi ko tev citi rakstija 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 'vknok@inbox.lv' ',' '97611ed40e4b628c98f39fdb39f9643d' ')' at line 1 CIK APOSTROFIEM JAABUUT ???? Link to comment Share on other sites More sharing options...
bubu Posted January 19, 2009 Report Share Posted January 19, 2009 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 'vknok@inbox.lv'',''97611ed40e4b628c98f39fdb39f9643d'')' at line 1 Es tak jau tev teicu: Tev to mainīgo $epasts un $parole vērtības satur apstrofus abos galos. Bet nevajag manuāli kautkādas pēdiņas tur kabināt klāt. Tev mainīgais $epasts satur vērtību vknok@inbox.lv' un mainīgais $password satur vērtību '97611ed40e4b628c98f39fdb39f9643d' Vai tiešām tev tur tie apostrofi vajadzīgi? Ja jā, tad tu neesi eskeipojis stringu vērtības, un tas ir slikti: $vards = mysql_real_escape_string($vards); $uzvards = mysql_real_escape_string($uzvards); $epasts = mysql_real_escape_string($epasts); $parole = mysql_real_escape_string($parole); $bilde = mysql_real_escape_string($bilde); mysql_query("INSERT INTO lietotaaji (vaards,uzvaards,epasts,parole,bilde) VALUES ('$vards','$uzvards','$epasts','$parole','$bilde')") or die(mysql_error()); Link to comment Share on other sites More sharing options...
WeeD* Posted January 19, 2009 Author Report Share Posted January 19, 2009 (edited) paldies tgd viss aizgaja datubaze rakstas viss okey bet kad rakstu epastu paroli lai iejietu mani nelaiz iekšā! šis atbild pa ielogošanos, bet tur ir jaizmet ka prole vai epasts nav pareizs bet man neko neizmet vnk nelaiž iekšā ! // Ja saņem pieprasījumu IELOGOTIESif(isset($_GET['darbiiba']) and $_GET['darbiiba'] == "login") { $epasts = quote_smart($_POST['epasts']); $parole = quote_smart(md5($_POST['parole'])); $result = mysql_query("SELECT COUNT(*) FROM lietotaaji WHERE epasts=$epasts and parole=$parole"); // Izvelkam lietotāja ID $get_id = mysql_query("SELECT * FROM lietotaaji WHERE epasts=$epasts and parole=$parole"); $row = mysql_fetch_row($get_id); $id = $row[0]; // Ja šāds lietotājs pastāv if(mysql_num_rows($result) == 1) { mysql_query("UPDATE lietotaaji SET online='Y' WHERE id=$id"); $_SESSION['id'] = $id; } else { $nav = "Nepareizs epasts un/vai parole!"; } } Edited January 19, 2009 by WeeD* Link to comment Share on other sites More sharing options...
Val Posted January 19, 2009 Report Share Posted January 19, 2009 Tomēr pa pēdiņām ne sū.. neesi sapratis. Lasi vēlreiz topiku! No kurienes kopē to kreiso kodu? Link to comment Share on other sites More sharing options...
mounkuls Posted January 19, 2009 Report Share Posted January 19, 2009 Izdrukā tos kverijus pirms izpildi, cerams, ka aizies. Link to comment Share on other sites More sharing options...
WeeD* Posted January 20, 2009 Author Report Share Posted January 20, 2009 saprotat es neesmu pro php es nesaprotu jusu gudros vardus, man tikai 12 gadi. es gribu pabeigt savu reg scriptu un viss ! :( Link to comment Share on other sites More sharing options...
Grey_Wolf Posted January 20, 2009 Report Share Posted January 20, 2009 WeeD* --> nu tev tachu saka ko dariit ... 1. izdrukaa to $epasts un $parole , tad redzeesi kas PAtiesiibaa tek prasiits DB 2. adali DB pieprasijumu atseviskjaa mainiigaa , arii izvadi uz ekrana --> redzeesi kaads visns patiesiibaa izskataas (kas iisti tiek prasiits DB --> attieciigi no taa vari izdariit secinajumus , kas kur ir nepareizi (truukst, vai ir par daudz ) $epasts= quote_smart($_POST['epasts']); $parole = quote_smart(md5($_POST['parole'])); echo '<br> Shaadu epastu gribu atrast = '.$epasts; echo '<br>'; // rindinja starpaa echo 'Gribu atrast peec saadas paroles ='.$parole; $sql="SELECT * FROM lietotaaji WHERE epasts=$epasts and parole=$parole"; echo '<br> Sho Es jautaju DB: '. $sql; $get_id = mysql_query($sql); // nav nepieciesams otreiz vadiit SQL pieprasijumu --> izmanto jau gatavo mainiigo Nu un tas ir tik nezeeliigi sarezgjiiti ??? klaat naak paris rindinjas kas atvieglo kljuudas meklesanu ... -- P.S. Nezkapeec cilveki dazreiz uzskata ka pielikt echo un apskatiities kas iisti daraas ir zem vinju Goda --> vieglaak paprasiit forumos ... Link to comment Share on other sites More sharing options...
WeeD* Posted January 20, 2009 Author Report Share Posted January 20, 2009 (edited) es nesaprotu bāāc nu lūdzu uzraksti man jau gatavu un viss un es sapratishu citadāk tā te nedēļu čakarēšos! lūdzu !!!! mans index.php <?php $row = mysql_fetch_assoc($result); echo "Sveiks, {$row['vaards']} {$row['uzvaards']}!<br />"; //Profila bilde $result = mysql_query("SELECT * FROM lietotaaji WHERE id=$id"); $row = mysql_fetch_assoc($result); $img = getimagesize($row['bilde']); if($img[0] > 150) { echo "<a href='{$row['bilde']}' target='_blank'><img src='{$row['bilde']}' alt='Profila bilde' width='150' /></a>"; } else { echo "<img src='{$row['bilde']}' alt='Profila bilde' />"; } ?> </div> <div id="logo"> <a href="index.php"><img src="bildes/sisteema.gif" alt="Sistēma logo" /></a><br /> </div> <div id="saturs"> <?php if(isset($_GET['darbiiba'])) { switch($_GET['darbiiba']) { case 'profils': include("switch/profils.php"); break; case 'online': include("switch/online.php"); break; case 'veestules': include("switch/veestules_inbox.php"); break; } } else { echo 'Čau !'; } ?> </div> <div id="apaksha"> <div style="padding-top: 12px">© 2009 Viktors Ganago (vknok) </div> </div> </div> <?php } ?> </body> </html><?php error_reporting(E_ALL); include("include/config.php"); include("include/functions.php"); // Vajadzīgais kvērijs if(isset($_SESSION['id'])) { $id = $_SESSION['id']; $result = mysql_query("SELECT * FROM lietotaaji WHERE id=$id"); } // Ja saņem pieprasījumu IELOGOTIES if(isset($_GET['darbiiba']) and $_GET['darbiiba'] == "login") { $epasts= quote_smart($_POST['epasts']); $parole = quote_smart(md5($_POST['parole'])); echo '<br> Shaadu epastu gribu atrast = '.$epasts; echo '<br>'; // rindinja starpaa echo 'Gribu atrast peec saadas paroles ='.$parole; $sql="SELECT * FROM lietotaaji WHERE epasts=$epasts and parole=$parole"; echo '<br> Sho Es jautaju DB: '. $sql; $get_id = mysql_query($sql); // nav nepieciesams otreiz vadiit SQL pieprasijumu --> izmanto jau gatavo mainiigo // Izvelkam lietotāja ID $get_id = mysql_query("SELECT * FROM lietotaaji WHERE epasts=$epasts and parole=$parole"); $row = mysql_fetch_row($get_id); $id = $row[0]; // Ja šāds lietotājs pastāv if(mysql_num_rows($result) == 1) { mysql_query("UPDATE lietotaaji SET online='Y' WHERE id=$id"); $_SESSION['id'] = $id; } else { $nav = "Nepareizs epasts un/vai parole!"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>TorrentFile draugi!</title> <link href="stils.css" rel="stylesheet" type="text/css" /> </head> <body> <?php // Rādam ja nav ielogoies if(!isset($_SESSION['id'])) { ?> <div align="center" style="margin-top: 150px;"> <form method="post" action="index.php?darbiiba=login"> <?php if(isset($nav)) { echo $nav; } ?> <a href="index.php"><img src="bildes/sisteema.gif" alt="Sistēma logo" /></a> <table> <tr><td>E-pasts:</td><td><input type="text" name="epasts" /></td></tr> <tr><td>Parole:</td><td><input type="password" name="parole" /></td></tr> <tr><td></td><td><input type="submit" value="Ielogogties" /></td></tr> <tr><td></td><td align="right"><a href="register.php">Reģistrēties</a></td></tr> </table> </form> </div> <?php } // Rādam ja ir ielogojies if(isset($_SESSION['id'])) { ?> <div id="savelk"> <div id="izveelne"> <ul> <li><a href="index.php">Sākums</a></li> <li><a href="index.php?darbiiba=online">Onlainā [<?php echo mysql_result(mysql_query("SELECT COUNT(*) FROM lietotaaji WHERE online='Y' AND id!=$id"),0,'COUNT(*)'); ?>]</a></li> <li><a href="index.php?darbiiba=profils">Profils</a></li> <li><a href="index.php?darbiiba=veestules">Vēsutles</a></li> <li class="iziet"><a href="index.php?darbiiba=logout">Iziet</a></li> </ul> </div> <div id="profila_lauks"> <?php $row = mysql_fetch_assoc($result); echo "Sveiks, {$row['vaards']} {$row['uzvaards']}!<br />"; //Profila bilde $result = mysql_query("SELECT * FROM lietotaaji WHERE id=$id"); $row = mysql_fetch_assoc($result); $img = getimagesize($row['bilde']); if($img[0] > 150) { echo "<a href='{$row['bilde']}' target='_blank'><img src='{$row['bilde']}' alt='Profila bilde' width='150' /></a>"; } else { echo "<img src='{$row['bilde']}' alt='Profila bilde' />"; } ?> </div> <div id="logo"> <a href="index.php"><img src="bildes/sisteema.gif" alt="Sistēma logo" /></a><br /> </div> <div id="saturs"> <?php if(isset($_GET['darbiiba'])) { switch($_GET['darbiiba']) { case 'profils': include("switch/profils.php"); break; case 'online': include("switch/online.php"); break; case 'veestules': include("switch/veestules_inbox.php"); break; } } else { echo 'Čau !'; } ?> </div> <div id="apaksha"> <div style="padding-top: 12px">© 2009 Viktors Ganago (vknok) </div> </div> </div> <?php } ?> </body> </html> Edited January 20, 2009 by WeeD* Link to comment Share on other sites More sharing options...
Recommended Posts