Jump to content

admin authorization not working


srinivasa

Recommended Posts

i am doing a project named 'product management store'

i have attached four files namely login.html,login.php,success.php,admin(sql file) basically am doin admin authorization(first step) in that only am facing problem after entering/not entering input just showing blank page...please help me out....am feeling mysql_fetch_array function giving troble....

i hav also provided grant statement

 

//admin table

 

--

-- Database: `products`

--

 

-- --------------------------------------------------------

 

--

-- Table structure for table `admin`

--

 

CREATE TABLE IF NOT EXISTS `admin` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`username` varchar(20) NOT NULL,

`password` varchar(20) NOT NULL,

PRIMARY KEY (`id`),

UNIQUE KEY `username` (`username`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

 

--

-- Dumping data for table `admin`

--

 

INSERT INTO `admin` (`id`, `username`, `password`) VALUES

(1, 'admin', 'admin');

 

 

please help me out...what is the prob...

login.html

login.php

success.php

Link to comment
Share on other sites

There are two things I would do here... First, if you are getting a blank page, that seems to me to be an indication of a PHP error of some kind, but you most likely have PHP Errors turned off. To enable them either add this to the top of your login.php code, or change the PHP.ini file itself (change the values of "error_reporting" and "display_errors")

 

ini_set('display_errors',1); 
error_reporting(E_ALL);

My guess is that the issue you are having in the login.php file involves line 19:

 

$count = mysql_fetch_array($result) or die(mysql_error());

You may need to go about it like this instead:

 

$count = mysql_num_rows(mysql_query($result));

Link to comment
Share on other sites

Still am facing same problem........

in login.php

 

$result = mysql_query(' SELECT * FROM admin ')

or die(mysql_error()); //working well

 

but my duty is to verity username and password(i,e matching user entered and database entry)if i write like this

$result = mysql_query(' SELECT * FROM admin WHERE username = "$myusername" AND password = "$mypassword" ')

or die(mysql_error());

 

am getting blank page

so this part giving troble or unable to parse (where username = "$myusername" and password = "$mypassword")

whats your view please assist me to rectify this........one more questions is it not possibe to use variabe inside mysql_query function as i did above?

 

kindly reply soon..............

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...