Building a little cool masking tool using PHP, HTML, or something!

Hi,

So here is the scenario: I'm trying to build a website that allows a user to supply a URL as a result, builds a blank webpage at the backend that is used to redirect the user to the URL they provided and provides the user with the new url. So for example, if the user goes to my website (http://www.cebdata.com/maskit/) and types in lets say http://www.amazon.com/ into a text field or something and then the user presses submit, the thank you page comes up with a url something like http://www.executiveboard.com/survey123.html.

Now, if I send http://www.executiveboard.com/survey123.html the link to anyone, they are auto-redirected to www.amazon.com.

An alternative way is to somehow provide a masked url by typing in HTML into Outlook 2002 or 2003 but I can't seem to figure that out.

ANY ANY help is sincerely appreciated. I really need this to work to help the integrity of our marketing and sales efforts for senior management.
piyushdabombAsked:
Who is Participating?
 
QPRConnect With a Mentor Commented:
the blankid could simply be an incrementing number in the database.
In access this field is called autonumber.
So when you insert a new URL the autonumber field is auto populated and will increase by 1 each time you put another in.

Then you have (for my example) as asp page. You would need to Google how to set up the connection string to your Access DB.
Lets assume that this example os for the very first URL ever provided and the page is called Goto.asp
You would send someone a link such as www.yoursite.com/Goto.asp?ID=1

Then in your Goto.asp page you would retrieve the URL associated with the ID 1
Once you have this and have put it into a variable (hint) myVar = rs("url")
You redirect the user to that url with this tag in the head of the page...

<%
response.redirect(myVar)
%>

If you are new to db driven sites then the above may seem daunting but give it a go. It's pretty easy once you get your head around it. There are probably better ways to achieve it by using asp.net or other but asp has a fairly gentle learning curve.

Some links to help.
http://www.codeproject.com/KB/database/accessdb.aspx
Connection string to Access and how to return data from the db

http://www.w3schools.com/asp/default.asp
0
 
QPRCommented:
Are you planning to use a database in this scenario?
One thought maybe to have a table in your DB that has 2 (at least) columns. LinkID and URL.
The user types the URL into the text field and then this is inserted into the db alongside an ID.
The next page would feature the LinkID in the querystring.

