function option7_11()
{
    // Define $line to store line
    $phrase = 0;
    $word1 = RandomLine("./wordbank/p4.txt");
    $word1 = rtrim($word1);
    $word2 = RandomLine("./wordbank/j1.txt");
    $word2 = rtrim($word2);
    $word3 = RandomLine("./wordbank/n2.txt");
    $word3 = rtrim($word3);
    // Concatenate words into $line
    $phrase = $word1 . " " . $word2 . " " . $word3;
    return $phrase;
}
                $punc = rtrim(RandomLine("../wordbank/punc.txt"));
                $firstline = $line1 . $punc;
                $line2 = gent7sline();
                $punc = rtrim(RandomLine("../wordbank/punc.txt"));
                $secondline = $line2 . $punc;
                $line3 = gent5sline();
                // add a terminating punctuation
                $puncf = rtrim(RandomLine("../wordbank/puncf.txt"));
                $thirdline = $line3 . $puncf;
                // redirect("haiku.php");
                render("haiku_display.php", ["title" => "Hello, Haiku", "firstline" => $firstline, "secondline" => $secondline, "thirdline" => $thirdline]);
            } else {
                apologize("Please paste a link to an image file, followed by no spaces.");
            }
        } else {
            $line1 = gent5sline();
            //add a puctuation
            $punc = rtrim(RandomLine("../wordbank/punc.txt"));
            $firstline = $line1 . $punc;
            $line2 = gent7sline();
            $punc = rtrim(RandomLine("../wordbank/punc.txt"));
            $secondline = $line2 . $punc;
            $line3 = gent5sline();
            // add a terminating punctuation
            $puncf = rtrim(RandomLine("../wordbank/puncf.txt"));
            $thirdline = $line3 . $puncf;
            // redirect("haiku.php");
            render("haiku_display.php", ["title" => "Hello, Haiku", "firstline" => $firstline, "secondline" => $secondline, "thirdline" => $thirdline]);
        }
    }
}
示例#3
0
文件: main.php 项目: nttvietnam/lucky
$app_id = $app_id;
$app_secret = $app_secret;
$redirect_uri = "" . $scripturl . "main.php";
$facebook = new Facebook(array('appId' => $app_id, 'secret' => $app_secret, 'cookie' => true));
$user = $facebook->getUser();
$user_profile = $facebook->api('/me');
$coded = $_REQUEST['code'];
$access_token = $facebook->getAccessToken();
$name = "" . $user_profile['name'] . "";
$fbid = "" . $user_profile['id'] . "";
function RandomLine($filename)
{
    $lines = file($filename);
    return $lines[array_rand($lines)];
}
$reason = RandomLine("reason.txt");
$canvas = imagecreatefromjpeg("bg.jpg");
// background image file
$black = imagecolorallocate($canvas, 0, 0, 0);
// The second colour - to be used for the text
$font = "arial.ttf";
// Path to the font you are going to use
$fontsize = 20;
// font size
$birthday = "" . $user_profile['birthday'] . "";
$death = "- " . date('d/m/Y', strtotime('+' . rand(0, 10000) . ' days')) . "";
imagettftext($canvas, 22, 0, 110, 120, $black, $font, $name);
// name
imagettftext($canvas, 22, 0, 110, 170, $black, $font, $birthday);
// birthday
imagettftext($canvas, 22, 0, 255, 172, $black, $font, $death);