Jump to content

Vitamin

Members
  • Posts

    88
  • Joined

  • Last visited

    Never

Everything posted by Vitamin

  1. Lets you move your files to a new web hosting account or host
  2. Ok I lied this is not solved yet. Still cant get it perfect. Basic layout. page 1 -> page 2 through a form (login) page 2 -> page 3 link with session vars page 3 -> page 2 broken get errors <?php if(isset($_POST['submitinfo'])){ //auth works and sets session username }elseif(isset($_SESSION['username'])){//something needs to go here, but what? } else { die("Noob!"); } ?> The Noob! is what I get when going from page 3 to page 2 though a link. Ill add anything if you need it.
  3. lol
  4. Woot got it. Cant type in .../userlogon.php and get on anymore. Had to put in a else and die statement to go along with the if(isset) statement. Thanks for the help and the tip!
  5. Oh right on thanks. Ill try that.
  6. Thanks for the help guys. I got it to work, but got a new problem. If I were just type in type in xxx.xxx.xxx.xxx/userlogon.php it takes me to the page and does not give me a error. Here is my new code. <?php $link = mysql_connect('host','root','pass') or die("you fail"); mysql_select_db("videostore"); session_start(); //start session $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); if(isset($_POST['submitinfo'])) { if($username=="" || $password=="") { die("Please do not leave the username / password field blank!"); } $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $number = mysql_num_rows($result); if($number==0) { die("Your login details are not right. Please click the back button and correct them."); } $_SESSION['username'] = $username; //sets session vars $_SESSION['password'] = $password; //sets session vars } ?> Any ideas?
  7. I'm trying to build a web app just to learn php. The main screen is a user logon screen when the user logs on it authenticates it though mySQL. The next screen is like a user screen. Well lets say the user wants to create a new customer, so there is a link to a new page to create a new customer. Well on the new customer page there is a link back to the main user screen. I'm using cookies to make sure its all working and I am able to output the cookies on the 3rd page for the user information, so I know its working. I just don't know how to get the user information back to the main user screen. I'll just show the code. Logon screen form. <form method="post" action="userlogon.php"> <center>User Name: <center><input name="username" type="text" /></center></center><br /> <center>Password: <center><input name="password" type="password" /></center></center><br /> <center><input type="submit" name="submitinfo" value="Submit"></center></form> <?php $link = mysql_connect('host','root','pass') or die("you fail"); mysql_select_db("dbname"); session_start(); $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; $username = $_POST['username']; $password = $_POST['password']; if($username=="" || $password=="") { die("Please do not leave the username / password field blank!"); } $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $number = mysql_num_rows($result); if($number==0) { die("Your login details are not right. Please click the back button and correct them."); } ?> New customer screen. <?php session_start(); $user = $_SESSION['username']; $pass = $_SESSION['password']; <a href="userlogon.php">Main Screen</a> When I click on the link on the 3rd page I get this "Please do not leave the username / password field blank!" I understand that it should not work, I have thought about using a hidden form, but not sure how to go about doing that. Is there maybe a tutorial somewhere about users logging on and how to pass variables so that only users can get to screens after the main logon screen? I help would be appreciated.
  8. Yes that was one of them.
  9. Sigh... got it. My database is not users thats my table username='$username' AND password='$password'"); And needed to add tick marks.
  10. I have a forum on one page and I'm passing though 2 variables. Username and Password. <?php $link = mysql_connect('localhost','root','password') or die("Failed Logon"); mysql_select_db("users"); $username = $_POST['username']; $password = $_POST['password']; if($username=="" || $password=="") { die("Please do not leave the username / password field blank!"); } $result = mysql_query("SELECT * FROM users WHERE username=$username AND password=$password"); $number = mysql_num_rows($result); if($number==0) { die("Your login details are not right. Please click the back button and correct them."); } echo $password ; echo $username ; ?> I know every thing works up to the point where it reaches the select statement then something is going wrong. I have all the correct information in the database and I've tried different users, but none are working. Any help would be appreciated. I'm new to php, but have done simular things with CF and Access.
  11. Well I figured it out after reading this tutorial http://www.thesitewizard.com/apache/install-apache-2-windows.shtml There were a few settings I forgot. Thanks again
  12. ok thanks. Ill try that out.
  13. OK this is what I need to do. I have a school project where I need to design a web video store application using a MS Access database. I'm going to use apache and PHP. I want to be able to test my code at home so I went and downloaded the apache web server and got it configured so the root directory is where my index.php page is located, but when I go to http://localhost/ I get this http://img294.imageshack.us/my.php?image=indexlg1.jpg When i click the link to index.php it just shows me the code, but if I make it a index.html it shows the site just how it should look. Am I forgetting something in a setting somewhere? Edit: I'm on windows (if the SC did'nt give it away I can provide more pics if needed.
×
×
  • 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.