Jump to content

rotten69

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rotten69's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey buddy, Here are a few good n helpful tutorials on installing PHP and MySQL on ubuntu.. . . https://help.ubuntu.com/community/ApacheMySQLPHP http://www.howtoforge.com/ubuntu_lamp_for_newbies
  2. Thanks, ken. This solved the problem I had. I tried "=" instead of "=>", then it did not work for me at all. Just a quick question. I'm interested in programming in PHP, but I still struggle with the logic of it. What do you think it could help me learn it and master it eventually?
  3. I'm just trying to check if the username and password are matched with the ones in the array then a new session is on. if($_REQUEST['username'] == "user1" && $_REQUEST['password'] == "3202") then take them to the home page else stay on the same page.. so, having multiple usernames and passwords, how would you check for that? Would you do an if statement for each username/password?
  4. Hey All, I'm tryin to make a log-in system for multiple usernames and passwords, but I don't really know how many if statements i'd need for it.. I'm also a noob.. <?php session_start(); $users = array("user1" =>"3202", "user2" =>"2002", "user3" =>"1061", "user4"=>"1400", "user5"=>"1001"); if($_REQUEST['username'] == "infs" && $_REQUEST['password'] == "3202"){ $_SESSION['username'] = "user1" ; $_SESSION['password'] = "3202" ; $_SESSION['username'] = "user2" ; $_SESSION['password'] = "2002" ; $_SESSION['username'] = "user5" ; $_SESSION['password'] = "1001" ; $_SESSION['username'] = "user3" ; $_SESSION['password'] = "1061" ; $_SESSION['username'] = "user4" ; $_SESSION['password'] = "1400" ; header("Location: home.php "); }else{ After checking if the matching username and password exist in my array then save them in a session... What's the best way of doing it?
  5. Hey all, I'm just having a problem with this code.. the local server says it has an error on a particular line that will be pointed out in the coding section. <?php $hd = fopen('content.txt', 'r'); $line = fgets($hd); $content = array(); while($line) { $word = explode(',', $line); $content [$word[0]] => array('img_path' => $word[1], 'description' => $word[2], 'price' => $word[3]); // the error message is indicating this line is broken!! Is it because of an equal sign missing? I tried putting an equal sign, but still it doesn't run. $line = fgets($hd); } fclose($hd); ?> Your help is greatly needed..
  6. I'm deadly desperate for the help..
  7. anyone can help me with this code PLEASE..
  8. hahha.. Thanks mate. Well, Was that a complement? lol I modified the code you posted before and Here it is .. <?php $hd = fopen('content.txt', 'r'); $line = fgets($hd); $content = array(); while($line) { $word = explode(',', $line); $content [$word[0]] => array('img_path' => $word[1], 'description' => $word[2], 'price' => $word[3]); // the error message is indicating this line is broken!! Is it because of an equal sign missing? I tried putting an equal sign, but still it doesn't run. $line = fgets($hd); } fclose($hd); ?> This is a log-in system I'm trying to implement session_start(); $users = array("user1" =>"3202", "user2" =>"2002", "user3" =>"1061", "user4"=>"1400", "user5"=>"1001"); //So, inside the if statement .... Would that be $_REQUEST or GET or even isSet? if($_REQUEST['username'] == "user" && $_REQUEST['password'] == "3202"){ <-- This condition is NOT right.. and I don't really know how to re-set it up.. like how to check if the username is matching with its corresponding password $_SESSION['username'] = "user1" ; $_SESSION['password'] = "3202" ; $_SESSION['username'] = "user2" ; $_SESSION['password'] = "2002" ; $_SESSION['username'] = "user" ; $_SESSION['password'] = "1001" ; $_SESSION['username'] = "user3" ; $_SESSION['password'] = "1061" ; $_SESSION['username'] = "user4" ; $_SESSION['password'] = "1400" ; header("Location: home.php "); Cheers,
  9. Thanks for passing, buddy. I need an explanation on that if you can give one please. And, also what's a good idea to check if you have multiple usernames/ passwords in your log-in system? session_start(); $users = array("user1" =>"infs", "user2" =>"csse", "user3" =>"maths", "user4"=>"mmds", "user5"=>"csse"); $passwords = array("password1"=>"3202" "password2"=>"2002" "password3"=>"1061" "password4"=>"1400" "password5"=>"1001"); <-- my last idea and I don't know how I'm gonna use arrays .. If I was to use these arrays then How Would I make a username from $users correspond to a matching password in $passwords. if($_REQUEST['username'] == "guru" && $_REQUEST['password'] == "3202") || ($_REQUEST['username'] == "mad" && $_REQUEST['password'] == "2002") || ($_REQUEST['username'] == "lolo" && $_REQUEST['password'] == "1001") || ($_REQUEST['username'] == "chap" && $_REQUEST['password'] == "1061") || ($_REQUEST['username'] == "pal" && $_REQUEST['password'] == "1400"){ <<-- this is my first idea and for a username and password works, but for 5 sets of credentials doesn't work! $_SESSION['username'] = "guru" ; $_SESSION['password'] = "3202" ; $_SESSION['username'] = "mad" ; $_SESSION['password'] = "2002" ; $_SESSION['username'] = "lolo" ; $_SESSION['password'] = "1001" ; $_SESSION['username'] = "chap" ; $_SESSION['password'] = "1061" ; $_SESSION['username'] = "pal" ; $_SESSION['password'] = "1400" ; header("Location: home.php "); Your help is appreciated.
  10. I'm using a simple shopping cart on my site and I want to implement functionality on the products page and details page (that contains details on the products basically) that reads the item information from an external file e.g. a txt file and I don't want to use any Database systems. So, for each item, I need to store: 1- the name 2- the image 3-the description 4-the price and I want the products page to generate a new row in the table for each item stored in the file. And, the details file should use the file to retrieve the info that should display. I think the best way of doing this is that implementing a function that reads the file into an array which can used by both the products page and details page. I'm just new to PHP and want some ideas on where to start really ... Cheers,
  11. Getting the username and password information from a form..
  12. Any help please???? I'm really desparate for some help at the moment
  13. OK. What I'm trying to do is that to check if the entered username and password match the ones are specified then redirect to the home page. Otherwise, stay on the same page displaying a little message saying "You've encountered an error.." This is my initial code here <?php if($_REQUEST['username'] == "rotten" && $_REQUEST['password'] == "1212"){ $_SESSION['username'] = "rotten"; $_SESSION['password'] = "1212"; header("Location: home.php ".$_SESSION['pageredirect']); // With this line, Would that be Okay to just use Header("Location: home.php" without the .$_SESSION pageredirect?? }else{ $_SESSION['displayerror'] = "0"; // I don't understand what this does.. Why is it ZERO? ?? header("Location: page3.php "); } ?> And also, I have got a question.. Is it possible to make a simple functional shopping cart without using my SQL?
  14. Thanks mate for the help. But, I still get errors on the same lines 3 and 4 Notice: Undefined index: username in C:\wamp\www\folder\login.php on line 3 $_REQUEST username value = Notice: Undefined index: password in C:\wamp\www\folder\login.php on line 4 $_REQUEST password value = I wonder if there is a php debugger... And also, I'd really really appreciate your effort if you just explain what the lines you've just suggested are supposed to do. Please throw useful websites at me that are super-useful to learn php from other than php.net.
  15. @ ken, it's my first time to use this site. So, Excuse me! @ Muddy.. I declared $username="rotten" and $password="1212" just above $_REQUEST..the problem is still coming up on the same line that is 3..
×
×
  • 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.