Exemplo n.º 1
0
     // create user id if not found
     if (!pg_numrows($result)) {
         //			echo "confirmed: user id is new\n";
         $UserID = freshports_GetNextValue($Sequence_User_ID, $db);
         if (isset($UserID)) {
             $sql = "insert into users (id, name, cookie, email, " . "watch_notice_id, emailsitenotices_yn, type, ip_address, number_of_days, password_hash) values (";
             $sql .= pg_escape_string($UserID) . ", '" . pg_escape_string($UserLogin) . "', '" . pg_escape_string($Cookie) . "', '" . pg_escape_string($email) . "', '1', 'N', 'U', '" . $_SERVER["REMOTE_ADDR"] . "', " . pg_escape_string($numberofdays) . ", crypt('" . pg_escape_string($Password1) . "' , gen_salt('md5')))";
             syslog(LOG_ERR, "FreshPorts new user: '******', '{$UserLogin}', '{$email}', " . $_SERVER["REMOTE_ADDR"]);
             $errors .= "<BR>sql=" . $sql;
             $result = pg_exec($db, $sql);
             if ($result) {
                 $UserCreated = 1;
                 # if the mail out fails, we aren't handling it properly here.
                 # we will.  eventually.
                 #
                 freshports_UserSendToken($UserID, $db);
             } else {
                 $errors .= "OUCH! I couldn't add you to the database\n";
                 $OK = 0;
             }
         } else {
             $errors .= "OUCH! I couldn't assign you a new UserID\n";
             $OK = 0;
         }
     } else {
         $errors .= 'That User ID is already in use.  Please select a different  User ID.<BR>';
     }
 }
 if ($UserCreated) {
     header("Location: welcome.php?origin=" . $origin);
     /* Redirect browser to PHP web site */
Exemplo n.º 2
0
            }
        }
    }
}
if (isset($_GET["resend"])) {
    $User = pg_escape_string($_GET["user"]);
    // get user id for that name
    $sql = "select id from users where lower(name) = lower('{$User}')";
    if ($Debug) {
        echo "{$sql}<BR>\n";
    }
    $result = pg_exec($db, $sql) or die('query failed ' . pg_errormessage());
    if (pg_numrows($result)) {
        $row = pg_fetch_array($result, 0);
        $ID = $row["id"];
        if (freshports_UserSendToken($ID, $db)) {
            $error .= 'You should soon receive an email at the mail address you supplied. It will contain instructions to enable your account.';
        } else {
            $error .= 'I\'m sorry but I couldn\'t send your token.  Please contact ' . $ProblemSolverEmailAddress . '.';
        }
    } else {
        $error .= "Hmmm, I know nothing about you.  That can't be right.  Please contact {$ProblemSolverEmailAddress}.";
    }
}
?>


<?php 
$OnLoad = 'setfocus()';
freshports_Start('Login', 'freshports - new ports, applications', 'FreeBSD, index, applications, ports');
?>