<p><label for="password">Пароль<br> <input class="input" id="password" name="password"size="32" type="password" value=""></label></p> <p class="submit"><input class="button" id="register" name= "register" type="submit" value="Зарегистрироваться"></p> <p class="regtext">Уже зарегистрированы? <a href= "login.php">Введите имя пользователя</a>!</p> </form> </div> </div> <footer> </footer> <?php if (isset($_POST["register"])) { if (!empty($_POST['email']) && !empty($_POST['username']) && !empty($_POST['password'])) { $email = $_POST['email']; $username = $_POST['username']; $for_user_password = $_POST['password']; $password = crypt($_POST['password'], $email); $query = mysql_query("SELECT * FROM users WHERE login='******'"); $numrows = mysql_num_rows($query); if ($numrows == 0) { $sql = "INSERT INTO users\n (email, login, password)\n VALUES('{$email}', '{$username}', '{$password}')"; $result = mysql_query($sql); echo "Account is successfully created!"; gmail_send($email, $username, $for_user_password); } else { echo "Login zanyat."; } } } ?> </body> </html>
function send_email($p, &$error = null, $mail_type = null) { if (empty($mail_type) and function_exists('send_email_type')) { $mail_type = send_email_type(); } if (function_exists('send_email_subject')) { $p['subject'] = send_email_subject($p); } $n = 0; if (!isset($p['emails']) or !is_array_full(array_keys($p['emails']))) { $error = 'You must send emails to the emailer as an array, even for single email addresses. If you don't know what this means, contact your website manager.'; return false; } // this bit is only needed until we've updated all other sites to use new email assoc format $first = reset($p['emails']); if (make_email($first)) { $temp = array(); foreach ($p['emails'] as $name => $email) { $temp[$email] = $name; } $p['emails'] = $temp; unset($temp); } // if (!defined('EMAIL_SEND')) { if (!isset($p['headers'])) { $headers = mail_headers(); } foreach ($p['emails'] as $email => $name) { log_email($name . ' <' . $email . '>', $p['subject'], $p['message'], $headers); $n++; } } else { switch ($mail_type) { case 'func': $func = send_email_func(); if (!$func($p, $error)) { return false; } break; case 'gmail': if (!gmail_send($p, $error)) { return false; } break; case 'sendgrid': if (!sendgrid_send($p, $error)) { return false; } break; case 'smtp': if (!smtp_send($p, $error)) { return false; } break; case 'sendmail': default: if (!is_array_full($p['emails'])) { $error = 'You must send emails to the emailer as an array, even for single email addresses. If you don't know what this means, contact your website manager.'; return false; } if (!isset($p['headers'])) { $p['headers'] = mail_headers(); } foreach ($p['emails'] as $email => $name) { if (@mail($email, $p['subject'], $p['message'], $p['headers'])) { $n++; } else { $errors[] = $email; } } if (!empty($errors)) { $error = 'The email message could not be sent to the following addresses.</p><ul><li>' . implode('</li><li>', $errors) . '</li></ul><p>'; return false; } break; } } return true; }