Jump to content

habook2

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

About habook2

  • Birthday 06/04/1992

Contact Methods

  • Website URL
    http://www.laughsaplenty.com

Profile Information

  • Gender
    Not Telling

habook2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This is what you need to put on the main page for you to log in on: [code]<form action="http://whateverwhatever.com/login.php" method="post">Username:<input type=text name="username"><br>Password:<input type=password name="password"><br><input type=submit value="Log in"></form>[/code] Then you need to create a seperate page, called [a href=\"http://www.whateverwhatever.com/login.php\" target=\"_blank\"]http://www.whateverwhatever.com/login.php[/a] with the following code:[code]<?php $name = $_POST['username']; $pass = $_POST['password']; $realuser = REAL USERNAME HERE; $realpass = REAL PASSWORD HERE; if($name == $realuser && $pass == $realpass){echo "Click <a href=URL TO PROTECTED PAGES>here</a> to go to the protected pages.";} else {die("Login Failed");}?>[/code] Also, if I screwed this up somehow, someone please correct me.
  2. The variable's not in double quotes, though. This is taken literally from the page: [code] setcookie ("lap", '$name', time() + 3600);[/code] That's exactly how it's in the page, but when the coolkie is echoed from another page, it actually says "$name". Also, since I'm broke, I use notepad. Works for HTML pretty well, but not so much with PHP.
  3. I need to put the value of a variable in a cookie. I think it's: [code] setcookie ("cookiename", '$variable', time() + xxx time);[/code] But that, when lookedup, contains the text "$variable". How do I put the variable's value in it instead?
  4. All right. Here's what I have. [code] <?php $name = $_POST['name']; $pass = $_POST['password']; $connid = mysql_connect ('localhost' , 'DBUSER' , 'DBPASS'); mysql_select_db ("laughsap_jokes"); $dbuser = mysql_query ("SELECT username FROM users WHERE username LIKE $name WHERE password LIKE $pass") or die("Login failed."); $dbpass = mysql_query ("SELECT password FROM users WHERE username LIKE $name WHERE password LIKE $pass"); if ($name == $dbname && $pass == $dbpass) { print "Login Successful"; setcookie ("laplogin", "Logged in", time( ) + 500000); } else { print "Login failed."; } ?> [/code] The if is probably redundant, but still.
  5. I need a script in which $a will be checked against column A, and if a row exists where $a exists in column A, it moves on to do the same thing with $b and column B. If successful, print "Successful" and write a cookie, else print "Unsuccessful". In case you haven't guessed, this is for a login.
  6. No, I mean the value of the variable. If, by a previous form, the variable $username had been set to "flamino", then how would I insert "flamingo" instead of "$username" ?
  7. How do I insert a variable's value into a table? Like: mysql_query ('INSERT INTO `users` (`username`, `password`, `userid`) VALUES (\'I WANT A VARIABLE HERE\', \'I WANT A VARIABLE HERE\', NULL);) When I just tried using the variables, they would actually add "$username" and "$pass" as the username and password.
×
×
  • 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.