Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 08-12-2004, 06:15 PM   #1 (permalink)
Junkie
 
Location: San Diego
[html/java/php] Passwording webpages

I am making a website for my fraternity and we want to have a user/password section to protect our directory. Nothing special, just to keep random people from getting ahold of our phone numbers. The only problem is I have no clue how to program this. I am designing the site with Adobe Photoshop and making the necessary changes in Microsoft Frontpage. If anyone could help me out with a simple code or function in fp which will activate passwording that would be awesome! Thanks!
__________________
If something seems too good to be true, then it probably is....
punx1325 is offline  
Old 08-12-2004, 06:53 PM   #2 (permalink)
Upright
 
How is the site hosted? If it's hosted on Apache than you can start using .htaccess and .htpasswd files.

This will let you prompt for a login/password built in apache and nearly impossible to get past.

Here is an example of a config for .htaccess
##########
deny from all

##Allow One IP address without auth.
allow from 207.144.22.22/32
AuthType Basic
AuthName "Configuration System - Level 15"
AuthUserFile /home/website.com/www/secured/.htpasswd
require valid-user
# Satisfy any will let passworded users or IP Users
# Satisfy all will require you to match ip and password
satisfy any
#


More on google!
asdfasdf1 is offline  
Old 08-12-2004, 09:43 PM   #3 (permalink)
Junkie
 
Location: San Diego
Thanks for the idea asdfasf1, I am looking into the server setup right now, but I won't know until late tomorrow. It doesn't have to be the most secure thing on earth I just want something to prompt a user/password for 2 webpages on the site. I need very basic, because people down the road may not know what to do. I'll keep googling but if anyone knows a simple solution let me know. Thanks!
__________________
If something seems too good to be true, then it probably is....
punx1325 is offline  
Old 08-13-2004, 05:24 AM   #4 (permalink)
beauty in the breakdown
 
Location: Chapel Hill, NC
There's no such thing as a decent JavaScript password utility. What you want is the Apache .htaccess that was listed above (assuming you can do that on your server). Its by far the easiest way to do that. The other way is a sessions-based php/mysql authentication scheme, but that seems to be a bit over your head
__________________
"Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws."
--Plato
sailor is offline  
Old 08-13-2004, 11:11 AM   #5 (permalink)
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
Well... if you have php and it can be as crappy as possible, why not just do:

PHP Code:
<?php 
// Put all your users in this array:
$users = array(
"HalX"=>"TFP",
"RelaX"=>"ThaMan",
"User"=>"Password");

echo 
'<?xml version="1.0" encoding="UTF-8"?>'

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Title of the page</title>
    <style type="text/css">
         html, body   { height: 100%; margin: 0; padding: 0;

                        color: white; text-align: center; }

         div.centered { border: 0; background-color: white; height: 50%; width: 50%;

                        position: absolute; left: 20%; top: 25%; color: black; }
                        
                        
         div.bottom { border: 0; background-color: white; height: 90%; width: 0%;

                        position: absolute; left: 80%; top: 80%; color: black; }
    </style>
  </head>
  <body>
  <?php
  
if ($users($_REQUEST["user"]) && $users($_REQUEST["user"])==$_REQUEST["password"])
  {
  
?>

  Real content here

  <?php
  
}
  else
  {
  
?>

  <div class="centered">
  <br /><br />
    <form action="<?php global $PHP_SELF; echo $PHP_SELF?>" method="post">
      <p>You must be logged in to see this page<br />

      Username: <input name="user" type="text" /><br />
      Password: <input name="password" type="password" /><br /><br />
      <input type="submit" value="Log in" /><br /></p>
    </form>
  </div>
  <div class="bottom">
    <p>
      <a href="http://validator.w3.org/check?uri=referer">
        <img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1!" height="31" width="88" border="0"/>
      </a>
    </p>
  </div>
  <?php
  
}
  
?>
  </body>
</html>
Or something like that (this is all from memory and bound to be flawed).

"It's quick... it's dirty... I love it"
Forget who said it, but it feels like an appropriate quotation.

