Jump to content

cerin

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by cerin

  1. I have quite a few things to write to my mysql database through php. How can I query mysql several times without actually writing a bunch of "mysql_query();" things?
  2. [!--quoteo(post=356218:date=Mar 18 2006, 03:10 PM:name=cerin)--][div class=\'quotetop\']QUOTE(cerin @ Mar 18 2006, 03:10 PM) 356218[/snapback][/div][div class=\'quotemain\'][!--quotec--] I was browsing the forums looking for my posts and I couldn't seem to find any so I went to the search, typed in my name, and none of my posts show up! If anyone knows why this might be I would appreciate knowing. Maybe I'm just cursed my scroll wheel broke last night while I was browsing this site. I searched again a while ago, and more of them are showing up, but my two most recent posts don't.
  3. I was browsing the forums looking for my posts and I couldn't seem to find any so I went to the search, typed in my name, and none of my posts show up! If anyone knows why this might be I would appreciate knowing. Maybe I'm just cursed my scroll wheel broke last night while I was browsing this site.
  4. How do I create text input form that uses asterisks as a cover?
  5. You should use cookies to verify when the user is logged in. I don't know much about storing encryption keys.
  6. I now have a working login script, but I have encoded passwords in mysql and I need to decode them to read them. I need to know how to send the DECODE command to mysql from php without having the salt password right there in the file for anyone that can get a hold of the file to see.
  7. cerin

    Login

    This login code just returns "User not found" and I can't figure out why. It returns it before $_POST is set. [code]<?php if (isset($_POST)) {     //connect to your db     include 'config.php';     mysql_select_db($usersdb);          //get and escape your two user inputs     $username = mysql_real_escape_string($_POST['username']);     $password = mysql_real_escape_string($_POST['password']);          //rather than trying to retrieve the password, then check to see if they match in php,     //use the following query and let SQL do that work for you.     $pquery = "SELECT userid FROM userinfo WHERE userid = '$username' AND password = '$password'";     $result = mysql_query($pquery) or die("Could not query: " . mysql_error());          //if one row was returned, then the username/password combo was found     if (mysql_num_rows($result) == 1) {         echo "User Authenticated";     } else if (mysql_num_rows($result) == 0) { //if no rows are returned, then the user was not in the db         echo "User not found";     } else {  //you may have more than one entry for the same person...which is bad.         echo "Error occurred during verification";     }          //header("nextpage.php");     exit; } ?> <form method="Post" action="<?php $_SERVER['PHP_SELF']; ?>"> <p> Username: <input type='text' name='username' /> </p> <p>Password: <input type='text' name='password' /><br /> <input type='submit' name="submit" value="Submit"/> </p> </form>[/code]
  8. Your script displays "User not found" and exits before post is set.
  9. cerin

    Encode/Decode

    Can I make it so that when I select and decode, so that the column with the decoded password isn't named "DECODE(passwordcolumn,'pass')"?
  10. I'm trying to get a password from a mysql database and compare it to the user's input, but I can't figure out what to use to put the returned password in a variable or something so that it is actually comparable to the user's input. This is what I have so far: [code]<?php include 'config.php'; mysql_select_db($usersdb); $pquery="SELECT password WHERE userid={$_POST['username']} FROM userinfo"; $result=mysql_query($pquery); $pass=mysql_fetch_array($result,MYSQL_ASSOC); echo $pass['password']; ?> <form method="Post"> <p> Username: <input type='text' name='username' /> <input type='submit' /> </p> </form> <form method='Post'> <p>Password: <input type='text' name='password' /> <input type='submit' /> </p> </form>[/code] I tried a couple things, but I don't know how any of them really work. With this code I get the error: [code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\forum\login.php on line 6[/code]
  11. cerin

    Encode/Decode

    Ok, I've got that down. Thanks for the help. Can I make the password column auto encode data inserted into it?
  12. cerin

    Encode/Decode

    I have successfully encoded some text using the Encode command referred to [a href=\"http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html\" target=\"_blank\"]here[/a]. Now, I am trying to decode the string I just encoded. I don't see what exactly I have to pass as the arguement "crypt_str" or at least how to identify it without typing the encoded text. I have tried stuff like [code]WHERE userid='username' SET password=DECODE(tons of tried things here,'password');[/code] I seems to me that MySQL has syntax with zero flexibility.
  13. I would like to know what you put into mysql to increment numbers, BUT only the ones that have a certain value like every entry with the value "2023" will have a number in seperate column that increments only for entries with this value. On another note, can mysql do the primary sorting and a secondary sort? For example: Sorting by values assigned to rows, and then sorting every row that has the same value by a seperate value. If you don't understand what I'm asking I'd be glad to explain more thoroughly.
  14. While doing a tutorial I ran into a mistake where you make one of the column names the same as the table name. Even though it tells the reader to do it that way in the latter parts of the tutorial they have it set as something different. So, I was wondering how to change a column heading in a table, because it confuses me a little havin them both with the same name.
  15. cerin

    Access denied

    With files still around from past installations this is pretty confusing, but I managed to figure it out. Everything seems to be working. Thanks for the help. Until my next problem, cerin
  16. cerin

    Access denied

    When I try to connect to mysql using the php command mysql_connect(); I get this error: [code]Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\AppServ\www\mysql.php on line 8 Error connecting to mysql[/code] I don't know what I need to do to gain access so I would appreciate any help.
×
×
  • 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.