Nov 21, 2009

How Do U Make Members Only Web-site

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

How Do U Make Members Only Web-site

wannabeeaweak
how do u make it that only a member of that site can view that page?

Comment/Reply (w/o sign-up)

kilz
. . .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

Comment/Reply (w/o sign-up)

deivid
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.

Comment/Reply (w/o sign-up)

CrazyPensil
Put authentification page on the first page, checking in beginning of each page, which returns user to index.php, if he didn't pass the check.

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 wink.gif

 

 

 


Comment/Reply (w/o sign-up)

XIII
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.

Comment/Reply (w/o sign-up)

Jeigh
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...

Comment/Reply (w/o sign-up)

Houdini
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.

Comment/Reply (w/o sign-up)

FeedBacker
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

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : make, members, web, site

  1. Credit System - Transfer Credits Between Members?
    (1)
  2. Unofficial Astahosted Members Directory
    (60)
    I wanted to grab a look at how the other members' sites looked. Searching through the forums is
    good enough to retrieve the address of their websites. However, quite a few of the links are dead.
    So, I decided to make a script to do this job for me. Here's a screenshot of the directory
    listing process. Astahost Directory Lister ....
  3. Should This Great Site Offer Imagemagick ?
    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
    other people also want ImageMagick to be installed on this server with free accounts... so please
    let me know and lets check if the Admin of this site can isntall it..... Fun....
  4. Dynamic Site Design - Where Do I Start ?
    (7)
    I am new to php. I have some programing background in html, javascript, and c++ but have never done
    anything in php Can someone reccomend some good sites or books etc that can help someone who is
    completely new? My ultimate goal is to make a game like/similar to ponyisland.net....
  5. Need Help Is Adding A PHP Based News Module To My Site
    (2)
    Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i
    just place there the Topics and add a link to another page "news.php". Well its obvious that i dont
    want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I
    will show want i'm doing CODE        require ('mysql.php');       
    $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 ";        $result=mysql_query($query);
               $num=mysql_num_rows($result); mysql_close(); echo " Outras Other News "; $i=....
  6. Multilingual Site: Send The User To Page Of Choice
    (6)
    If you have one site in diferent laanguages, this simple script can redirect the user to the correct
    page acording to his/her language: CODE // Enslish EUA elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-us"){ header("Location: index_eng.html"); } // Inglês UK elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-gb"){ header("Location: ingles_enuk.html"); } // Portuguese if ($HTTP_ACCEPT_LANGUAGE ==
    "pt-br"){ header("Location: index_ptbr.html"); } //German elseif ($HTTP_ACCEPT_LANGUAGE ==
    "de-de"){ header("Location: index_ger.html"); } // Swedish elseif ($HTTP_ACCEPT....
  7. Using Bitflags To Restrict Site/page Permissions
    (1)
    My professor is designing a website that uses bit-flag checking to allow access to certain pages.
    You login, validate login, and store their allowed bit flag into a session variable. Then you
    compare to see if they have access or not. It's fairly new to me, but it's apparently very
    common with linux users. Sounds interesting to me, just wondering if any one has used this, or is
    it a little too much for simple pages. His site however is going to be more of "software" for
    several users. Is it very secure and does it work well?....
  8. How To Use Cookie In Your Web Site ?
    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
    cookies? becouse the cookies it like the header you can not send it after any output wes sent so
    you must send the cookies before any output like as ,echo and any other code i well make an E.X.
    to use the cookies you must have 2 file index.php update.php ---------- in the index.php add this
    code CODE    // This section must go at the top of the page that will display    // the
    users favorites.  These are the 'default' URLs that the user    // will se....
  9. Do You Want A Mail Form In Your Site
    (2)
    Notice from m^e: Repeat post. Credits reduced by 5 days. Learn to USE
    THE SEARCH BUTTON before you make such posts. did you want to have in your web site mail form
    that allow the user to send mails to anther mail from his mail e.g. the compose in yahoo CODE
    from to cc bcc subject
    function param($Name)         {         global
    $HTTP_POST_VARS;         if(isset($HTTP_POST_VARS ))            return($H....
  10. Own Links On Site
    (6)
    I'm thinking of having some kind of system so the users can register and then put up their
    links. Everything should be saved in some kind of database. Anyone now any tutorial or guide or
    something like that of how to do that?....
  11. Script to allow only members to download media
    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
    people have to register at your forum to download media off your website and i also wanna know what
    it is called. ------------------------------------------------------------- Next time you make a
    post - please be more specific about the topic. It helps a lot if your topic describes your post
    content in brief rather than having a "Help me" - which could mean anything. More often this
    wouldn't pique the interest of the readers at all and your post will get very few respo....
  12. PHP Based Site Access Authentication - Help
    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
    then go to my success.html otherwise on my fail.html????help me guys!
    ------------------------------------ It would help the readers far better to understand what your
    problem is - if you state the nature of it in short in your topic title, instead of just "Php help".
    It'll also get you a lot more responses. Am changing your topic title to give you an example.
    All the best /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> m^e....
  13. Site Counters - Help Needed
    (13)
    I want a good Site counter(to keep track of visitors) for my site..... can nebody temme.....
    where will i get free stuff on this... (dont ask me to google..and try out..i am doing that..just in
    case u know someplace) OR Can how do i design my own (which seems quite....difficult for me) Plz
    help!! Satya....
  14. Php Script To Download File From Another Site
    (11)
    hi i need a php or java script code for downloading files from other sites to my site for example:
    http://download.com/file.zip to http://mysite.com/file.zip thanks....
  15. Filesharing
    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.
    By the way did I the other day req for language files to diffrent PHP scripts. I did investigate the
    rplys I did get, but my conclusion was that I might do it by myself, and I'm also almost
    finished with it. What I would like to say is that I don't do this just for my self, and when
    I'm finished would I of cause share it with me to others, and why not share it to other members
    of this board. I don't think that it would be the last time that I'm doing....

    1. Looking for make, members, web, site

See Also,

*SIMILAR VIDEOS*
Searching Video's for make, members, web, site
advertisement



How Do U Make Members Only Web-site

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com