Jump to content

mikebyrne

Members
  • Posts

    780
  • Joined

  • Last visited

Posts posted by mikebyrne

  1. Im noe getting the error

     

     

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\confirm.php on line 24

     


    <?php
    include('config.php');

    $passkey=$_GET['passkey'];

    // Passkey that got from link
    ## added here
    if (!isset($_GET['passkey']))

    {
    echo "Error here :: PASSKEY NOT FOUND ";
    }
    else
    {

    ## table name
    $tbl_name="temp_users";

    // after connecting succesfully:
    $query = "SELECT * FROM '$tbl_name'";
    $result = mysql_query($query);

    // while there is a result, fetch it into an array...
    while ($row = mysql_fetch_array($result))
    {
    echo "$row[address]";
    echo "$row[address1]";

    }
    }
    ?>
    [/Code]

     

    ITS MY BIRTHDAY AND WOULD LOVE TO GET THIS WORKING!!!!!!!    :)

  2. So the top HTML is one page, and the signup_ac.php is another page, but is the PHP part of the code you posted?

     

    And all works fine as two seperate files?

     

    Yes the HTML is from one page where the info was passed to the 2nd page signup_ac.php. All was working fine as two seperate pages. I was just wondering if I could combine them onto one page?

  3. I'm trying to combine my start & signup page into the one file but It keeps causeing Apachi to crash. Is there a way to do this??

     

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Sign UP</title>
    </head>
    
    <body>
    <td><form name="form1" method="post" action="signup_ac.php">
      <table align="center">
        <tr valign="baseline">
          <td nowrap align="right">Name:</td>
          <td><input type="text" name="name" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Address:</td>
          <td><input type="text" name="address" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Address1:</td>
          <td><input type="text" name="address1" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Address2:</td>
          <td><input type="text" name="address2" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Address3:</td>
          <td><input type="text" name="address3" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Address4:</td>
          <td><input type="text" name="address4" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">County:</td>
          <td><input type="text" name="county" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Zip:</td>
          <td><input type="text" name="zip" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Telephone:</td>
          <td><input type="text" name="telephone" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Email:</td>
          <td><input type="text" name="email" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Username:</td>
          <td><input type="text" name="username" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Password:</td>
          <td><input type="password" name="password" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right"> </td>
          <td><input type="submit" value="Insert record"></td>
        </tr>
      </table>
      <input type="hidden" name="MM_insert" value="form1">
    </form>
    <p> </p>
    </body>
    </html> 
    
    <?php
    include('config.php');
    
    // table name
    $tbl_name=temp_users;
    
    // Random confirmation code
    $confirm_code=md5(uniqid(rand()));
    
    // values sent from form
    $name=$_POST['name'];
    $address=$_POST['address'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $address3=$_POST['address3'];
    $address4=$_POST['address4'];
    $county=$_POST['county'];
    $zip=$_POST['zip'];
    $telephone=$_POST['telephone'];
    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    
    
    // Insert data into database
    $sql="INSERT INTO $tbl_name(confirm_code, name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result=mysql_query($sql)or die(mysql_error());
    
    // if suceesfully inserted data into database, send confirmation link to email
    if($result){
    
    // ---------------- SEND MAIL FORM ----------------
    
    // send e-mail to ...
    $to=$email;
    
    // Your subject
    $subject="Your confirmation link here";
    
    // From
    $header="from: postmaster@localhost <postmaster@localhost>";
    
    // Your message
    $message="Your Comfirmation link \r\n";
    $message.="Click on this link to activate your account \r\n";
    $message.="http://localhost/confirm.php?passkey=$confirm_code";
    
    // send email
    $sentmail = mail($to,$subject,$message,$header);
    
    }
    
    // if not found
    else {
    echo "Not found your email in our database";
    }
    
    // if your email succesfully sent
    if($sentmail){
    echo "Your Confirmation link Has Been Sent To Your Email Address.";
    }
    else {
    echo "Cannot send Confirmation link to your e-mail address";
    }
    
    ?>
    

  4. I changed your code to

     

    <?php
    include('config.php');
    
    $passkey=$_GET['confirm_code'];
    
    // Passkey that got from link
    ## added here
    if (!isset($_GET['confirm_code']))
    
    {
    echo "Error here :: PASSKEY NOT FOUND ";
    }
    else
    {
    
    ## table name
    $tbl_name="temp_users";
    
    // after connecting succesfully: 
    $query = "SELECT * FROM '$tbl_name'"; 
    $result = mysql_query($query); 
    
    // while there is a result, fetch it into an array... 
    while ($row = mysql_fetch_array($result)) 
    { 
    echo "$row[address]"; 
    echo "$row[address1]"; 
    
    } 
    }
    ?> 
    

     

    Now getting the error

     

    Error here :: PASSKEY NOT FOUND

  5. Yeah its exits here's the SQL

     

    CREATE TABLE `temp_users` (

      `confirm_code` varchar(65) NOT NULL default '',

      `name` varchar(65) NOT NULL default '',

      `address` varchar(65) NOT NULL default '',

      `address1` varchar(65) NOT NULL default '',

      `address2` varchar(65) NOT NULL default '',

      `address3` varchar(65) NOT NULL default '',

      `address4` varchar(65) NOT NULL default '',

      `county` varchar(25) NOT NULL default '',

      `zip` varchar(65) NOT NULL default '',

      `telephone` varchar(25) NOT NULL default '',

      `email` varchar(25) NOT NULL default '',

      `username` varchar(65) NOT NULL default '',

      `password` varchar(15) NOT NULL default ''

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

     

     

     

  6. Here's my output:

     

    I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS 1Your account has been activated

     

    from this code:

     

    <?php
    include('config.php');
    
    // Passkey that got from link
    ## added here
    if (isset($_GET['passkey']))
    {
    $passkey=$_GET['passkey'];
    } 
    else
    {
    echo "Error here :: PASSKEY NOT FOUND ";
    }
    
    ## table name
    $tbl_name="temp_users";
    
    // Retrieve data from table where row matchs this passkey
    $sql1="SELECT * FROM $tbl_name WHERE confirm_code='$passkey'";
    $result1=mysql_query($sql1) or die(mysql_error());
    
    // If successfully queried
    if($result1)
    {
    // Count how many row has this passkey
    $count=mysql_num_rows($result1);
    ## again addeded here
    echo "I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS  ".$count;
    ##
    // if found the passkey in the database, retrieve data from table "temp_users"
    ## ARE YOU SURE YOU ARE GETTING ONLY ONE RESULTS 
    if($count > 0) // i changed here.........
    {
    $rows=mysql_fetch_array($result1);
    
    $name=$_POST['name'];
    $address=$_POST['address'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $address3=$_POST['address3'];
    $address4=$_POST['address4'];
    $county=$_POST['county'];
    $zip=$_POST['zip'];
    $telephone=$_POST['telephone'];
    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    
    $tbl_name2="users";
    
    echo $address1;
    echo $address2;
    echo $address3;
    echo $address4;
    
    // Insert data that retrieves from "temp_users" into table "users"
    
    $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result2=mysql_query($sql2) or die(mysql_error());
    }
    
    // if not found passkey, display message "Wrong Confirmation code"
    else {
    echo "Wrong Confirmation code";
    	 }
    
    // if successfully moved data from table"temp_users" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
    if($result2)
    {
    
    echo "Your account has been activated";
    // Delete information of this user from table "temp_users" that has this passkey
    $sql3="DELETE FROM $tbl_name WHERE confirm_code = '$passkey'";
    $result3=mysql_query($sql3) or die(mysql_error());
    
    }
    
    }
    ?> 
    

     

    So i presume the varibles aren't beeing carried

     

    they work fine here though

     

    <?php
    include('config.php');
    
    // table name
    $tbl_name=temp_users;
    
    // Random confirmation code
    $confirm_code=md5(uniqid(rand()));
    
    // values sent from form
    $name=$_POST['name'];
    $address=$_POST['address'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $address3=$_POST['address3'];
    $address4=$_POST['address4'];
    $county=$_POST['county'];
    $zip=$_POST['zip'];
    $telephone=$_POST['telephone'];
    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    
    
    // Insert data into database
    $sql="INSERT INTO $tbl_name(confirm_code, name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result=mysql_query($sql)or die(mysql_error());
    
    // if suceesfully inserted data into database, send confirmation link to email
    if($result){
    
    // ---------------- SEND MAIL FORM ----------------
    
    // send e-mail to ...
    $to=$email;
    
    // Your subject
    $subject="Your confirmation link here";
    
    // From
    $header="from: postmaster@localhost <postmaster@localhost>";
    
    // Your message
    $message="Your Comfirmation link \r\n";
    $message.="Click on this link to activate your account \r\n";
    $message.="http://localhost/confirm.php?passkey=$confirm_code";
    
    // send email
    $sentmail = mail($to,$subject,$message,$header);
    
    }
    
    // if not found
    else {
    echo "Not found your email in our database";
    }
    
    // if your email succesfully sent
    if($sentmail){
    echo "Your Confirmation link Has Been Sent To Your Email Address.";
    }
    else {
    echo "Cannot send Confirmation link to your e-mail address";
    }
    
    ?>
    
    

  7. I get the following error when I click on my confirmation email

     

    Unknown column '67ea431d7b9cdba28d88526a243a60ac' in 'where clause'

     

    The '67ea431d7b9cdba28d88526a243a60ac' refers to a randomly generated key (passkey) but cant figure out why im getting this error

     

    The code i have is:

     

    <?php
    include('config.php');
    
    // Passkey that got from link
    ## added here
    if (isset($_GET['passkey']))
    {
    $passkey=$_GET['passkey'];
    } 
    else
    {
    echo "Error here :: PASSKEY NOT FOUND ";
    }
    
    ## table name
    $tbl_name="temp_users";
    
    // Retrieve data from table where row matchs this passkey
    $sql1="SELECT * FROM $tbl_name WHERE confirm_code={$passkey}";
    $result1=mysql_query($sql1) or die(mysql_error());
    
    // If successfully queried
    if($result1)
    {
    // Count how many row has this passkey
    $count=mysql_num_rows($result1);
    ## again addeded here
    echo "I HAVE REACHED HERE, RESULT WAS SUCCESSFUL AND TOTAL ROWS  ".$count;
    ##
    // if found the passkey in the database, retrieve data from table "temp_users"
    ## ARE YOU SURE YOU ARE GETTING ONLY ONE RESULTS 
    if($count > 0) // i changed here.........
    {
    $rows=mysql_fetch_array($result1);
    $name=$_POST['name'];
    $address=$_POST['address'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $address3=$_POST['address3'];
    $address4=$_POST['address4'];
    $county=$_POST['county'];
    $zip=$_POST['zip'];
    $telephone=$_POST['telephone'];
    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    
    $tbl_name2="users";
    
    // Insert data that retrieves from "temp_users" into table "users"
    
    $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result2=mysql_query($sql2) or die(mysql_error());
    }
    
    // if not found passkey, display message "Wrong Confirmation code"
    else {
    echo "Wrong Confirmation code";
    	 }
    
    // if successfully moved data from table"temp_users" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
    if($result2)
    {
    
    echo "Your account has been activated";
    // Delete information of this user from table "temp_users" that has this passkey
    $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
    $result3=mysql_query($sql3) or die(mysql_error());
    
    }
    
    }
    ?> 
    

  8. My confirm.php looks like this but I'm still getting the blank screen

     

    <?php
    include('config.php');
    
    // Passkey that got from link
    $passkey=$_GET['passkey'];
    
    $tbl_name="temp_users";
    
    // Retrieve data from table where row matchs this passkey
    $sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";
    $result1=mysql_query($sql1);
    
    // If successfully queried
    if($result1){
    
    // Count how many row has this passkey
    $count=mysql_num_rows($result1);
    
    // if found the passkey in the database, retrieve data from table "temp_users"
    if($count==1){
    
    $rows=mysql_fetch_array($result1);
    $name=$_POST['name'];
    $address=$_POST['address'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $address3=$_POST['address3'];
    $address4=$_POST['address4'];
    $county=$_POST['county'];
    $zip=$_POST['zip'];
    $telephone=$_POST['telephone'];
    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    
    $tbl_name2="users";
    
    // Insert data that retrieves from "temp_users" into table "users"
    
    $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result=mysql_query($sql2) or die(mysql_error());
    }
    
    // if not found passkey, display message "Wrong Confirmation code"
    else {
    echo "Wrong Confirmation code";
    }
    
    // if successfully moved data from table"temp_users" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
    if($result2){
    
    echo "Your account has been activated";
    
    // Delete information of this user from table "temp_users" that has this passkey
    $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";
    $result3=mysql_query($sql3);
    
    }
    
    }
    ?> 
    

  9. <?php
    include('config.php');
    
    // table name
    $tbl_name=temp_users;
    
    // Random confirmation code
    $confirm_code=md5(uniqid(rand()));
    
    // values sent from form
    $name=$_POST['name'];
    $address=$_POST['address'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $address3=$_POST['address3'];
    $address4=$_POST['address4'];
    $county=$_POST['county'];
    $zip=$_POST['zip'];
    $telephone=$_POST['telephone'];
    $email=$_POST['email'];
    $username=$_POST['username'];
    $password=$_POST['password'];
    
    
    // Insert data into database
    $sql="INSERT INTO $tbl_name(confirm_code, name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result=mysql_query($sql)or die(mysql_error());
    
    // if suceesfully inserted data into database, send confirmation link to email
    if($result){
    
    // ---------------- SEND MAIL FORM ----------------
    
    // send e-mail to ...
    $to=$email;
    
    // Your subject
    $subject="Your confirmation link here";
    
    // From
    $header="from: postmaster@localhost <postmaster@localhost>";
    
    // Your message
    $message="Your Comfirmation link \r\n";
    $message.="Click on this link to activate your account \r\n";
    $message.="http://localhost/confirm.php?passkey=$confirm_code";
    
    // send email
    $sentmail = mail($to,$subject,$message,$header);
    
    }
    
    // if not found
    else {
    echo "Not found your email in our database";
    }
    
    // if your email succesfully sent
    if($sentmail){
    echo "Your Confirmation link Has Been Sent To Your Email Address.";
    }
    else {
    echo "Cannot send Confirmation link to your e-mail address";
    }
    
    ?>
    
    

     

    This all seems to work fine its the confirm.php I'm having trouble with

  10. I've fixed it to

    $sql2="INSERT INTO `$tbl_name2` (`name`, `address`, `address1`, `address2`, `address3`, `address4`, `county`, `zip`, `telephone`, `email`, `username`, `password`) VALUES ('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password')";
    $result=mysql_query($sql2) or die(mysql_error());
    

     

    But getting a blank screen after I click on the email link 

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.