Jump to content

OmegaExtern

Members
  • Posts

    9
  • Joined

  • Last visited

OmegaExtern's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thread title says it I would start.. What is new? (Ouch, I posted this thread in wrong section appearently. I am sorry mods.) Greetings, OmegaExtern.
  2. Hello I've heard new PHP version (7) is on its way. Since I didn't found any thread laying around already. I guess, lets discuss it. Estimated remaining time until early alpha is around a year. And stable release is expected to be in 2016/2017.
  3. @Barand: Guru sir, your post is not helpful. @Jacques1: Thanks for your answer. I'm trying to avoid cross-site scripting attack. Regards, Omega
  4. Does anybody know if I have to call htmlentities() on each row from table before displaying it to the user? Like: echo htmlentities($data_from_table) . "<br>" . htmlentities($another_data) . "<br>" . htmlentities($moore_data) Or I can put it all together like: echo htmlentities($data_from_table . "<br>" . $another_data . "<br>" . $moore_data) ?
  5. Thanks to both of you for your quick replies! I'm looking into them now.
  6. Hi. I'll like to ask few questions about PHP, as I think they are related to it. I've came across some webpages, what I've spotted is that a webpage displays content but each "page" has different argument and there is no filename. For example: "http://www.website.com/?home" is home-like webpage, by changing "/?home" to "/?anotherpage" land me on some other webpage on their website and so on. My question is how is it done? Is it done from PHP? Another question I wanted to ask is.. I went on InvisionPower.Board forum (such as this PHP Freaks ). How to force "folders" to be displayed as "files"? For example: "http://forums.phpfreaks.com/topic/217301-php-freaks-on-facebook/" which links to a thread. Thanks in advance
  7. OMG! I figured it runs fine, gets username and password plus userId just fine.. Stupid me, I found a mistake... I missed $ in if ($_GET['password'] != $pass[userId]) Sorry for bumping for a such thing xD ( lol we posted on the same time xD ) Thanks for your reply mogosselin!
  8. *** facepalm *** Sorry for posting it under wrong section Please move to PHP help xD
  9. Hi PHP Freaks! I'm one of the newer users here, yep. And this is my first post here ^.^ I have recently started working on my very simple script in PHP. Parse username/password, perform checks against array to see if username exists and if password is correct for specified user. Print out a message as a finish result. And here is what my problem is.. So far I have written this code (PHP): <?php // List of users and their password. $users = array(1 => 'admin', 2 => 'UserTwo', 3 => 'UserThree', 4 => 'UserFour'); $pass = array(1 => '1234', 2 => 'second', 3 => 'third', 4 => 'fourth'); // Compare username parameter against users list (check if user exists). if (in_array($_GET['username'], $users)) { // User is found. Compare password parameter against pass list corresponding to user ID in array. $userId = array_search($_GET['username'], $users); // Compare password parameter against pass list (using specific userId to check if password is valid). if ($_GET['password'] != $pass[userId]) { echo 'You have entered invalid password.'; } else { echo 'Welcome, '.$_GET['username'].'!'; } } else { // User is not found. echo 'You have entered invalid user name.'; } ?> I guess some of you experienced in PHP understand what I am doing up there Basically I wanted to parse username/password arguments to the URL. That works just fine ( echo $_GET['username'] . '<br>' . $_GET['password']; ) ( Just a note, I use Xampp, so it is http://localhost/login.php?username=admin&password=1234 ) Problem starts at line 9.. I am unsure about that part (I just written it out of my mind and little documentation I have found on their official website) with userId and then comparing it to correspond to the user (like like associating password to specific user id, users[0] = admin to have password 1234, users[1] , and so). Could somebody fix this and post up the code, much appreciated (excuse me for little English mistakes, it is not my native language, I do my best to keep it well) Also include a little description or just explain it in several words, what/where I messed up Thanks in advance. Regards, - OmegaExtern
×
×
  • 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.