EDIT: Okay, so I suck... I validated it and added the stylesheet some other guy made to center the damn thing. Make sure you have a recent php version for this though... my crappy 4.2.2 (Red Hat 9 ) wouldn't do the array() function, so it's kindof untested. But it should work. I do stuff like this for a living.
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein

Last edited by RelaX; 08-13-2004 at 11:47 AM..
RelaX is offline  
Old 08-13-2004, 11:21 AM   #6 (permalink)
Junkie
 
Location: RI
Pfft, it's not done like that =p. I can write you a dinky and quick php script tonight. All I need to do is look at my book. =p
Fallon is offline  
Old 08-13-2004, 06:43 PM   #7 (permalink)
Junkie
 
Location: San Diego
Thanks for your help RelaX! I played around with your code and it sorta works but it's missing something and I am still trying to figure that out. Fallon if you have something which works better, your help would be greatly appreciated! It is reasons like this which I love the TFP!
__________________
If something seems too good to be true, then it probably is....
punx1325 is offline  
Old 08-15-2004, 06:44 PM   #8 (permalink)
Junkie
 
Location: San Diego
Yep I'm stuck I don't know what I am doing. I have been fiddling with RelaX's code, but I am not getting it to work right. If anyone else knows what that code is missing or has a different code to use, your help would be greatly appreciated.
__________________
If something seems too good to be true, then it probably is....
punx1325 is offline  
Old 08-16-2004, 05:01 AM   #9 (permalink)
Junkie
 
Location: RI
Alright, this is a bit simplified and such but here goes
Hopefully you have PHP running on your server and such.
PHP Code:
<? 
  op_start();
  print '<head>
  <title>My spectacular page</title>
</head>
<body>
<h1>Login Form</h1>
  if ( isset ($_POST['submit'])) {
    //Handles the form
    if ( !empty ($_POST['username'])) && ($_POST['password'])) ) {
      if ( ($_POST['username'] == 'testing') && ($_POST['password'] == 'testpass') ) {
        //Everything is good
        header('Location: welcome.php');
        exit();
      } else { //Password was wrong
       print '<p>The submitted username and password do not match those on file<br>Go back and try again.</p>';
      }
    } else {  //Forgot something
      print '<p>Please make sure you enter both a username and a password!<br> Go back and try again.</p>';
    }
  } else { //If form wasn't submitted
    //Displaying the form
    print '<form action="login.php" method="post"><p>
    Username:<input type="text" name="username" size="20"><br>
    Password: <input type="password" name="password" size="20"><br>
    <input type="submit" name="submit" value="Log In"></p>
    </form>';
  }
  print '</body></html>';
  ob_end_flust();
?>
Hopefully this all works, might be a few typos somewhere, I'll look when I get out of work.
Fallon is offline  
Old 08-18-2004, 11:13 PM   #10 (permalink)
Junkie
 
Location: San Diego
Fallon, I worked with your code, but I am really confused. Nothing is displayed when I load it into frontpage. Is there something missing?
__________________
If something seems too good to be true, then it probably is....
punx1325 is offline  
Old 08-19-2004, 10:10 AM   #11 (permalink)
Junkie
 
The results of PHP processing instructions don't get displayed in the browser or HTML editor if PHP didn't process the script first. Instead of using the PHP print and echo functions to send HTML to the output, you should embed processing instructions in your HTML template. That way the HTML layout gets displayed even if PHP didn't process the file first. So, instead of this:

PHP Code:

echo  "<html>"
       
"<head>"
       
"<title>" $page_title "</title>"
       
"</head>"
       
"<body>"
       
$page_content
       
"</body>"
       
"</html>"
do this:

PHP Code:

<html>
 <head>
  <title><?=$page_title?></title>
 </head>
 <body>
  <?=$page_content?>
 </body>
</html>
SinisterMotives is offline  
Old 08-19-2004, 09:11 PM   #12 (permalink)
Junkie
 
Location: San Diego
I figured it all out. Thanks for your help everyone!
__________________
If something seems too good to be true, then it probably is....
punx1325 is offline  
 

Tags
html or java or php, passwording, webpages

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 05:46 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360