Jump to content

chris.smith

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by chris.smith

  1. ^^^ The first die() statement actually means that the field(s) were left blank and the code should display that message and then redisplay the form. The message should be corrected. Also, by using die() for the above and using die() when the query does find a matching row, you are preventing the form from being redisplayed so that the user could enter the correct information. Those are true and I guess these are the consequences of writing a script in 20 seconds Cheers
  2. I'm assuming that the script exists on your website or uses the mail server on your website. In the first case yes your website needs to be live so that you can access the script. In the second case your website can be down but your mail server needs to be live. Cheers.
  3. Sorry didn't get a chance to debug the code. I'm guessing that this should solve the problem. Use this code: <?php session_start(); require_once('dbConfig.php'); if($_GET['op'] == 'login') { if (empty($_POST["username"]) || empty($_POST["password"])) { die("Incorrect Username or Password, please check your credentials!"); } else { if(get_magic_quotes_gpc()) { $_POST['username'] = stripslashes($_POST['username']); $_POST['password'] = stripslashes($_POST['password']); } $q = "SELECT * FROM `access` WHERE `username`='" . mysql_real_escape_string($_POST["username"]) . "' AND `password`=PASSWORD('" . $_POST["password"] . "') LIMIT 1;"; $r = mysql_query($q); $num = mysql_num_rows($r); if($num == 0) { die("Incorrect Username or Password, please check your credentials!"); } else { $row = mysql_fetch_row($r); $_SESSION["valid_id"] = $row[0]; $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time(); Header("Location: main_interface.php"); } } } else { echo "<form action=\"?op=login\" method=\"POST\">"; echo "Username: <input name=\"username\" size=\"15\"><br />"; echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />"; echo "<input type=\"submit\" value=\"Login\">"; echo "</form>"; } ?> Cheers
  4. It would be much easier to integrate the form into pageone.php and if needed use require or require_once to include script.php. You could identify an input by a $_GET key, as in: http://local/pageone.php?form=submit Cheers.
  5. My fault sorry. Change: !empty($_POST["username"]) || !empty($_POST["password"]) To: empty($_POST["username"]) || empty($_POST["password"]) Cheers
  6. If your application needs to communicate with the web then yes, php can be adjusted to just about every web situation. Moreover Facebook recently released a tool called HipHop that can convert your php scripts into high-speed c++ binaries.
  7. What datatype do you use in your database? Cheers.
  8. Make a menu2.html file that adds "..\" in front of the image paths and include that one in index.php.
  9. Well for a start you could use a PHP Beautifier Check this out. Cheers.
  10. Try this code: <?php session_start(); require_once('dbConfig.php'); if($_GET['op'] == 'login') { if (!empty($_POST["username"]) || !empty($_POST["password"])) { die("Incorrect Username or Password, please check your credentials!"); } else { if(get_magic_quotes_gpc()) { $_POST['username'] = stripslashes($_POST['username']); $_POST['password'] = stripslashes($_POST['password']); } $q = "SELECT * FROM `access` WHERE `username`='" . mysql_real_escape_string($_POST["username"]) . "' AND `password`=PASSWORD('" . mysql_real_escape_string($_POST["password"]) . "') LIMIT 1;"; $r = mysql_query($q); $num = mysql_num_rows($r); if($num == 0) { die("Incorrect Username or Password, please check your credentials!"); } else { $row = mysql_fetch_row($r); $_SESSION["valid_id"] = $row[0]; $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time(); Header("Location: main_interface.php"); } } } else { echo "<form action=\"?op=login\" method=\"POST\">"; echo "Username: <input name=\"username\" size=\"15\"><br />"; echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />"; echo "<input type=\"submit\" value=\"Login\">"; echo "</form>"; } ?> Cheers!
  11. I'm gonna have to add my favorite Aptana Studio 3 Beta.
  12. Perhaps I made a mistake when I tried to distinguish between files and messages. The truth is that files and messages are combined with some other strings and then encrypted using AES-256. Cheers.
  13. Indeed I am aware of that, the problem is that the amount of data transferred is rather variable. Due to the nature of the entry script, the data can be a few bytes big for a message or a few megabytes big for an attachment. For the later case, it is much easier to transfer a 100mb file rather than a 133mb one. And these all exclude the time needed to encode the files and strings Thanks for the reply anyway
  14. In addition to what sunfighter said, the nested loop still acts even though it doesn't have the curly brackets ({ and }) after it.
  15. Hey guys. Sorry to start asking questions being such a new member but this just suddenly came up. I have a php script that needs to send binary data to another php script via HTTP. The data can be transferred through the methods GET and POST, preferably POST and preferably not as a file. The problem is that I have tried a number of ways to do this but every time the data seems to be corrupted. Some bytes stay the same but others disappear or change. I guess that they transfer through ASCII mode instead of BINARY but couldn't find any way to fix this. Any help would be deeply appreciated. Cheers.
  16. Hey guys, My name is Chris Smith. 23 Years old and a PHP programmer. Happy to join you guys. Cheers
×
×
  • 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.