MatrX Posted March 2, 2009 Report Share Posted March 2, 2009 Tātad ievadu kodu, kodu pārbauda, ja ir pareizs, tad izvada failu uz servera, attiecīgajam id, bet uzmet baltu lapu? DB Struktūra id|nosaukums|apraksts|koda_id|fails_uz_servera|cat <?php $kodinsh = $_POST['code']; $ip = $_SERVER['REMOTE_ADDR']; mysql_connect("localhost","asdasdasd","asdadsasdasdas"); mysql_select_db("other"); $result = mysql_fetch_assoc(mysql_query("SELECT code FROM codes WHERE code = '$kodinsh'")); $result2 = mysql_fetch_assoc(mysql_query("SELECT id,fails_uz_servera FROM sms_shop_faili WHERE id={$_GET['id']}")); $kodinsh2 = $result['code']; function createRandomPassword() { $chars = "abcdefghijkmnopqrstuvwxyz023456789"; srand((double)microtime()*1000000); $i = 0; $pass = ''; while ($i <= 7) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $password = createRandomPassword(); $q2 = "UPDATE codes SET code = '3$password' WHERE code = '$kodinsh2'"; if ($_POST['submit1'] and $kodinsh2 > 0) { mysql_query($q2,$result2) or die(mysql_error()); echo $row['fails_uz_servera']; } else if ($_POST['submit1']) { echo "<font color='white'>Wrong Code!</font>"; mysql_close(); } ?> Quote Link to comment Share on other sites More sharing options...
anonīms Posted March 2, 2009 Report Share Posted March 2, 2009 pieliec aiz kverija or die(mysql_error(); Quote Link to comment Share on other sites More sharing options...
MatrX Posted March 2, 2009 Author Report Share Posted March 2, 2009 tas pats. Quote Link to comment Share on other sites More sharing options...
cucumber Posted March 3, 2009 Report Share Posted March 3, 2009 sakuma iesliedz error_reporting'us kada jega no 3 sheit // SET code = '3$password' pie ifa and nomainitu uz && get parametrus, pa taisno nepadotu vaicajumam Quote Link to comment Share on other sites More sharing options...
bubu Posted March 3, 2009 Report Share Posted March 3, 2009 Lietas, kas jādara, ja nezini vai strādā vai nestrādā kverijs:0) Pārbaudi vai koda vadība vispār tiek līdz kverijam. Kautvai ar vistriviālāko echo. 1) Vajag uzlikt sekojošas php opcijas: error_reporting=E_ALL, display_errors=1 2) Pārbaudi mysql_query funkcijas atgriezto vērtību. Ja tā ir false, tad kverijā ir vai nu sintaktiska kļūda vai arī DB serveris nepieņēma kveriju. Šajā gadījumā izvadi mysql_error() funkcijas rezultātu uz ekrāna. 3) Ja iepriekšējais nelīdz, tad izvadi kveriju uz ekrāna vai arī ieraksti failā. Nokopē to un pamēģini izpildīt jebkādā SQL tūlī uz savas datubāzes. Kautvai visparastākā no konsoles mysql.exe klienta. Tev svarīgāk sākt būtu ar 1. punktu. Quote Link to comment Share on other sites More sharing options...
MatrX Posted March 3, 2009 Author Report Share Posted March 3, 2009 Kā? Quote Link to comment Share on other sites More sharing options...
cucumber Posted March 3, 2009 Report Share Posted March 3, 2009 ieksh php.ini faila jaieslidz kludu zinojumi Quote Link to comment Share on other sites More sharing options...
bubu Posted March 3, 2009 Report Share Posted March 3, 2009 Var iztikt bez php.ini faila atztikšanas. Skripta sākumā ieliec: error_reporting(E_ALL); ini_set("display_errors", 1); 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.