<li> <input type="text" id="h" name="h" onchange="checkHostName(this);return false;" pattern="^([a-zA-Z]+([0-9]*[a-zA-Z]*)*)" required/><i class="extension">.<?php echo $config["domainname"]; ?> </i> <div id="rec_info"></div> </li> <li> <label><?php echo $text[$lan]["label_ip"]; ?> </label> </li> <li> <input type="text" id="ip" name="ip" value="<?php echo _ip(); ?> " required/> <button onclick="select_my_ip(); return false;"><?php echo $text[$lan]["label_getip"]; ?> </button> </li> <li> <label></label> <input type="submit" value="<?php echo $text[$lan]["f_add"]; ?> "/> </li> </ul> </form>
if (!isset($_POST["u"]) || !isset($_POST["p"])) { echo $text[$lan]["err1"]; exit(1); } $rq_pass = base64_decode($_POST["p"]); if (strlen($_POST["u"]) < MIN_USER_LENGTH || strlen($rq_pass) < MIN_PASS_LENGTH) { echo $text[$lan]["err2"]; exit(2); } $pgclient = new PgClient($db_config); $user = $pgclient->prepare($_POST["u"], "email"); $pass = hash("sha512", $salt . $rq_pass); $pgclient->connect() or die($text[$lan]["dberror"]); $q = "Select * from usuarios where lower(mail)=lower('" . $user . "') and pass='******';"; $r = pg_fetch_object($pgclient->exeq($q)); if ($pgclient->lq_nresults() == 0) { // USER NON EXISTENT OR PASSWORD ERROR echo $text[$lan]["err3"]; exit(3); } $q = "update usuarios set last_login=now(), ip_last_login='******' where lower(mail)=lower('" . $user . "');"; $pgclient->exeq($q) or die($text[$lan]["dberror"]); $pgclient->disconnect(); $_SESSION["email"] = $user; $_SESSION["time"] = time(); session_write_close(); echo $text[$lan]["welcome"]; //header ("Location: /?lang=" . $lan . "&z=hosts"); ?>
$hash = hash("sha256", $salt . openssl_random_pseudo_bytes($strenght) . rand()); $pgclient->connect() or die($text[$lan]["dberror"]); $q = "Select * from usuarios where lower(mail)=lower('" . $user . "');"; $r = pg_fetch_object($pgclient->exeq($q)); if ($pgclient->lq_nresults() == 0) { // USER NON EXISTENT OR PASSWORD ERROR echo $text[$lan]["err3"]; exit(3); } /* ----------------------------- */ /* CASTELLANO */ $text["es"]["subject"] = "Recuperar acceso a CODDNS"; $text["es"]["mailbody"] = "\n<h3>Hola!</h3>\n<p>Hemos recibido una solicitud de cambio de contraseña desde " . _ip() . "</p>\n<p>Si no has iniciado ninguna acción no es necesario que hagas nada.</p>\n<p>En caso de que realmente quieras cambiar tus datos de acceso, por favor, sigue el siguiente enlace:</p>\n<a href='http://" . $config["domainname"] . "/?z=newpassword&token=" . $hash . "'>Cambiar mi contraseña</a>\n<p> Si el enlace no funciona copia el siguiente texto en el navegador para acceder.</p>\nhttp://" . $config["domainname"] . "/?z=newpassword&token=" . $hash . "\n<p>Gracias!</p>\n<p>Saludos,</p>\n<p>CODDNS</p>\n"; /* ENGLISH */ $text["en"]["subject"] = "Recover access to CODDNS"; $text["en"]["mailbody"] = "\n<h3>Hi!</h3>\n<p>We'd received a request to change your password from " . _ip() . "</p>\n<p>if you have not initiated any action need not do anything.</p>\n<p>If you really want to change your password, please follow next link:</p>\n<a href='http://" . $config["domainname"] . "/?z=newpassword&token=" . $hash . "'>Cambiar mi contraseña</a>\n<p> If the link does not work, please copy, paste and go.</p>\nhttp://" . $config["domainname"] . "/?z=newpassword&token=" . $hash . "\n<p>Thank you!</p>\n<p>Regards,</p>\n<p>CODDNS</p>\n"; /* ------------------------ */ /* User found! */ $text_sender = "CODDNS"; $email_sender = "noreply@" . $config["domainname"]; $text_mail_welcome_body = $text[$lan]["mailbody"]; $text_mail_welcome_subject = $text[$lan]["subject"]; $q = "update usuarios set hash='" . $hash . "', max_time_valid_hash = now()+Interval '30 minutes' where lower(mail)=lower('" . $user . "');"; $pgclient->exeq($q); $pgclient->disconnect(); $recipient = $user; //recipient $mail_body = $text_mail_welcome_body; //mail body $subject = $text_mail_welcome_subject; //subject
} // Register Globals foreach ($_GET as $key => $val) { ${$key} = $val; } foreach ($_POST as $key => $val) { ${$key} = $val; } foreach ($_COOKIE as $key => $val) { ${$key} = $val; } // Server Vars // $ip = $_SERVER["REMOTE_ADDR"]; // if (strlen($_SERVER["HTTP_X_FORWARDED_FOR"])) $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; // using proxy // if ($ip == "::1") $ip = ""; $ip = _ip(); function _ip() { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { return preg_match("/^([d]{1,3}).([d]{1,3}).([d]{1,3}).([d]{1,3})\$/", $_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; } else { return null; //something else } } $islinux = !(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); function getServerURL() { $url = 'http'; //$url = ($_SERVER["HTTPS"] == "on")?"https://":"http://"; if (isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on") {
function __setremember($username) { $chash = md5(sha1($username . _ip())); setcookie("MNID", $chash, time() + 3600 * 24 * 365, '/', "." . $_SERVER["HTTP_HOST"]); }
})(window,document,'script','dataLayer','GTM-M83DNM');</script> <!-- End Google Tag Manager --> <header> <div class="img" onclick="window.location='/?lang=<?php echo $lan; ?> ';"> </div> <div class="text"> <h1>Custom Open Dynamic DNS <span style="font-size:0.5em;font-style:italic;">[rc1]</span></h1> <h2><?php echo $text[$lan]["welcome"]; ?> </h2> <p><?php echo $text[$lan]["yourip"] . " " . _ip(); ?> </p> </div> <div id="navigation" class="relative"> <nav> <a class="pl<?php if (!isset($_GET["z"]) || $_GET["z"] == "hosts" || $_GET["z"] == "remember") { echo " pl_select"; } ?> " href="<?php echo $config["html_root"]; ?> /?lang=<?php
<?php require_once "include/config.php"; require_once "lib/ipv4.php"; echo json_encode(_ip());
echo "<div class='err'>La confirmación de contraseña no coincide</div>"; exit(3); } $text_sender = "CODDNS"; $email_sender = "noreply@" . $config["domainname"]; $text_mail_welcome_body = "Hola!\n\n Ya formas parte de los usuariuos de custom open dynamic DNS :D"; $text_mail_welcome_subject = "Gracias por registrarte!"; $pgclient = new PgClient($db_config); $user = $pgclient->prepare($_POST["u"], "email"); $pass = hash("sha512", $salt . $rq_pass); $pgclient->connect() or die($text[$lan]["dberror"]); $q = "Select * from " . $db_config["schema"] . ".usuarios where lower(mail)=lower('" . $user . "');"; $pgclient->exeq($q) or die($text[$lan]["dberror"]); if ($pgclient->lq_nresults() == 0) { // ADD NEW USER $q = "insert into " . $db_config["schema"] . ".usuarios (mail,pass, ip_last_login, first_login) values (lower('" . $user . "'),'" . $pass . "', '" . _ip() . "', now());"; $pgclient->exeq($q) or die($text[$lan]["dberror"]); $recipient = $user; //recipient $mail_body = $text_mail_welcome_body; //mail body $subject = $text_mail_welcome_subject; //subject $header = "From: " . $text_sender . " <" . $email_sender . ">\r\n"; //optional headerfields mail($recipient, $subject, $mail_body, $header); //mail command :) } else { die("<div class='err'>Ese usuario ya existe</div>"); exit(1); }