How to let User enter a Code and have it call a specific page.

Basically I would like a User to enter a code they have been given then when submitted it may bring them to your specific page. Hard eventually be hundreds of or so of the codes/pages.

Not really sure where to help start

It will involve PHP and MySQL (for the actual database).

You may not really have " pages"… your page are going to be a PHP script of which renders
the HTML and content based on the code. You need to describe more about
the users and what could happen. Do the users must be registered, do
they login Might a code be used over and over again What will the actual website be used for

Step 1:
Get started by describing the actual purpose, the way it’s purported to work, who are going to be using it,
how are going to using it (desktop PC, mobile app).

Layout a logical scheme on the information you need to keep track of.
and so on.

Measure 3:
Show about steps JUST ONE and 2… when what you’re doing is secret,
you’ll have to rent a programmer that will help you with the development within your site.
If you’re able to tell us this details, we can at the very least give you a good place to start,
even when you have to hire someone, as a minimum you’ll know points to tell them.

A customer will be given a code combined with product they got. They will then go to the website and enter the program code. Once entered it will display some textual info for them. I need to also display an error message if this code is mistaken. There will be repeated codes so are going to used more in comparison with once. it will be to get a desktop pc not mobile at the moment. I would prefer to just keep track of how many occasions the code can be used.

Why input the code

When done properly, from a DB as recommended, emails can be generated on the DB and a link using the code embeded in it will be sent to we, of course you may need a form to fall to in case the good news is problem with purchasers email. Then they can enter the code manually.

Avoid, you need a DB to get this done right… Code… Written content… All in identical table, then just a couple of pages and a few simple queries… Maybe a logging table to account for how many times a precise code has been viewed… From when… Etc.

Based on your hosting provider and what on earth is available, it can be done in php or perhaps asp or asp. net sale.

Actually for what you’re discussing… Maybe an hour or two’s moment for someone which knows what these are doing.

I’m thinking it’s a redemption/coupon code, which could must be tracked in aggregate.

For a second time, as others have pointed out, you do this that has a server-side programming dialect (ASP, ASP. net sale, PHP, etc. ) and your choice of database (MySQL, SQL Server, Access, etc. ) You will need a page to consider the form entry and one to display the particular textual information.

The other thing you may need is a version of a bot blocking, to avoid people repeatedly trying to hack your form and find the codes… unless the power isn’t worth everything financially.

Factors quick one MY PARTNER AND I built

Install Ruby and make sure that Rubygems was selected through the installation. Also install Postgres with the database (I realize it’s overkill, but I been having difficulty with SQLite, and I come across Postgres is fairly well utilized in the Ruby world)

Type these into the unit:

gem installation sinatra
gem installation data_mapper
gem installation dm-postgres-adapter

In postgres (you code utilize GUI interface, pgadmin) you will need to create a list named sinatra_coupon_development

Produce a file called CouponApp. rb and past these (enter in the right password for postgres)

require " rubygems"
necessitate " sinatra/base"
necessitate " data_mapper"

DataMapper:: setup(: default, " postgres: //postgres: passwordlocalhost/sinatra_coupon_development" )

elegance CouponCode
include DataMapper:: Resource
property: id, Serial
house: code, String
house: body, Text

DataMapper. finalize

CouponCode. auto_upgrade!

elegance CouponApp < Sinatra:: Trust
get '/entercode' carry out
erb: enter

post '/entercode' carry out
coupon = CouponCode. all(: program code. like => " %#params: coupon" ). primary
if coupon! = zero
erb: results
altogether different
erb: enter

CouponApp. work! 

Create a folder named views and produce a file named input. erb

< form method='post'>
< fieldset>
< label for='coupon'> Coupon: < /label>
< feedback class='test' name='coupon' type='text' /> < br />
< feedback class='button' type='submit' value='Send' />
< /fieldset>
< /form> 

Create a different file name outcome. erb

< h2> You could have entered the promotion " < %= discount. code %> " < /h2>
< p> < %= discount. body %> < /p> 

Go into PGAdmin to generate a coupon admittance.

instruction online the console, type

CouponApp. rb

Then got into your browser along with type " localhost: 4567/entercode" and you also are done… ant.

This would provide you with an idea why you need to go through to make an application like this. There are security vulnerabilities that must be solved such because SQL injections. There is a lot you have to master before you apply that you are thinking of.

This entry was posted in Web Design and tagged , , , , , , , , , , , , . Bookmark the permalink.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *