Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,849 members, 7,820,960 topics. Date: Wednesday, 08 May 2024 at 05:20 AM |
Nairaland Forum / Science/Technology / Programming / Help With Login Form (1676 Views)
Login Code In Vb6.0 / I Need A Help To Write A Simple Login Form Using Vb.net / [Code Request] Code for PHP Login And Signup (2) (3) (4)
Help With Login Form by ify01: 4:01am On Oct 07, 2014 |
Am Trying to create a form with array(); in which users can log in . The problem am having is that when ever i call the array(); i.e $users into function, it dislays wrong members ID. How do i correct this? Please a detailed analysis and if possible a sample code would be appreciated. <html> <head> <?php $users = array('john', 'paul', 'mark', 'luke'); $admin = array('dan', 'ify', 'chris', 'jane'); if (isset($_POST['submit1'])) {$june = $_POST['paul']; $members = 'WRONG ID'; } if ($june == $users) {print ('welcome'); } if ($june == $admin) {print ('Welcome back, SuperAdmin'); } else {print ($members); } ?> </head><body> <form name = 'trial' method = 'post' action = 'trial.php'> <input type = 'TEXT' Name = 'paul' <?php print $june . ' '; ?> value = 'user' ?> <input type = 'submit' value = 'enter' Name = 'submit1'> </body> </form> </html> |
Re: Help With Login Form by yousouphe(m): 6:28am On Oct 07, 2014 |
ify01:Its not possible u call on array like a normal variable u could use indexing to get the actual array element something like $user[0] still better to get the index , u could use loop. But try it this way For (a =0;a<=3;a++) { if ($june == $users[a]) {print ('welcome'); } if ($june == $admin[a]) {print ('Welcome back, SuperAdmin'); } else {print ($members); } 1 Like 1 Share |
Re: Help With Login Form by GodMode: 6:55am On Oct 07, 2014 |
what are you trying to display how can you display an id without a database why is your code terribly structured why don't you have a database why is the php script in the head section of your html why are u putting php in the input tags wrongly why are u programming without a vision why are u here Your mistakes are epic go back and train harder 1 Like |
Re: Help With Login Form by spicyuzo(m): 9:23am On Oct 07, 2014 |
GodMode: Oga boss clap for yourself... How have you contributed positively to this thread? When did it become a crime to ask questions? Didn't you pass through a learning proccess, or you were preloaded with php knowledge from birth? The op is here asking for help. If you can help if you cannot, stay put. Op, try out the solution proffered by the yousouphe. You have to refrence the position index. Consult more books for better enlightenment. 2 Likes |
Re: Help With Login Form by GodMode: 9:33am On Oct 07, 2014 |
spicyuzo: Even the codes yousouphe put is wrong... I've tested everything.... my solutions are in the questions I asked I didn't pass through a learning process, I'm living in the learning process I'm still a beginner. Its php/mysql not php. server-side scripting mostly interacts with a database... |
Re: Help With Login Form by mubitechnology: 10:34am On Oct 07, 2014 |
pls let us not turn this thread into a fight arena, let try and provide solution the op problem, I believe we are all professionals here . 2 Likes |
Re: Help With Login Form by ify01: 11:33am On Oct 07, 2014 |
yousouphe: Thanks for replying. What do you think about the below code? <html> <head> <?php $users = array('john', 'paul', 'mark', 'luke'); $admin = array('dan', 'ify', 'chris', 'jane'); if (isset($_POST['submit1'])) {$june = $_POST ['paul']; $members = 'Sorry,but you are not recognised in our database';} if ($june == $users[0] || $june == $users[1] || $june == $users[2] || $june == $users[3]){print ('welcome'); } else if ($june == $admin[0] || $june == $admin[1] || $june == $admin[2] || $june == $admin[3]) {print ('Welcome back, SuperAdmin'); } else {print ($members); } ?> </head><body> <form name = 'trial' method = 'post' action = '<?php $_SERVER[PHP_SELF];?>'> <input type = 'TEXT' Name = 'paul' value = 'user'> <input type = 'submit' value = 'enter' Name = 'submit1'> </body> </form> </html> |
Re: Help With Login Form by ify01: 11:45am On Oct 07, 2014 |
spicyuzo:I have tried that! Thanks for replying |
Re: Help With Login Form by ify01: 11:59am On Oct 07, 2014 |
mubitechnology: If 98% of people are like you, i believe that the world would be a better place. Thanks for replying. |
Re: Help With Login Form by drealboy(m): 4:10pm On Oct 07, 2014 |
ify01:wrapping d conditions in <for loop> would av produced a cleaner codes …too many logical operators der is just too unreadable |
Re: Help With Login Form by Nobody: 5:02pm On Oct 07, 2014 |
Them don dey fight ni? 1 Like |
Re: Help With Login Form by Nobody: 5:17pm On Oct 07, 2014 |
GodMode be forming boss in all the programming threads. Instead of wasting your time trying to bring down someone. ego u should have replied with possible solutions, and mind you GodMode, nothing wrong with the solution yousouphe gave. It's programming, not a boxing match. 3 Likes |
Re: Help With Login Form by ify01: 5:18pm On Oct 07, 2014 |
drealboy:please, can you give me a sample code? |
Re: Help With Login Form by GodMode: 7:49pm On Oct 07, 2014 |
phatjoe50: I'm still a beginner... Most Nigerians are proud.. I'm just poking that pride... I'm not even trolling yet Who's fighting and forming boss I'm only asking questions.. I'm not a boss I'm not trying to bring down anyone... Stop misunderstanding my comments. Creating a login without using sessions or is it cookies... is weird to me. I don't understand what the OP is trying to do due to my dullness |
Re: Help With Login Form by Nobody: 8:03pm On Oct 07, 2014 |
trollin' 2 Likes |
Re: Help With Login Form by drealboy(m): 8:27pm On Oct 07, 2014 |
ify01:<!DOCTYPE html> <html> <head> <title></title> </head> <body> <?php $users = array('john','paul','mark','luke'); $admin = array('dan','ify','chris','jane'); if(!isset($_POST['submit1'])){ ?> <form name="trial" action="<?php echo $_SERVER['PHP_SELF']?>" method="POST"> <input type="text" name="paul" value=""> <input type="submit" name="submit1" value="Enter"> </form> <?php }else{ $june = $_POST['paul']; $member = "Sorry but you are not recognized in our database"; for($i =0; $i< 4; $i++){ if($june==$users[$i]){ print "Welcome"; break; } if($june==$admin[$i]){ print "welcome back super admin"; break; } if($i==3){ print $member; } } } ?> </body> </html> 1 Like |
Re: Help With Login Form by yousouphe(m): 6:16pm On Oct 10, 2014 |
ify01:yes bro still good but this one is taking too long u could just use loop to solve the problem instead of the index( 0123) urself, u could save urself that time by using loop Thanks 1 Like |
Re: Help With Login Form by Djtm(m): 7:24pm On Oct 10, 2014 |
mubitechnology:and I believe Santa is real. |
Re: Help With Login Form by abdurrazaq1995: 10:37pm On Oct 10, 2014 |
Add me with my pin 32E9044B and get unlimited tutorial you might need. Urgently.please never take time to waste |
Re: Help With Login Form by ify01: 12:11am On Oct 12, 2014 |
drealboy: Thanks for helping out. |
Re: Help With Login Form by ify01: 12:13am On Oct 12, 2014 |
yousouphe:Noted! Thanks for that advice. |
Re: Help With Login Form by maekhel(m): 9:38am On Oct 15, 2014 |
dis shld do it
1 Like |
(1) (Reply)
Please Help Fix My XSLT File / The Best Dark Web Websites You Won't Find On Google. / Why Are All Tech Startups In Nigeria Fintechs?
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 62 |