Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member neicawse's Avatar
    Join Date
    Oct 2011
    Location
    Plymouth
    Posts
    54
    Member #
    29687
    Liked
    6 times
    Hi guys, i have a project I'm having trouble with, and was hoping someone could help.

    the brief:

    the user has a product, that product has a unique code [ID]

    the user can go to the website and enter that [ID] into a inputbox,

    that [ID] is connected to an entry in the database and displays that records information, which is simply a link to the location that a pdf is located.

    [straight forward so far]

    now,

    ive made a very simple process that allows this, but the unique codes [ID], need to be generated and stored in the database, they will then be printed on the products.

    So I need a method of generating say 100,000 serial keys, import them into the database, and add a validator to the inputbox so if the user enters a non valid serial they will be told.

    heres what I have

    tracking.php
    <form method="post" action="search.php?go" id="searchform">
    <input class="inputfild" type="text" name="ID">
    <input class="submit_btn" type="submit" name="submit" value="Search">
    </form>

    search.php
    <?php
    if(isset($_POST['submit'])){
    if(isset($_GET['go'])){
    if(preg_match("/^[ 0-9]+/", $_POST['ID'])){
    $ID=$_POST['ID'];
    //connect to the database
    $db=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
    //-select the database to use
    $mydb=mysql_select_db("database");
    //-query the database table
    $sql="SELECT ID, Link FROM table WHERE ID LIKE '%" . $ID. "%' ";
    //-run the query against the mysql query function
    $result=mysql_query($sql);
    //-create while loop and loop through result set
    while($row=mysql_fetch_array($result)){
    $Link=$row['Link'];
    $ID=$row['ID'];
    //-display the result of the array



    echo "<p>The Serial Number for your Product<br />has been Validated as genuine<br /> by XXX Limited<br /><br /> <img src=\"images/Pass.jpg\"><br /><br /> " .$Link ."</p>\n";

    }
    }
    else{
    echo "<p>The Serial Number for your Product<br />has been Verified as Non Genuine!<br />by XXX Limited<br /><br /> <img src=\"images/Failed.jpg\"><br /><br />For further enquiries please contact XXX Ltd<br /><br />Email : Info@XXX.co.uk</p>";
    }
    }
    }
    ?>

    I have 3 records, ID's= 1, 2 & 3, testing reveals;

    entering the correct ID gives the genuine result
    entering a non-existant ID, (ie 4) gives a blank result
    Not have 0-9 as the first character ( if(preg_match("/^[ 0-9]+/", $_POST['ID'])){) then the ID is invalid and give the non-genuine result - this code is what needs to be the validator

    Please help, if that makes sense......

    thanks

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Give an example of a key.


  4. #3
    Member neicawse's Avatar
    Join Date
    Oct 2011
    Location
    Plymouth
    Posts
    54
    Member #
    29687
    Liked
    6 times
    they previously wanted http://www.serial-generator-pro.com/ to create the serials, the validation they use is only for a .net language and uses a .dll files for validation. It wont work with php on my linux hosting,

    example serials they gave me :

    2224JA9D9Y9J
    2229S4S64JCY
    222C846N86MU
    222Q2TMSRT9A

    they dont all start with 222, but they obey some type of authentication


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:41 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com