09-09-2017, 12:24 PM
It depends on how secure you want it. If you're doing this kind of modification, you're going to want to copy your join form over to the usersc folder.
Change line 24 to
This will stop your modifications from getting overwritten by updates.
Ok...now I will give you the simplest possible version...we will use the user_id of an existing user. Note that if you're going to do this one, you might want your user id's to be higher than just 1,2,3. Don't ever change user number 1...just don't use that one for referrals.
To bump up your user ids by default, go into phpmyadmin, click on your database, click the sql, and type
Hit go. That will start user numbers at 10,000. Then just leave user 1 alone. Maybe delete user 2.
Ok, so back to usersc/join.php
You will make your referral links (note the c) mysite.com/usersc/join.php?refid=10000
Change line 29, which is just to
//looking for users with the ref code
Now you could get more creative where instead of using the user id, you could generate a random number for each user and put it somewhere in their users table, but this will get you started.
Change line 24 to
Code:
<?php require_once '../users/init.php'; ?>
This will stop your modifications from getting overwritten by updates.
Ok...now I will give you the simplest possible version...we will use the user_id of an existing user. Note that if you're going to do this one, you might want your user id's to be higher than just 1,2,3. Don't ever change user number 1...just don't use that one for referrals.
To bump up your user ids by default, go into phpmyadmin, click on your database, click the sql, and type
Code:
ALTER TABLE users AUTO_INCREMENT=10000
Ok, so back to usersc/join.php
You will make your referral links (note the c) mysite.com/usersc/join.php?refid=10000
Change line 29, which is just
Code:
<?php
Code:
<?php $ref = Input::get('refid');
Code:
$check = $db->query("SELECT id FROM users WHERE id = ?",array($ref))->count();
Code:
if ($check < 1){Redirect::to('mydomain.com/index.php?err=Sorry.+Invalid+referral+code.');
Code:
}
Now you could get more creative where instead of using the user id, you could generate a random number for each user and put it somewhere in their users table, but this will get you started.