-
Notifications
You must be signed in to change notification settings - Fork 2
/
postact.php
49 lines (41 loc) · 1.14 KB
/
postact.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?
include_once 'init.php';
$user_data = user_data('uid', 'username', 'email');
$uid = $user_data['uid'];
$name = $user_data['username'];
$email = $user_data['email'];
$title=mysql_real_escape_string(htmlentities($_POST['titl']));
$content=mysql_real_escape_string(htmlentities($_POST['conten']));
$IP = $_SERVER['REMOTE_ADDR'];
if (!$title | !$content)
{
echo 'Complete all the required fields';
exit();
}
if(strlen($title) < 20){
echo 'Title less than 20 characters';
exit();
}
if(strlen($content) < 160){
echo 'Content less than 160 characters';
exit();
}
$sql1 ="SELECT id FROM submit_link WHERE title ='$title'";
$result=mysql_query($sql1);
$sitecheck = mysql_num_rows($result);
if($sitecheck > 0){
while($rows=mysql_fetch_array($result)){
$id = $rows['id'];
echo '<a href="comment.php?id='.$id.'">Already Submitted</a>';
exit();
}}
$datetime=time(); //create date time
$sql="INSERT INTO submit_link (title, name, datetime, content, IP, email, uid)VALUES('$title', '$name', '$datetime', '$content', '$IP', '$email', '$uid')";
$result=mysql_query($sql);
if($result){
echo 'yes';
}else {
echo "ERROR";
}
mysql_close();
?>