php key giveaway script doesnt work -
Whenever a person enters their mail in the input, I have to make a major cheap script to remove a key I am trying. I came very far but now I have 1 problem, when he sends mail, I should send you the key, but it is not, it only sends the text "Your code": "
This key Whenever he sends it "$ message", he should run a function dispatch and grab the key out of the database.
Can anyone see a problem?
& lt ;? php // fill mail mail echo "& lt; Form method = 'post' action = ". $ _SERVER ['PHP_SELF']" & Gt; Email: & lt; Input name = 'email' & gt; & Lt; / Input & gt; & Lt; Br> & Lt; Input type = 'submit' value = 'get your key' name = 'submit' & gt; & Lt; / Input & gt; ; & Lt; Br> & Lt; Br> & Lt; / Form & gt; "; If (empty ($ _ POST [" email "])) {resonant" please enter an email address ";} Else {// mail input input $$ = $ _POST [" email "]; $ theme = 'Test'; $ message = 'your code is:'. Dispres (); $ header = 'nix'; mail ($ $, $ theme, $ message); "Your code has been sent to your email"; $ _POST ["email"] "\ R"; resonance dispersion ();} function dars () {// database connect $ db_host = 'localhost'; $ db_user = 'root'; $ db_pwd = 'password'; $ database = 'Keys'; $ Table = 'keytest'; if (! Mysql_connect ($ db_host, $ db_user, $ db_pwd)) die ("not connected to database ("MySql_select_db" (Database Database)) can die ("database can not be selected"); // result from resistor = mysql_query ("Select * FROM {$ table}" from the order of RAND ( $ LIMIT 1 "); $ line = mysql_fetch_row ($ result); $ Result = implode ('|', $ line); Return $ result; // Delete key from database / mysqli_query (" Ask the key, where name = Remember the IP address for use in '$ cell1'); // 1? & Gt;
- Add a return statement to the send () function.
- To call only one key per user, call call only once (). (Empty ($ _ POST ["email"])) {echo "Please enter an email address."; } Else {// Get key from database $ key = dispres (); $ Mail = $ = $ _POST for input input input ["email"]; $ Theme = 'test'; $ Message = 'Your code is:'. $ Key; $ Header = 'nix'; Mail ($ $, $ theme, $ message); Echo "Your code has been sent to your email:" $ _POST ["Email"] "\ R"; Copy $ key; } Function disperses () {// ... // replace: // resonance $ result; // By: return result $; }
Comments
Post a Comment