Jump to content

sardonicgem

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    shirlucygoosie

Profile Information

  • Gender
    Not Telling

sardonicgem's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Awesome thanx. For some reason I thought it would override the initial SESSION if I called it on board.php
  2. Hey guys, I have a login page that stores the username in the SESSION array. My problem is that after I direct the user to another page (board.php), my SESSION array loses all it's values. I start the session in the beginning of login.php <?php session_start(); . . . //validate session $_SESSION['logged'] = true; $_SESSION['username'] = $in_name; . . ?> After the user logs in, he is directed to board.php <?php require_once("messageboard_functions.php"); echo "<html>"; do_html_header("Message Board"); echo "<body>"; do_html_heading("Message Board"); echo $_SESSION['username']; echo "</body></html>"; ?> Any ideas why my $_SESSION['username'] comes out empty??
  3. Thank you for your recommendations It's now functional.
  4. Hello folks, I am a complete newbie and I have created a simple login page that correlates to the following DB table named users Column | Type | Modifiers ----------+------+----------- username | text | password | text | which contains the following: username | password ----------+-------------- testname | testpassword (1 row) This is my script logic: $sql = "SELECT username, password FROM users WHERE username = $usr AND password = $pass"; $result = pg_exec($handle, $sql); if ($result) { $data = pg_fetch_row($result); echo "data: $data[0], $data[1]<br>\n"; dbdiscon($handle); return true; } else { dbdiscon($handle); echo "not found"; return false; } The variables get set to $usr = "testname" and $pass = "testpassword" when entered into the login form. This is the error I get: connection to database established ... Warning: pg_exec() [function.pg-exec]: Query failed: ERROR: column "testname" does not exist LINE 1: ...CT username, password FROM users WHERE username = testname A... ^ in
  5. Thank you all for your help. thebadbad, that function is exactly what I was looking for.
  6. Hello folks, I'm trying to check a form field to make sure the user inputs an alphanumeric entry only. The form field is case sensitive. Also I'm not quite sure how preg_match works. php.net indicates: preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match. So suppose my string was "Pa55word" preg_match( '[:alnum:]',"Pa55word") (1)So according to the return value conditions, will preg_match stop searching after the first letter P? (2)Does anyone know of a function that would service these types of conditions? If not, I suppose I could write one to store all the characters of the string in an array and then run a match comparison on each element. Although this does not seem optimal at all. Any suggestions?
  7. Thanx for the response teng84 but I'm not quite sure I understand what you're talking about. In my case above will preg_match stop searching after the letter P? If so, is there a function that you know of that can search all characters of the input string and confirm that they are all [:alnum:]?
  8. The form field is case sensitive. Also I'm not quite sure how preg_match works. php.net indicates: preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match. So suppose my string was "Pa55word" preg_match( '[:alnum:]',"Pa55word") So according to the return value conditions, will preg_match stop searching after P?
  9. Hello folks, I'm trying to check a form field to make sure the user inputs an alphanumeric entry only. The preg_match function does not seem to be the solution. Any ideas on how to go about this?
  10. Thank you Haku. This my first time messing with PHP and you have been very helpful. How do I mark a post as resolved?
  11. Haku ... you are a rockstar thanx. Now I need to convince myself why using the isset function was not logical
  12. I thought isset returns TRUE if the variable contains a value other than NULL; FALSE otherwise
  13. So I enter only a username, or only a passoword or submit empty and I am receiving a successful response instead of the error. Any ideas?
×
×
  • 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.