Jump to content

BrianM

Members
  • Posts

    217
  • Joined

  • Last visited

    Never

Everything posted by BrianM

  1. How do I tell what verify the table I created is using the engine type I assigned it.
  2. Yeah, I used echo previously, and just the other day I switched to using print, because I also heard it was a tad bit faster.
  3. Does it come down to a matter of personal preference when selecting one or the other, because I've heard they both get the same job done.
  4. I've never seen that method of encryption used before, is that a PHP function?
  5. Thank you for everyones opinions and help with my problem. What I did was change the type in the username/password fields from 'varchar()' to 'tinytext', so really I used xtopolis' statement as a solution, but before you posted. And yes, I would rather stick with password encryption, heh.
  6. Data too long for column 'password' at row 1 .. that is the error I got. What changes should I make to my table, or code? Just a thought, I may be wrong, does the md5 hash make the password string to long for the field? Another update, I just looked up on Wiki about md5 hashing, and it says it turns it into a 32 character string, which would be 2 characters to long for my field. So I suppose a fix to my issue would be to enlarge my password field, and hope all goes well.
  7. Alright, I'll try that and see what it spits out. Also, here is the database structure for the table: CREATE TABLE mps_login ( id int(11) auto_increment, username varchar(30), password varchar(30), PRIMARY KEY (id) );
  8. The values from the input fields wont insert into the database when submitted. The only part of the script that does seem to run is line 29 - header('Location: login.php'); - it just seems to skip everything else when Register is clicked. Here is my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>MPS - Register</title> </head> <?php mysql_connect('localhost', 'brian', '') or die(mysql_error()); mysql_select_db('mps') or die(mysql_error()); if (isset($_POST['register'])) { if (!$_POST['username'] | !$_POST['password']) { print('You must complete all input fields.'); } $valid_username = $_POST['username']; $check_one = mysql_query("SELECT username FROM mps_login WHERE username = '$valid_username'") or die(mysql_error()); $check_two = mysql_num_rows($check_one); if ($check_two != 0) { print('The username "'.$_POST['username'].'" is not available.'); } $_POST['password'] = md5($_POST['password']); $values = "INSERT INTO mps_login (username, password) VALUES ('".$_POST['username']."', '".$_POST['password']."')"; $register = mysql_query($values); header('Location: login.php'); } ?> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr> <td>Register</td> </tr> <tr> <td>Username:</td> <td><input type="text" name="username" /></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" /></td> </tr> <tr> <td><input type="submit" name="register" value="Register" /></td> </tr> </table> </form> </body> </html> Does anyone see why it may not be inserting the values into the database? If anyone would like me to provide the database structure, I'll be more than happy to put it up here.
  9. You still are not being specific upon what your wanting to achieve. What is the program not doing that you would like it to do? You have yet to specify, no one can help without you answering that question, aerouk.
  10. Well I did a format on my HD earlier this morning and decided to use the latest stable version of Apache, MySQL and PHP. Well, I uncommented the line 'extension=php_mysql.dll' in php.ini so what else is needed to make it work?
  11. Awesome! Well thanks a lot for the quick reply.
  12. I should install Apache, MySQL and PHP? <--- Is that correct right here?
  13. Your words towards xtopolis seem sort of... hostile, in a way, seeing as how he was only trying to help you.
  14. I do believe it's some sort of Javascript, but how do people get text in an input field and when somebody clicks the field, the text goes away and if they click outside of the input field, the default text returns if the field contains no content from the user.
  15. My database was updating just fine when I was using '<input type='text' />' but I noticed after changing it to a <textarea> instead, It wont insert my report. ??? Here is the code: <?php function report_create() { echo("<form action=\"".$_SERVER['PHP_SELF']."?table=".$_GET['table']."&project_name=".$_GET['project_name']."&report=create\" method=\"post\">"); echo("<b><font size=\"2px\" face=\"Verdana\">Create report:<br /></font></b><textarea cols=\"40\" rows=\"7\" name=\"report_\"></textarea><br /><input type=\"submit\" name=\"report_create\" value=\"Create\" />"); echo("</form>"); } if (isset($_POST['report_create'])) { mysql_connect('localhost', 'brian', '') or die(mysql_error()); mysql_select_db('reports') or die(mysql_error()); mysql_query("INSERT INTO `$table` (date, report) VALUES ('".date("m-d-y")."', '".$_POST['report_']."')"); echo "<script> window.location.href = ''; </script>"; exit; } ?> I kept all field names the same, as you can see. So I'm not sure why it wont work and I'm hoping somebody can point me in the right direction.
  16. Well I'm looking for an alternate because my script is telling me I've already sent header information so I can't use the header() function there. Will what you provided work as an alternative?
  17. Could you please specify and be a little more informative as to what your looking for? Perhaps give an example of what you want done.
  18. <?php function report_create() { echo("<form action=\"".$_SERVER['PHP_SELF']."?table=".$_GET['table']."&project_name=".$_GET['project_name']."&report=create\" method=\"post\">"); echo("<b><font size=\"2px\" face=\"Verdana\">Create report: </font></b><input type=\"text\" name=\"report_\" /> <input type=\"submit\" name=\"report_create\" value=\"Create\" />"); echo("</form>"); } if (isset($_POST['report_create'])) { mysql_connect('localhost', 'brian', '') or die(mysql_error()); mysql_select_db('reports') or die(mysql_error()); mysql_query("INSERT INTO `$table` (date, report) VALUES ('".date("m-d-y")."', '".$_POST['report_']."')"); } ?> I want to be able to redirect to another page after that insert query is executed, but I can't use header() .. so is there any other way I can redirect after mysql_query is executed?
  19. I get an error on line 84 - Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Program Files\Apache Group\Apache2\htdocs\mps\view\index.php on line 84 What does this mean, I'm pretty sure it's got something to do with echo $_SERVER['PHP_SELF']; <?php function report_create() { echo("<form action=\"echo $_SERVER['PHP_SELF'];\" method=\"post\">"); // line 84 echo("<b><font size=\"2px\" face=\"Verdana\">Create report: </font></b><input type=\"text\" /> <input type=\"submit\" value=\"Create\" /><br /><br />"); echo("</form>"); } ?>
  20. <?php if ($_GET['report'] == 'create') { report_create(); } // line 85 if ($_GET['report'] == 'view') { report_view(); } ?> Perhaps something along those lines?
  21. I get this error Parse error: parse error, expecting `'{'' in C:\Program Files\Apache Group\Apache2\htdocs\mps\view\index.php on line 85 with this code <?php if ($_GET['report'] == 'create') { function report_create() } // line 85 if ($_GET['report'] == 'view') { function report_view() } ?> What did I do wrong? :\
  22. And while I'm looking this over, you said the problem is that it wont update the database with new values posted?
  23. Ah, well thank you for the information.
  24. Would you mind posting the entire page, with any includes if you have them? And a database structure to where this is being sent.
×
×
  • 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.