We are trying to complete / fix the below code, We cant seem to do the following.

  • Check if 'Check_Activation' is set to 'NULL' within the Database
  • IF value is NULL direct the user to one of the forms (1,2,3)
  • And finally if the 'Check_Activation' has already been activated and isn't 'NULL' prevent user from accessing one of the 3 forms.

I know its basicly there but we can't seem to figure out the final bug.

Please have a quick look at the code below and if anyone notices anything that isn't right please advice us.

http://pastebucket.com/27517 [CODE]
http://awkreativ.com/freelance/analogue/barrio_activation/ [WEBSITE]

<?php

    $username = $_POST['username'];
    $activation_code = $_POST['activation_code'];
    $activation_codeurl = $activation_code;
    $usernameurl = $username;

    $db_host = "localhost";
    $db_name = "aardvark";
    $db_use = "aardvark";
    $db_pass = "aardvark";

    $con = mysql_connect("localhost", $db_use, $db_pass);
    if (!$con){
        die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name, $con);

    $checkcustomer = mysql_query("SELECT `Check_Activation` FROM `members` WHERE `Username` = '".$username."' & `Activation` = '".$activation_code."'; ");

        $array = mysql_fetch_array($checkcustomer);
        if (is_null($array['Check_Activation']))  {
                $username = substr($username, 0, 1);
                if($username == '1') { 
                    $redirect_url='form-one.php?membernumber='.$usernameurl.'&activation_code='.$activation_codeurl;
                } elseif($username == '2') { 
                    $redirect_url='form-two.php?membernumber='.$usernameurl.'&activation_code='.$activation_codeurl;              
                } elseif($username == '3') { 
                    $redirect_url='form-three.php?membernumber='.$usernameurl.'&activation_code='.$activation_codeurl;
                }
                header("Location:". $redirect_url);
        } 
        else 
        {
    ?>

asked 06 Feb '14, 04:22

AWK's gravatar image

AWK
0112
accept rate: 0%

closed 06 Feb '14, 08:58

Mark%20Culp's gravatar image

Mark Culp
23.3k9132274

How is that question related to the SQL Anywhere database system?

(06 Feb '14, 05:20) Volker Barth

Agreed. This looks like this should be a PHP question... or at least direct it at a mysql or LAMP forum.

(06 Feb '14, 08:57) Mark Culp

The question has been closed for the following reason "Question is off-topic or not relevant" by Mark Culp 06 Feb '14, 08:58

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×47
×15

question asked: 06 Feb '14, 04:22

question was seen: 852 times

last updated: 06 Feb '14, 08:58