Jump to content

mikebyrne

Members
  • Posts

    780
  • Joined

  • Last visited

Posts posted by mikebyrne

  1. I just had this way working last week but with less fields etc. I'll definatly look at you idea once I get this test up and running

     

    I've changed two lines in the config.php 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());
    

     

    And I'm now getting the error:

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

  2. I've got the following code to send the user a confirmation email upon registration but when the user clisck on the link, instead of getting a messege, I just get a blank screen?????

     

    <?php
    include('config.php');
    
    // Passkey that got from link
    $passkey=$_GET['passkey'];
    
    $tbl_name1="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',)";
    $result2=mysql_query($sql2);
    }
    
    // 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);
    
    }
    
    }
    ?> 
    
    

  3. No, I had county instead of country!!! Fixed that, now getting the error:

     

    Warning: mail() [function.mail]: SMTP server response: 550 Address '<root@localhost>' not known here. in C:\xampp\htdocs\signup_ac.php on line 49

    Cannot send Confirmation link to your e-mail address

     

    My mail server is running in the background

     

    If i try an hotmail address etc, I get:

     

    Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in C:\xampp\htdocs\signup_ac.php on line 49

    Cannot send Confirmation link to your e-mail address

     

     

  4. Eveytime i run a test on my code i get the following error:

     

    Not found your email in our databaseCannot send Confirmation link to your e-mail address

     

    Here's my code:

     

    Start

    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</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>
    

     

     

    Signup_ac

    
    
    
    <?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'];
    $country=$_POST['country'];
    $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, country, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$country' ,'$zip', '$telephone', '$email', '$username', '$password',)";
    $result=mysql_query($sql);
    
    // 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";
    }
    
    ?>
    
    

     

    Confirm

     

    
    
    
    <?php
    include('config.php');
    
    // Passkey that got from link
    $passkey=$_GET['passkey'];
    
    $tbl_name1="temp_users";
    
    // Retrieve data from table where row that match 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 this passkey in our 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'];
    $country=$_POST['country'];
    $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, country, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$country' ,'$zip', '$telephone', '$email', '$username', '$password',)";
    $result2=mysql_query($sql2);
    }
    
    // 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);
    
    }
    
    }
    ?>
    

     

     

    The code on the config.php file is fine

  5. Eveytime i run a test on my code i get the following error:

     

    Not found your email in our databaseCannot send Confirmation link to your e-mail address

     

    Here's my code:

     

    Start

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</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>
    

     

     

    Signup_ac

    
    
    <?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'];
    $country=$_POST['country'];
    $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, country, zip, telephone, email, username, password)VALUES('$confirm_code', '$name', '$address', '$address1', '$address2','$address3', '$address4','$country' ,'$zip', '$telephone', '$email', '$username', '$password',)";
    $result=mysql_query($sql);
    
    // 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";
    }
    
    ?>
    

     

     

    Confirm

    
    
    <?php
    include('config.php');
    
    // Passkey that got from link
    $passkey=$_GET['passkey'];
    
    $tbl_name1="temp_users";
    
    // Retrieve data from table where row that match 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 this passkey in our 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'];
    $country=$_POST['country'];
    $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, country, zip, telephone, email, username, password)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$country' ,'$zip', '$telephone', '$email', '$username', '$password',)";
    $result2=mysql_query($sql2);
    }
    
    // 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);
    
    }
    
    }
    ?>
    

     

     

    The code on the config.php file is fine

  6. I've got it up and running but do I have to alter my php.ini file because im still getting the error

     

    Warning: mail() [function.mail]: SMTP server response: 551 User not local. We don't relay in C:\wamp\www\signup_ac.php on line 39

    Cannot send Confirmation link to your e-mail address

     

     

  7. Sorry config was pointing to table not Database. Fixed that error. Now getting:

     

    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\signup_ac.php on line 39

    Cannot send Confirmation link to your e-mail address

  8. Think i know whats up!

     

    Here's config.php

     

    <?
    
    $host="localhost"; // Host name
    $username=""; // Mysql username
    $password=""; // Mysql password
    $db_name=""; // Database name
    
    
    //Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
    mysql_select_db("$db_name")or die("cannot select DB");
    
    ?>
    

     

    Would I be right in asuming I've to fill out username, password,db_name??

     

    Would you recommend I use <?php like before??

  9. Changed it to >?php like suggested it seems to have worked but now getting an error:

     

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\signup_ac.php on line 17
    
    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\signup_ac.php on line 17
    Not found your email in our databaseCannot send Confirmation link to your e-mail address
    

  10. I've setup as per the tutorial on (http://www.phpeasystep.com/phptu/24.html) but when my browser brings up the signup_ac.php file I get the following on screen

     

    "; // Your message $message="Your Comfirmation link \r\n"; $message.="Click on this link to activate your account \r\n"; $message.="http://localhost/confirmation.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"; } ?>
    

     

    My php code looks like this:

     

    <?
    include('config.php');
    
    // table name
    $tbl_name=temp_members_db;
    
    // Random confirmation code
    $confirm_code=md5(uniqid(rand()));
    
    // values sent from form
    $name=$_POST['name'];
    $email=$_POST['email'];
    $country=$_POST['country'];
    
    // Insert data into database
    $sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
    $result=mysql_query($sql);
    
    // 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: Mike Byrne <Mikebyrne000@hotmail.com>";
    
    // Your message
    $message="Your Comfirmation link \r\n";
    $message.="Click on this link to activate your account \r\n";
    $message.="http://localhost/confirmation.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";
    }
    
    ?> 
    

     

    I've WAMP5 running and I've a test.php page that displays fine so I'm presuming I've made a mistake in the code??

  11. I have just created the following php registration page in Dreamweaver 8 (you tube tutorial) 

     

    When i try to view the file from Browser the following error appears:

     

    "HTTP Apachie server has stopped working and was closed"

     

    I can view localhost from the browser and also my test.php page so I dont know whats going on?Huh

     

    Any advice??

     

    I've AppServ Open Project - 2.5.9 for Windows installed and running vista ultimate

×
×
  • 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.