Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

user checking


Print Track
hello guys. I'm new on php and i need big help.

www.yoursite.com/checkuser.php?username=(use name)&password=(user password)

and if user are in gruop example in V.M (i made that gruop) then window shows some key (exampe True)

If username and password is good but the user aren't in group then window shows false

Also if username and password is not good then window shows false
(sorry for english)
Thanks for help

Marius L T

12 replies


/*
| In case you have input fields on the previous page where
| you can give the user name and password.
*/

//Select database entry with the given username
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".$_POST['username']."'");

//Check if the given username exists
$rows = dbrows($result);
if ($rows) {
$cgroup = dbarray($result);
if (md5(md5($_POST['user_password'])) == $cgroup['user_password']) {
//use the explode function to check
$usergroup = explode(".",$cgroup['user_groups']);
//assuming your group ID is 2 (p.s: don't tell me you don't know how to get the group ID)
if (in_array("2", $usergroup)) {
echo "You are in the group";
} else {
echo "You are not in the group";
} else {
echo "wrong password!";
}
} else { echo "No user name such as ".$_POST['username']; }


This is my spontaneous coding but basically it's a rough sketch of what you can do.
Hope you get the picture.
thanks. I added but i see empty window. Can you tell me what ling could be? i'm trying www.rsbot.hostzi.com/perz.php?user_name=(myname)&password=(mypw)

(perz is my php file name)

Quote

Marius L T wrote:
thanks. I added but i see empty window. Can you tell me what ling could be? i'm trying www.rsbot.hostzi.com/perz.php?user_name=(myname)&password=(mypw)

(perz is my php file name)


LOL. told you in my post, it's a rough sketch of what you can do..
it's not a perfectly-working code. that is going to be long.
i see empty window always
do you have any experience with php mysql or html?
use stripinput please! :)
CodeDownload  

$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='".stripinput($_POST['username'])."'");

 

Quote

afif wrote:
do you have any experience with php mysql or html?


I don't think that is relevant here, he just needs help.
I don't have any experience on php. I just started. Also what i need change on script input. (sorry i don't know anything on php)
How to input script??

Quote

Marius L T wrote:
How to input script??


You mean input text or data or something?
You have to use <form> tag and <input> tag.
Try on that. Find tutorials in the Internet. For a start, you may wanna take a look at w3schools.com
afif i adde your script to mine web. But when i enter like this:

www.rsbot.hostzi.com/usercheck.php?user_name=k1&password=password

I see always empty window but username and password is
right. Also user is in group.

slaughter said that acc script input. I'm asking how to do it?
LOL. as i've said earlier, my script is not a perfectly-working code.
and by the way, what slaugher is saying is stripinput, not script input!

what you should do is:

1. have a page with forms to input username + password.
2. have the processing .php file to check
author Marius L T
forumSite & Forum Issues - 8
replies13 posts
viewed3,973 times
activeLast updated on 10 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Craig, afif, Basti, Marius L T