Jump to content


Photo

Help With Website


  • Please log in to reply
4 replies to this topic

#1 igi_smalls

igi_smalls
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 February 2006 - 04:32 PM

I am creating a website and I need the users to type in a special code, but each user will have a different code. I would like to know how can I make it, in php, that when the users type in the code, it takes them to their unique website. each user will have a different code and a different website that they will be pointed to when their code is entered.

How can this be done ? Please help. Needed Quikly!!

Mod Edit(shoz): Topic edited. Don't describe your problem as urgent etc. [a href=\"http://www.phpfreaks.com/forums/index.php?act=boardrules\" target=\"_blank\"]Board Guidelines[/a]

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 09 February 2006 - 04:54 PM

Create a MySQL table called CodeToSite with two columns, code, and site.

When you give someone a code, insert a row that links it to a site.

When they come to your site, look up the code in the table to find the site you should send them to.

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 09 February 2006 - 06:35 PM

I'm sure your table will be more complex, but that's the general idea. You have to be sure that your code is unique across all users -- there are many ways to do this, but usually some combination of random and user info works well. Of course, you can always check your "new" code against the existing ones, and make sure it's not there; alternatively, put a UNIQUE index on this column and check for errors.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 igi_smalls

igi_smalls
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 09 February 2006 - 11:03 PM

Hmm.. interesting, i dont know what you guys are talking about lol I am what you would call an XNoob (Extreme Newbie). Is there anyway else to do this and if the code is short, can someone write it for me PLEASE?

This is basically it :

[ TEXT BOX ] [ go ]

Inside the text box the user would type in their code, how do I make it so that each code sends the user to a different site? is there any way to do this in plain old html but without the codes being seen in the source code ??

#5 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 10 February 2006 - 09:05 AM

You can do that part in vanilla HTML, but you're not going to be able to "hide" anything in HTML/JS, so a DB is your best option. It's a good excercise in basic PHP/MySQL, so you should definitely give it a shot.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users