So the initial URL may look like  http://www.executiveboard.com/goto.asp?LinkID=12345
12345 would be the LinkID (sorry I don't know PHP)
Then when someone clicks on that link your code would look up the URL associated with that LinkID and redirect them to that link.

You could "select" the URL based on the LinkID and then write this value into a response.redirect
0
 
piyushdabombAuthor Commented:
Sure, I'm okay with throwing in a Database. Note that I have VERY limited database experience and therefore I might just access to start off with.

If I were to do this, how would i get this started? Please advise! How can I auto generate this 'blank' ID?

What is response.redirect? Could you provide a sample example of the code I would need to write to achieve tis?
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
scrathcyboyCommented:
Your question doesn't make a lot of sense, because you will actually have to OWN the domain --
 http://www.executiveboard.com/survey123.html.
and the survey page will have to be a REAL web page with an HTTP redirect in the main HTML page.  I don't see how this will ever work unless you OWN that domain, and manually create the pages you describe.
0
 
piyushdabombAuthor Commented:
I own the domain! The domain is www.cebdata.com

I was merely using http://www.executiveboard.com as an example
0
 
scrathcyboyCommented:
So --
the survey page will have to be a REAL web page with an HTTP redirect in the main HTML page. You will have to manually create the pages you describe, unless you develop a PHP script to make the pages for you, in which case you have a form with the link, it is sent to a PHP script, it creates a new page and puts an HTTP request for redirect into the header, and saves the page.

I would not do this for all the tea in China, however.  All a spammer or trojan writer has to do is discover your page, and he could create 1000s of pages using their automated software, all pointing to sites that load viruses and trojans on people's systems.  In a single blow, your site could be the Grand Central launch point for 1000s of virus pages across the web .. and when they track you down .... ooops.

BTW, these low-lifes are tractoring the web each day looking for forms to fill in, and within about 2 weeks of you putting it up, it will be found by all the spammers and virus writers you never wanted to know.  It may sound dramatized,  but it happens to people all the time on the WWW.
0
 
piyushdabombAuthor Commented:
So what do you recommend I do then...? I need to make our client experience as smooth as possible!
0
 
QPRCommented:
add a "captcha" control so that only humans can submit the form
0
 
piyushdabombAuthor Commented:
Do I necessarily have to build the page? Can't I use some sort of database and store the original link and the final link in there?

There HAS to be a way to do this. Someone help me figure this out :(
0
 
QPRCommented:
Well you started the question with "i'm trying to build a web site" so a page can't be too hard :)
But yes you do have to build a page if you want to interact with a person (other than use a webservice).
That said the page would probably amount to about 10 lines and would need no design as the user would never actually see it.
What you are wanting to do is incredibly simple and is outlined in the coments above.
0
 
piyushdabombAuthor Commented:
I was reading up on your comments again and 'm up on giving it a try.

I'll keep you posted.
0
 
piyushdabombAuthor Commented:
QPR,

I'm going slowly at this but in the meantime PLEASE check this out:

http://www.cebdata.com/SurveyLinks/RedirectorForm.htm

If a user types in a URL, the response comes out as you can see in the .asp page

How do I get a the SOURCE URL displayed from the form on the asp page? I can't seem to figure this out. I am able to connect to the database and display the ID # the way I wanted to. Should I just paste the original source into the database and retrive it as well?
0
 
piyushdabombAuthor Commented:
I need help. I'm further but not quite there.

If you go to:

http://www.cebdata.com/SurveyLinks/RedirectorForm.htm

Supply a source url and click submit, you'll get a masked URL you can go to. If you then type in the masked URL, another .asp page loads up but apparently, it doesn't redirect me to the source page. Any clue? Please HELP Me with this. I'm SOO close!

It has to do with this line:

<meta http-equiv="refresh" content="5;url="" & <%=rsGetURL("SourceURL")%> & "">

Attached is the file that I'm attempting to redirect with.

Let me know your thoughts!
0
 
QPRCommented:
No attachment.

Everything works fine for me. I pasted the masked URL into the addres bar and there I went.
Note you have to include the http:// bit in the text box else it will act as a link within the site e.g. http://www.cebdata.com/surveylinks/surveylink.asp?ID=47/www.google.com

If using asp you can do away with the <meta http-equiv="refresh" content="5;url="" & <%=rsGetURL("SourceURL")%> & "">
 and just use
<%
response.redirect(rsGetURL("SourceURL"))
%>

0
 
piyushdabombAuthor Commented:
QPR,

Your logic gave me all the power I needed to get this going for me in ASP. I'm starting to enjoy ASP but one issue... PEOPLE ARE ON ASP.NET! I tried to play around with asp.net and its a lot more confusing for me than asp is. I do know a little bit of vb(i'm all vba) but I couldn't seem to get test.aspx right.

Should I move to asp.net just yet or should I feel out asp? The solution I was working with works very well and thanks a lot.

Regarding the asp piece, can we use for loops to parse through a string? In VB, I can use the following:

If Left(sURL,7) = "http://" then
'Save sURL in Access DB
elseif Left(sURL,3) = "www" then
'sURL = http:// & sURL
'Save sURL in Access DB
else
'sURL = "http://www."
'Save sURL in Access DB

Let me know your thoughts. I can even use a for loop.
0
 
piyushdabombAuthor Commented:
It is a good solution that forces the user to think through the given logic and implement the technology. Great learning curve!
0
 
QPRCommented:
I'd get a base handle on asp first as it requires more coding by hand which will give you insight into the response/request side of things.
This way when you move to asp.net you'll have a better understanding of what is going on under the bonnet.
That plus your VBA skills mean you should be flying.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.