The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
How do you make a referral system on US? - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10) +--- Thread: How do you make a referral system on US? (/showthread.php?tid=621) |
How do you make a referral system on US? - lilpanda - 07-01-2017 How would you allow users to make their referral link and when a unique ip accesses that and signs up the user of the referral link receives +1 in their payout column in the database. How do you make a referral system on US? - mudmin - 07-02-2017 Well...Hmm. Let's work on this. This is kind of a basic overview of how I would walk through that logic to get you started There is a tool in userspice called Input::get which will probably be your friend here. What if you made a page called refer.php Have that page look for the referrer's username in the link. So let's say my link looked like... https://userspice.com/refer.php?id=mudmin Then maybe you would add 2 columns to the users table. Code: payouts Code: payouts_paid refer.php would look something like this... Code: $refer = Input::get('id'); //id is the get variable in the link Then you want to check the database to see if that variable is legit. Code: $legitQ = $db->query("SELECT * FROM users WHERE username = ?",array($refer); Code: $legitC = $legitQ->count(); Code: if($legitC < 1){ Code: echo "Invalid referral link."; Code: }else{ $ Code: legit = $legitQ->first(); $oldPayout = $legit->payouts; //how many payouts DID they have Code: $newPayout = $oldPayout + 1; Code: $db->update("users",$legit->id,'payouts'=>$newPayout); //do whatever else you want to do Code: } How do you make a referral system on US? - lilpanda - 07-03-2017 ok thank you very much! |