php register code help

sudu hawa

Well-known member
  • Dec 1, 2011
    1,626
    100
    63
    <?php
    $First=$_POST["first"];
    $Last=$_POST["last"];
    $email=$_POST["email"] ;
    $City=$_POST["city"] ;
    $Address=$_POST["address"] ;
    $country=$_POST["country"] ;
    $how=$_POST["how"] ;
    $Postal=$_POST["postal"] ;
    $State=$_POST["state"] ;
    if (strlen($First)=="")
    {
    echo "Please enter Your Details";
    }

    else
    {
    $a=date("y");
    $b=date("m");
    $c=date("d");
    $d=date("h");
    $e=date("i");
    $f=date("s");
    $num=$a.$b.$c.$d.$e.$f;

    echo "Check Your Email. Thank You ".$_POST["first"];

    $username="youuser";
    $hostname="localhost";
    $password="147147";
    $con=mysql_connect($hostname,$username,$password);
    $select=mysql_select_db("registergood",$con);
    $result=mysql_query("INSERT INTO register (First,Last,email,City,Address,country,how,Postal,State,Refnu) VALUES ('$First', '$Last', '$email', '$City', '$Address', '$country', '$how', '$Postal', '$State', $num)");

    $to = '[email protected]' . ', '; // note the comma

    // subject
    $subject = "you subjet";

    // message
    $message = "
    <html>
    <head>
    <title>Birthday Reminders for August</title>
    </head>
    <body>
    <img src=\"http://www.yoursite.com/images/logo_plain.png\"/><br /><br />
    <table>
    <tr>
    <td>Dear ".$First." ".$Last."</td><td> (".$num.")</td>
    </tr>
    </table><br />

    </body>
    </html>
    ";

    // To send HTML mail, the Content-type header must be set
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    // Additional headers
    $headers .= 'From: name| site name<[email protected]>' . "\r\n";

    // Mail it
    mail($to, $subject, $message, $headers);
    }
    ?>
    macahnla mata one mekata register wena date eka data basee ekata yavanna anithe eka thamai meke message ekata daganna one register vecha date ekai eka expire venna date ekai da ganna one plz help ekak onne yaluwaneee
     
    Last edited:

    Anonymou$

    Member
    Oct 12, 2011
    43
    5
    0
    database field ekak hadala (varchar 10) ... me widiyata current time eka timestamp ekakin ganin

    PHP:
    $registered_date = strtotime("now");
    using varchar for date format? :rofl:

    macahnla mata one mekata register wena date eka data basee ekata yavanna anithe eka thamai meke message ekata daganna one register vecha date ekai eka expire venna date ekai da ganna one plz help ekak onne yaluwaneee
    use mysql CURDATE() method
    ill give you an example .. eg : mysql_query = "insert into regdates(user_id,user_date)values(xx,CURDATE())";

    use this method to get expire date ..example code :
    $expdate=time() + 60 * 60 * 24 * 7;(*7 = after 7 days )
     
    Last edited:

    Epic Madness

    Banned
    Jan 2, 2012
    1,139
    124
    0
    database field ekak hadala (varchar 10) ... me widiyata current time eka timestamp ekakin ganin

    PHP:
    $registered_date = strtotime("now");


    This doesn't return anything in date format but only as a bunch of numbers
    like 284290902 (this is an example)
    you may still have to use the date function to parse this to date format.

    $expire_date = date("D F d Y",$_time)

    this will convert the 284290902 to 22 02 2011 like this. (this is merely an example)
     

    Anonymou$

    Member
    Oct 12, 2011
    43
    5
    0
    This doesn't return anything in date format but only as a bunch of numbers
    like 284290902 (this is an example)
    you may still have to use the date function to parse this to date format.

    $expire_date = date("D F d Y",$_time)

    this will convert the 284290902 to 22 02 2011 like this. (this is merely an example)
    yes :yes:. it calls time stamp.you can convert time stamp into date format
    eg : $anyvar = date("Y-m-d H:i:s", $timestamp);
     

    sudu hawa

    Well-known member
  • Dec 1, 2011
    1,626
    100
    63
    get the expire date
    $_time = time()
    $_time += 60 * 60 * 24
    $expire_date = date("D F d Y",$_time)

    machan mata register date ekata oin date ekak ma da ganna barida??? anithe eka yaluwa meke time eka hadannathe onna ne mata one ada reg unama 5 kin expire venna heta reg unothe davsak wadi wennawa ahama ?????
     

    sudu hawa

    Well-known member
  • Dec 1, 2011
    1,626
    100
    63
    දැන් මොකද්ද අවුල ? ඔය කියල තියෙන විදි වලින් එකක් තෝරගෙන කරහන්
    mehemai mata expire wena date eka auto wenna one.. Eg ada register unama anidata expire wennwa.. heta register unama inanidata expire wenna.. hada ganna oneeee
     

    mldarshana

    Well-known member
  • Apr 2, 2007
    34,059
    1,404
    113
    ආශ්චර්ය අභියස :nerd:
    Code:
    // Registered Date
    [COLOR=#000000][COLOR=#0000bb]$registered_date [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]strtotime[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"now"[/COLOR][COLOR=#007700]);  [/COLOR][/COLOR]
    
    // Expiration Date
    $expiration_date = strtotime("+3 days",$registered_date);
     

    sudu hawa

    Well-known member
  • Dec 1, 2011
    1,626
    100
    63
    Code:
    // Registered Date
    [COLOR=#000000][COLOR=#0000bb]$registered_date [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]strtotime[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"now"[/COLOR][COLOR=#007700]);  [/COLOR][/COLOR]
    
    // Expiration Date
    $expiration_date = strtotime("+3 days",$registered_date);

    wada karanne na bn hadala denna koo machan plzzzzzzz
     

    DemonAkalanka

    Well-known member
  • Aug 17, 2011
    7,555
    1,446
    113
    Sri Lanka
    $maw= date("m"); // Month value
    $deaw= date("d"); //today's date
    $yaw= date("Y"); // Year value
    $remday=date('Y/m/d', mktime(0,0,0,$maw,($deaw+7),$yaw));

    number 7 ekata awashshaya dawasa daganna