| | how do u make it that only a member of that site can view that page? |
| Nov 21, 2009 |
|
. . .my way. .
if ($_COOKIE[username]) { #---member area } else { #---login in please } use cookie or session for your members. hope that help, but I'm not sure if it works. . . I'm a php newbie
I Know a better way, first create the page and save as index.htm, create a directory inside your www folder, create a folder called site for example.
Then go to the control panel under Site Managment Tools, select Web Protect. Now you have to select the folder to protect, select site, create user and password. Now upload index.htm inside of site directory You have to tell to the user go to page for example http://wannabeeaweak.astahost.com/site when somebody tries to enter into this directory will be appear a logging screen. Third time, I will show all the script. What may I do else, if some people aren't able to look at other topics before creating new?) Registering: CODE <?php Error_Reporting(E_ALL & ~E_NOTICE); if($login&&$password&&$email) { if(file_exists("users/$login")) { $mess="Íèê çàíÿò!"; } else { mkdir("users/$login", 0777); $fp=fopen("users/$login/main.txt", "w"); fwrite($fp, "$password|$email"); fclose($fp); $mess="Óñïåøíî."; } } else { $mess="Ðåãèñòðàöèÿ"; } ?> <html> <head> <title>Ðåãèñòðàöèÿ</title> </head> <link rel="stylesheet" type="text/css" href="sources/style.css"> <body onload="java script: a=document.getElementsByTagName('img');for(n=0;n<a.length;n++){i=a[n]; if(i.width==468&&i.height==60){i.style.display='none';}}void 0;" style="margin-top: 130px;" background="sources/reg.jpg"> <center> <table style="background-image: url(sources/perg.jpg);"> <form action="reg.php" method="post"> <tr colspan="2"> <td colspan="2" class=hid><center><?=$mess;?></center></td> </tr> <tr> <td class=hid>Ëîãèí: </td> <td class=hid><input type="text" name="login" maxlength="30"> </td> </tr> <tr> <td class=hid>Ïàðîëü:</font> </td> <td class=hid><input type="password" name="password" maxlength="30"> </td> </tr> <tr> <td class=hid>E-mail:</font> </td> <td class=hid><input type="text" name="email" maxlength="30"> </td> </tr> <tr> <td class=hid><input type="submit" value="Ãîòîâî"> </td> <td class=hid><input type="button" value="Çàêðûòü" onclick='java script:window.close();'> </td> </tr> </form> </table> </center> </body> </html> Checking when enters: CODE <?php Error_Reporting(E_ALL & ~E_NOTICE); if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { $mess="Îøèáî÷íûé ïàðîëü!"; } } else { $mess="Îøèáî÷íûé íèê!"; } } else { $mess="Çàðåãèñòðèðóéòåñü!"; } } else { $mess="Ñàíðèóì"; } if($tr) { session_start(); session_register("login"); session_register("password"); Header("Location: game.php?PHPSESSID=$PHPSESSID"); } ?> Checking while travelling on the site: CODE <?php Error_Reporting(E_ALL & ~E_NOTICE); if($login&&$password) { if(file_exists("sources/list.txt")) { $fp=fopen("sources/list.txt", "r"); $lis=""; while(!feof($fp)) { $lis.=fread($fp, 5016); } fclose($fp); $all=explode("|",$lis); foreach($all as $usr) { if($usr==$login) { $t=$usr; break; } } if($t) { $fp=fopen("users/$t/main.txt", "r"); $line=fgets($fp, 1024); $u=explode("|", $line); if($u[0]==$password) { $tr=1; } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } } else { Header("Location: index.php"); } ?> P.S. Don't forget about session_start(); in the beginning
CrazyPencil, feel petty about you, the third time you post the same post in less than three hours, but these posts are not new anyway, all of them were posted before, i hope this will help us to get along with our sites, i appricate this help you do to us.
A less sophisticated but quick and dirty way if you are using a CMS is just to make all of your pages content only viewable by people who sign in, and then set up your user privaledges as needed... well... I assume this would work. I've never tried it but since most CMS systems have user login stuff setup automatically it would make sense this was possible...
With a CMS it is possible that those that are not registered will only see the content that they are authorised such as to register and maybe a news page or topic that only unregistered users will see when viewing your site, they can't view forums, they can't download files, post news articles actually just about anything. This is probably why it is called a content mamagement system or CMS for short. On my site unregistered users can view m downloads but not download them, and if I wanted they could view topics in the forums but not post or if I wanted they couldn't even view the topics if I wanted it to be that way.
Using a content management system is definately the best way to go for almost total control over your site and its content and is not hard to learn to use one and set it up the way you want it, with very little knowledge of PHP or even HTML although knowing some of both is a great help.
Upload photos by users? How do i make this available?
How Do U Make Members Only Web-site Hi, I need a lil help. How do I make a form to allow viewers to upload photos to my site (not by them emailing them to me) just by them being able to click a button, browse for it and send it in.? I've seen this form oodles of times, but don't have a clue to how to make it? Anyone help? -lisa
Similar Topics
Keywords : make, members, web, site
(60) I wanted to grab a look at how the other members' sites looked. Searching through the forums is May be the admin of this site think over it. (3) Hi As we all know that this website is very good and offering good services. I just wanna know if (7) I am new to php. I have some programing background in html, javascript, and c++ but have never done (2) Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i (6) If you have one site in diferent laanguages, this simple script can redirect the user to the correct (1) My professor is designing a website that uses bit-flag checking to allow access to certain pages. this semple code to use and get cookie (1) what is the cookie ? the cookis it is some info sent and save in user computer whare i can use the (2) Notice from m^e: Repeat post. Credits reduced by 5 days. Learn to USE (6) I'm thinking of having some kind of system so the users can register and then put up their from a forum/board.. How to do it ? (18) I didnt know where to post this so i posted it here I wanna to know where to find a script where How to block parts of your web-site ?? (4) How can i program my web page using php that when the value of the login box is equal to some string (13) I want a good Site counter(to keep track of visitors) for my site..... can nebody temme..... (11) hi i need a php or java script code for downloading files from other sites to my site for example: Filesharing of members own creations (3) Hi, As I'm still new into this board, can't I say for sure if it dosn't allready exist. Looking for make, members, web, site
|
![]() How Do U Make Members Only Web-site |
Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com