richarro1234 Posted April 12, 2009 Share Posted April 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/ Share on other sites More sharing options...
MasterACE14 Posted April 12, 2009 Share Posted April 12, 2009 invite as in e-mail invites? can you explain abit more? Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-807706 Share on other sites More sharing options...
richarro1234 Posted April 12, 2009 Author Share Posted April 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-807711 Share on other sites More sharing options...
MasterACE14 Posted April 12, 2009 Share Posted April 12, 2009 ah, a referral type system. Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-807713 Share on other sites More sharing options...
richarro1234 Posted April 12, 2009 Author Share Posted April 12, 2009 yea pretty much. Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-807715 Share on other sites More sharing options...
MasterACE14 Posted April 12, 2009 Share Posted April 12, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-807736 Share on other sites More sharing options...
richarro1234 Posted April 12, 2009 Author Share Posted April 12, 2009 ok thanks, will give it ago, if i get stuck on anything i will post for help Thanks Rich Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-807859 Share on other sites More sharing options...
richarro1234 Posted April 12, 2009 Author Share Posted April 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-808181 Share on other sites More sharing options...
DarkSuperHero Posted April 12, 2009 Share Posted April 12, 2009 where is the data for your $inv array comming from? How are you setting those values ? Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-808197 Share on other sites More sharing options...
laffin Posted April 12, 2009 Share Posted April 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-808198 Share on other sites More sharing options...
richarro1234 Posted April 12, 2009 Author Share Posted April 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-808202 Share on other sites More sharing options...
laffin Posted April 12, 2009 Share Posted April 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-808207 Share on other sites More sharing options...
richarro1234 Posted April 13, 2009 Author Share Posted April 13, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/153698-how-to-start-building-an-invite-only-system/#findComment-808593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.