コード例 #1
0
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form action="#" method="post">
            <label>Enter your Email Address</label>
            <input type="text" name="Email" placeholder="Email" value="">
            <label>Enter your password</label>                              <!-- this is an html form for the user to signup for the service provided.-->
            <input type="password" name="password" placeholder="Password">
            <label>Confirm your password</label>
            <input type="password" name="password2" placeholder="Confirm Password">
            <input type="submit" name="subSignUp" value="Create">
        </form>   
        <?php 
if (isPostRequest()) {
    //validate
    $result = doesExistInDB();
    if ($result === FALSE) {
        $result2 = isValidEmail();
        if ($result2 === TRUE) {
            if (filter_input(INPUT_POST, 'password') == filter_input(INPUT_POST, 'password2')) {
                $result3 = createUser();
                echo $result3;
                ?>
                        <form method="POST" action="./index.php">
                            <input type="submit" name="view" value='Login'>
                        </form>
                        <?php 
                //possible error messages
            } else {
                echo 'Passwords dont match. Please try again.';
            }
コード例 #2
0
ファイル: index.php プロジェクト: Jlamoore/PHPWinterClass2016
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"><!-- css style sheet -->
        <title></title>        
    </head>
    <body>
        <header><h1>Url Finder by Site Given</h1></header>
        <?php 
include_once './functions/dbconnect.php';
//includes
include_once './functions/until.php';
include './functions/validation.php';
include './functions/Curl.php';
if (isPostRequest() === TRUE) {
    //check if there was a post request to display correct information
    $isValidUrl = validateUrl();
    //if there is a post request validate url
    $isValidUrlInDB = doesExistInDB();
    //check if this url is already in the database
    if ($isValidUrl === TRUE && $isValidUrlInDB === FALSE) {
        $output = specialOPCurl();
        $htmlMatch = array();
        $urlRegEx = "/(https?:\\/\\/[\\da-z\\.-]+\\.[a-z\\.]{2,6}[\\/\\w \\.-]+)/";
        //grab all urls on page and store in a string variable
        $ExtractedHtml = filter_input(INPUT_POST, 'ExtractedHtml');
        //extract urls and store in an array
        preg_match_all($urlRegEx, $output, $htmlMatch);
        //remove duplicates from array
        $finalMatches = array_unique($htmlMatch[0]);
        $url = filter_input(INPUT_POST, 'URL');
        $db = dbconnect();
        $stmt = $db->prepare("INSERT INTO sites SET site = :site, date = now()");
        //insert all urls in array