<?php require 'modules/Table.inc'; include_once "function_random_string.php"; if (isset($_POST)) { if (isset($_POST['mobile']) && isset($_POST['email']) && isset($_POST['name'])) { $mobile = $_POST['mobile']; $name = $_POST['name']; $email = $_POST['email']; $password = "******" . random_string(4); $db = new Table('users'); $id = (int) $db->getLastId("user_id") + 10000; $data = array("user_id" => $id, "username" => $mobile, "password" => $password); $db->save($data); $url = "http://darpan.incorelabs.com/mail/mail-sample.php"; $sub = "Darpan app credentials"; $msg = "Hi " . $name . "\nWelcome to Darpan(Reflection of Friendship)\n\nYour app credentials are:\nUsername: "******"\nPassword: "******"\n\nRegards\nDarpan"; $data = array('msg' => $msg, 'sub' => $sub, 'id' => 1, 'mail_id' => $email); $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data))); $context = stream_context_create($options); $result = file_get_contents($url, false, $context); echo $result; } }