Hi, I have this login form

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin login</title>
<link href="../css/submit.css" rel="stylesheet" type="text/css" />
<link href="../css/template.css" rel="stylesheet" type="text/css" />
<body>
   <img alt="full screen background image" src="../images/background.jpg" id="full-screen-background-image" /> 
   <a href='../php/index.php'><span class="adminlinks">Home</span></a>

   <form class="form" action="login.php" method="post" enctype="multipart/form-data" name="login_form" id="login_form" style="margin-bottom:0px;">
<h1 style="margin-bottom: 0px">Admin Login</h1>
<p><input type=text name="user" /> <b>User Name</b></p>
<p><input type=text name="pass" /> <b>Password</b></p>


<input type="submit" name="submit" value="Login" />
<input name="login_form" type="hidden" id="login_form" value="login_form" />
</form>

</body>
</html>

The form sends login details to login.php for proccesing.
My question is this, how can I get the form to be in a popup box when I type www.mysite/admin into the address bar?. At the minute the form is just held in a web page.

Thanks for looking..................

Recommended Answers

All 3 Replies

If you manually key in the URL in a browser window, the page will open as any other. If you call the login form from an existing page, one option is to use javascript to open a small browser window that's customized...

JavaScript Window.Open

window.open(url,name,features,history)

HTML Example - Popup
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
  function openWindow() {
    myWin = window.open('', '', 'width=400,height=300');
    myWin.document.write("Hello!");
  }
</script>
</head>
<body>

<input type="button" value="Open Window!" 
    onclick="openWindow()" />

</body>
</html>

more info.. JavaScript Open Windows and Popups

Thanks for that.
After a search I decided to password protect my whole 'admin' dir.
I used a .htaccess file and a htpasswd file. I put both in my 'admin' dir.
But I keep getting this error when I try to loginin. (I'm using wampserver)
'Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.'

This is my htaccess file

AuthType Basic  
AuthName "Admin Login"  
AuthUserFile /localhost/website/admin/.htpasswd  
require valid-user

This is my htpasswd file (with user and password changed)

user:pass

Can anyone shed any light on this?

Thanks..

I finally got it, the path was wrong!
This now takes me to the dir listing, but is there any way i can get it to take me to a certain file within the dir. I would like it to open 'admin.php'

Thanks for looking.......................

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.