Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // configuration
- require("../includes/config.php");
- // if form was submitted
- if ($_SERVER["REQUEST_METHOD"] == "POST")
- {
- // validate submission
- if (empty($_POST["username"]))
- {
- apologize("You must provide your username.");
- }
- if (empty($_POST["password"]))
- {
- apologize("You must provide your password.");
- }
- $positions = [];
- foreach ($rows as $row)
- {
- $stock = lookup($row["symbol"]);
- if ($stock !== false)
- {
- $positions[] = [
- "name" => $stock["name"],
- "price" => $stock["price"],
- "shares" => $row["shares"],
- "symbol"=> $row["symbol"]
- ];
- }
- }
- render("portfolio.php", ['positions' => $positions, "title" => "portfolio"]);
- }
- else
- {
- // render portfolio
- render("portfolio.php", [ "title" => "portfolio"]);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement