Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>PHP Blog</title>
- </head>
- <body>
- <?php
- require 'login.php';
- $db_server = mysql_connect($db_hostname, $db_username, $db_password);
- if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
- mysql_select_db($db_database, $db_server)
- or die("Unable to select database: " . mysql_error());
- if(isset($_POST['username']) and isset($_POST['password']))
- {
- $pass = "test";
- $user = "test";
- if($_POST['username'] == "test" and $_POST['password'] == "test")
- {
- echo <<<_END
- <form action="post.php" method="post"><pre>
- Title: <input type="text" name="title">
- Post: <textarea rows="5" cols="64" name="post">
- </textarea>
- <input type="submit" value="Submit">
- </pre></form>
- _END;
- if(isset($_POST['title']) and isset($_POST['post']))
- {
- $title = $_POST['title'];
- $post = $_POST['post'];
- $query = "INSERT INTO blog(title,post) VALUES('$title', '$post')";
- mysql_query($query);
- echo 'Succesfully posted..';
- echo '<a href="blog.php">Click here</a>';
- }
- }
- else
- {
- echo "Wrong Password!";
- }
- }
- ?>
- <input type="hidden" name="username"><input type="hidden" name="password">
- echo <<<_END
- <form action="post.php" method="post"><pre>
- Username: <input type="text" name="username">
- Password: <input type="password" name="password">
- Title: <input type="text" name="title">
- Post: <textarea rows="5" cols="64" name="post">
- </textarea>
- <input type="submit" value="Submit">
- </pre></form>
- _END;
- if(isset($_POST['username']) and isset($_POST['password']))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement