-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomment.php
More file actions
22 lines (20 loc) · 748 Bytes
/
comment.php
File metadata and controls
22 lines (20 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
ob_start();
include("Obamasapproval.php");
$host="sql.mit.edu";
$username="grosas";
$password="snett";
$db_name="grosas+candidates_2012";
$tbl_name="ObamaComments";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$conn = mysql_connect("$host", "$username", "$password") or die(mysql_error());
$mycomment=$_POST['comment'];
$myname=$_SESSION['myusername'];
$_SESSION['reguname'] = $myname;
$newcomment = "INSERT INTO $tbl_name (Name, Coment) values ('$myname', '$mycomment')";
$_SESSION['regresult'] = mysql_query($newcomment);
$_SESSION['registered'] = true;
echo "<meta http-equiv=\"Refresh\" content=0;url=\"Obamasapproval.php\">";
ob_end_flush();
?>