Jump to content

ram4nd

Members
  • Posts

    461
  • Joined

  • Last visited

Everything posted by ram4nd

  1. I want to build secure login with cookies. I just want your ideas about this, your suggestions. What fields should go to sql table, after username and password? How to keep data in cookies safely? And so on...
  2. sorry, not code problem; this problem comes with my data in table.
  3. I have to get 0 for answer when there are 0 rows. Right now it returns 1 even when there aren't suppose to be any rows. $count = mysql_num_rows(mysql_query('SELECT id FROM members WHERE ref_id='.(int)$ref));
  4. thank you very much, is pattern much longer if only the first letter of sentence can be big. No the first char, but first letters of sentences. If it will be longer like double or so then you don't have to waste your time.
  5. how can you make it at least 2 characters long, would be awesome if you could explain the pattern, but not necessary
  6. actually i want to control the name field from form
  7. How can I do a pattern that matches if there is A-Z, a-z, -, space
  8. I had mysql_fetch_array in mysql_num_rows.
  9. Warning: mysql_num_rows() expects parameter 1 to be resource, array given in /opt/lampp/htdocs/PTC/login.php on line 10 $a = 'SELECT id FROM members WHERE user=\''.clean($_POST['user']).'\' AND pass=md5('.$_POST['pass'].')';
  10. Query: SELECT id FROM members WHERE user=ram4nd AND pass=2f951cd95999b19a22fbc1037e552336 Unknown column 'ram4nd' in 'where clause'
  11. Can anybody tel me that why am i getting these errors: Errors: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/PTC/login.php on line 9 Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /opt/lampp/htdocs/PTC/login.php on line 10 Code: mysql_connect('localhost','something','else'); mysql_select_db('PTC'); $a = 'SELECT id FROM members WHERE user = '.clean($_POST['user']).' AND pass = '.md5($_POST['pass']); $b = mysql_query($a); $query = mysql_fetch_array($b); if(mysql_num_rows($query) == 1) { $_SESSION['user'] = $query['id']; setcookie('user', $query['id'], (60 * 60 * 24 * 30 + $_SERVER['REQUEST_TIME'])); header('Location: members.php'); } else $x = 'Incorrect username or password.';
  12. It told me to define the variables so i made them static instead of global.
  13. Why am I not seeing javascript made fields? <?php static $body; if(isset($_POST['saada'])) if(isset($_POST['text1_0'])) echo $_POST['text1_0']; if(isset($_POST['text1_1'])) echo $_POST['text1_1']; if(isset($_POST['text1_2'])) echo $_POST['text1_2']; if(!isset($_POST['saada'])) $body = '<script type="text/javascript"> <!-- function lisa_rida() { var tabel = document.getElementById(\'tabel\'); var last_row = tabel.rows.length; var iteration = last_row; var row = tabel.insertRow(last_row); form_1.rows.value = 1 + iteration; //Cell 1 var text_box_1 = document.createElement(\'input\'); text_box_1.type = \'text\'; var cell_1 = row.insertCell(0); text_box_1.name = \'text1_\' + iteration; cell_1.appendChild(text_box_1); //Cell 2 var text_box_2 = document.createElement(\'input\'); text_box_2.type = \'text\'; var cell_2 = row.insertCell(1); text_box_2.name = \'text2_\' + iteration; cell_2.appendChild(text_box_2); //Cell 3 var text_box_3 = document.createElement(\'input\'); text_box_3.type = \'text\'; var cell_3 = row.insertCell(2); text_box_3.name = \'text3_\' + iteration; cell_3.appendChild(text_box_3); //Cell 4 var text_box_4 = document.createElement(\'input\'); text_box_4.type = \'text\'; var cell_4 = row.insertCell(3); text_box_4.name = \'text4_\' + iteration; cell_4.appendChild(text_box_4); } //--> </script> <table border="0" id="tabel"><form action="'.$_SERVER['PHP_SELF'].'" method="post" id="form_1"> <tr> <td><input type="text" name="text1_0" /></td> <td><input type="text" name="text2_0" /></td> <td><input type="text" name="text3_0" /></td> <td><input type="text" name="text4_0" /></td> </tr> </table> <input type="hidden" id="rows" name="rows" value="1" /> <input type="button" value="Lisa rida" onclick="lisa_rida();" /> <input type="submit" value="Saada" name="saada" /> </form>'; echo $body; ?>
  14. Why am I not seeing javascript made fields? <?php static $body; if(isset($_POST['saada'])) if(isset($_POST['text1_0'])) echo $_POST['text1_0']; if(isset($_POST['text1_1'])) echo $_POST['text1_1']; if(isset($_POST['text1_2'])) echo $_POST['text1_2']; if(!isset($_POST['saada'])) $body = '<script type="text/javascript"> <!-- function lisa_rida() { var tabel = document.getElementById(\'tabel\'); var last_row = tabel.rows.length; var iteration = last_row; var row = tabel.insertRow(last_row); form_1.rows.value = 1 + iteration; //Cell 1 var text_box_1 = document.createElement(\'input\'); text_box_1.type = \'text\'; var cell_1 = row.insertCell(0); text_box_1.name = \'text1_\' + iteration; cell_1.appendChild(text_box_1); //Cell 2 var text_box_2 = document.createElement(\'input\'); text_box_2.type = \'text\'; var cell_2 = row.insertCell(1); text_box_2.name = \'text2_\' + iteration; cell_2.appendChild(text_box_2); //Cell 3 var text_box_3 = document.createElement(\'input\'); text_box_3.type = \'text\'; var cell_3 = row.insertCell(2); text_box_3.name = \'text3_\' + iteration; cell_3.appendChild(text_box_3); //Cell 4 var text_box_4 = document.createElement(\'input\'); text_box_4.type = \'text\'; var cell_4 = row.insertCell(3); text_box_4.name = \'text4_\' + iteration; cell_4.appendChild(text_box_4); } //--> </script> <table border="0" id="tabel"><form action="'.$_SERVER['PHP_SELF'].'" method="post" id="form_1"> <tr> <td><input type="text" name="text1_0" /></td> <td><input type="text" name="text2_0" /></td> <td><input type="text" name="text3_0" /></td> <td><input type="text" name="text4_0" /></td> </tr> </table> <input type="hidden" id="rows" name="rows" value="1" /> <input type="button" value="Lisa rida" onclick="lisa_rida();" /> <input type="submit" value="Saada" name="saada" /> </form>'; echo $body; ?>
  15. I have a form in table and i need to add rows with javascript. <script type="text/javascript"> Function addRowToTable() { } </script> <form action="something.php" method="post"><table border="0"> <tr> <td><input type="text" name="text1_1" /></td> <td><input type="text" name="text2_1" /></td> <td><input type="text" name="text3_1" /></td> <td><input type="text" name="text4_1" /></td> </tr> </table> <input type="button" value="Add" onclick="addRowToTable();" /> <input type="hidden" name="rows" value="1" /> <input type="submit" name="saada" /> </form>
  16. It was about globals, i still don't get the hang of those.
  17. My code doubles function partially. Are there any common mistakes what lead to this?
  18. This is wrong formating for html: echo "<img src='images/sml_".$imagepath." width="100%" '>"; Right formating is like this: echo '<img src="images/sml_'.$imagepath.'" width="100%" />';
  19. Well you asked if it's possible. I say yes.
  20. well thats right then.
  21. This is triggered by flash so, I think you ask from the wrong forum. You have to specify, what does the script have to do.
  22. Have a look at using session_destroy, session_unset, unset('$_SESSION['$varname']), or session_write_close.
  23. put your text in array and pull the lines up randomly.
  24. you want to use some kind of a cms or start from scratch
  25. you don't need 2 sessions.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.