Jump to content

How to start building an invite only system


richarro1234

Recommended Posts

Hey there,

 

Im wondering how to start building an invite only system.

i have a few ideas on how to start but not sure if any of them are right or whether they would work.

can someone help me get started and tell me how i could implement it into my website before i open it up for alpha release.

 

Thanks in advance

Rich

Link to comment
Share on other sites

sorry, sure.

 

well its like what gmail had when they first started up.

basically the current user list (my friends i have who are helping me code it and test for bugs) enter an email addres of a friend they want to sign-up to the website,

then the user receives an email with a link in there to sign up using a generated code.

which then gives them full access to the site.

 

Thanks

Rich

Link to comment
Share on other sites

you can just make a form where a user can enter a friends e-mail, then click submit. Then have some PHP to insert a random string into your database and the users id, and a link is provided to a separate PHP page called something like referal.php and the link e-mailed is... www.website.com/referal.php?link=<?php echo $row['link']; ?> or register.php whatever you need to use it for. Then when that person you send it to clicks it, they go to that page, and on that page you can select the link from the database to make sure it exists and do whatever you need to now that the person has been refered. Then delete the random string/link from the database.

Link to comment
Share on other sites

hey all,

i cant seem to get the code working to hide it, im not sure if i have it wright or not, its worked before one other stuff, but it still shows the form.

 

the idea is that it checks the URL for the useremail, id and hash if all 3 match then it shows the form, if not then it shows an error.

 

This is the code i have for that bit:

<?
if ($inv['userid'] != $id && $inv['useremail'] != $useremail && $inv['hash'] != $hash){ ?>
!!ERROR!!
<?} else { ?>
<? require("inc/signup.php");?>
<?}?>

 

Thanks

Rich

Link to comment
Share on other sites

I was building an invite system

But I wanted to be able to track the invites (user invites and open invites)

 

So I thought about javing a db with a number of fields.

 

I think my fields were like

id INT AUTO_INCREMENT

code char(32) NOT NULL

added TIMESTAMP

start_date TIMESTAMP

end_date TIMESTAMP

amount TIMESTAMP default 1

count int

referrer int

 

the code was an md5 code.

added is when the invite code was created

start/end dates how long the invite code is good for (0 out for forever)

amount number of invites allowed with this code

count is the amount counter (or if single invite, if it has been used already)

referrer is the user id who created the invite

 

if referrer was specifies amount is 1 and I gave them 30 days to respond

but if I wanted to, I cud create a code and post it on a board as a promotion, this is where amount is used.

 

the userbase I did add a field of invites, which was earned through board activities (or given by other users).

which was just a number of invites they have, u can make this refresh after a period of time instead.

 

For me, when starting any project. Ya have to look at how ya want it to work, and look at the data ya will need.

Work from the database first, then work on the code.

Anyways good luck with this :)

 

 

Link to comment
Share on other sites

darksuperhero:

here is the code

include("data.php");
//include("funktioner.php");
mysql_connect($server,$anvandare, $losen);
mysql_select_db($databas);
$query1 = mysql_query("SELECT * from richspri_social.invites where userid = '$id' && useremail = '$useremail' && hash = '$hash'") or exit( mysql_error() );
$inv = mysql_fetch_array($query1);

 

laffin:

ok thanks, well i have the db all sorted, im just trying to get that bit working so that i can hide the form if someone is trying to sign up normally or trying to guess information to let them signup.

 

Thanks

rich

Link to comment
Share on other sites

Well this logic don't make send

?
if ($inv['userid'] != $id && $inv['useremail'] != $useremail && $inv['hash'] != $hash){ ?>
!!ERROR!!
<?} else { ?>
<? require("inc/signup.php");?>
<?}?>

the first if statement, everything must fail to get an error.

Which shud be if anyone of them fails than error out.

the way to do this, is to check if they all pass.

than throw a !

 

which does wut ya want, if any field fails

if (!($inv['userid'] == $id && $inv['useremail'] == $useremail && $inv['hash'] == $hash)){ ?>

 

see the differences now :) Hope that helps

 

Link to comment
Share on other sites

hey thanks for that laffin, it now doesnt show up, if theres nothing in the address bar.

but if i put anything else in there, then it works,

 

so, if i put signup.php?id=1 then the whole form shows up.

rather then it bein signup.php?userid=1&useremail=<email>&hash=<hashkey>

 

Rich

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.