Jump to content

Writing .php invite sytem, with invites


YOUAREtehSCENE

Recommended Posts

I`m trying to code an invite system based.

 

Would like to have it so that it's all in php of course

So where it would be like this

 

http://i33.tinypic.com/t5g3ty.jpg

OR

http://webscripts.softpedia.com/screenshots/Invite-Friends-23096.png

 

But, I would like it so that the person who gets the invite opens up there email

and there would be a link to there invite to be activated and it would have like a long random confirmation code

 

I was planning on using this

http://www.phpeasystep.com/phptu/24.html

please check this out. wondering if this would be easier, or useful

But, I want to have control in the database tables, to add more invites for people

 

On one of the DB tables, I'd like to have

the person who invited, the invited

 

Then maybe on the same table, or second I'd like to have a box where I can add invites

 

Thanks

Dave

 

Link to comment
https://forums.phpfreaks.com/topic/180075-writing-php-invite-sytem-with-invites/
Share on other sites

That is actually really easy. I will help you out with the random code:

 

<?
function createRandomCode($num){
//create an array of characters
$rand_array = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",1,2,3,4,5,6,7,8,9);

//initialize the string
$random_code = '';

//loop through the number that you wanted
for($i=0;$i<$num;$i++){
     $rand_num = rand(0,sizeof($rand_array));
     $random_code .= $rand_array[$rand_num];
}

return $random_code;

}
?>

 

Now all you have to do with that is call it with the length you want it. So you can do this:

$code = createRandomCode(20);
echo $code;

rad dude. thank you

did, you check out my pics that i left in the post also?

 

http://i33.tinypic.com/t5g3ty.jpg

if you check that out once again, it says "CLOSE" so when they click on invite it will drop down to the 3 boxes to enter info!

 

Now, this is what I wrote well i googled and grabbed others ideas.

script type="text/javascript">
<!--
function showhide(targetID) {
	//change target element mode
	var elementmode = document.getElementById(targetID).style;
	elementmode.display = (!elementmode.display) ? 'none' : '';
}

function changetext(changee,oldText,newText) {
	//changes text in source element
	var elementToChange = document.getElementById(changee);
	elementToChange.innerHTML = (elementToChange.innerHTML == oldText) ? newText : oldText;
}

function workforchange(targetID,sourceID,oldContent,newContent) {
	showhide(targetID);
	changetext(sourceID,oldContent,newContent);
}

// Cruft note: The content of "oldContent," the third argument of the
// workforchange() function, must match the existing content of the changer text.

// -->
</script>
		<a href="javascript:workforchange('p2','changer2','Invite','Close');" id='changer2'>Invite</a>
		<span id='p2' style='display:none'><br />
<form name="form1" method="post" action="signup_ac.php">
Username:
<input type="text" name="user" />
Password:
<input type="text" name="user" />
E-Mail:
<input type="text" name="user" />
<input type="submit" value="Submit" />
</form> </span>
</div>
</div>

 

Now, what you just wrote up for me. where the hell would I put this and shit. and how would the users know how many invites they got without having a number, and everyime they use an invite it would count down?

 

I'm so so so VERY VERY!! new @ this.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.