Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Watersys/new_reply.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
120 lines (119 sloc)
5.53 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//This page let reply to a topic | |
include('config.php'); | |
if(isset($_GET['id'])) | |
{ | |
$id = intval($_GET['id']); | |
if(isset($_SESSION['username'])) | |
{ | |
$dn1 = mysqli_fetch_array(mysqli_query($var,'select count(t.id) as nb1, t.title, t.parent, c.name from topics as t, categories as c where t.id="'.$id.'" and t.id2=1 and c.id=t.parent group by t.id')); | |
if($dn1['nb1']>0) | |
{ | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> | |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> | |
<link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" /> | |
<title>Add a reply - <?php echo htmlentities($dn1['title'], ENT_QUOTES, 'UTF-8'); ?> - <?php echo htmlentities($dn1['name'], ENT_QUOTES, 'UTF-8'); ?> - Forum</title> | |
<script type="text/javascript" src="functions.js"></script> | |
</head> | |
<body> | |
<div align="center"> | |
<div class="header" style="width:100%;margin: auto;margin-top: 10px"> | |
<a href="<?php echo $url_home; ?>"><img width="80%" src="<?php echo $design; ?>/images/logo.png" alt="Forum" /></a> | |
</div></div> | |
<div class="contentusers"> | |
<?php | |
$nb_new_pm = mysqli_fetch_array(mysqli_query($var,'select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['userid'].'" and user1read="no") or (user2="'.$_SESSION['userid'].'" and user2read="no")) and id2="1"')); | |
$nb_new_pm = $nb_new_pm['nb_new_pm']; | |
?> | |
<div class="box"> | |
<div class="box_left"> | |
<a href="<?php echo $url_home; ?>">WCSF Index</a> > <a href="list_topics.php?parent=<?php echo $dn1['parent']; ?>"><?php echo htmlentities($dn1['name'], ENT_QUOTES, 'UTF-8'); ?></a> > <a href="read_topic.php?id=<?php echo $id; ?>"><?php echo htmlentities($dn1['title'], ENT_QUOTES, 'UTF-8'); ?></a> > Add a reply | |
</div> | |
<div class="box_right"> | |
<a href="list_pm.php">Your messages(<?php echo $nb_new_pm; ?>)</a> - <a href="profile.php?id=<?php echo $_SESSION['userid']; ?>"><?php echo htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8'); ?></a> (<a href="login.php">Logout</a>) | |
</div> | |
<div class="clean"></div> | |
</div> | |
<?php | |
if(isset($_POST['message']) and $_POST['message']!='') | |
{ | |
include('bbcode_function.php'); | |
$message = $_POST['message']; | |
if(get_magic_quotes_gpc()) | |
{ | |
$message = stripslashes($message); | |
} | |
$message = mysqli_real_escape_string($var,bbcode_to_html($message)); | |
if(mysqli_query($var,'insert into topics (parent, id, id2, title, message, authorid, timestamp, timestamp2) select "'.$dn1['parent'].'", "'.$id.'", max(id2)+1, "", "'.$message.'", "'.$_SESSION['userid'].'", "'.time().'", "'.time().'" from topics where id="'.$id.'"') and mysqli_query($var,'update topics set timestamp2="'.time().'" where id="'.$id.'" and id2=1')) | |
{ | |
?> | |
<div class="message">The message have successfully been sent.<br /> | |
<a href="read_topic.php?id=<?php echo $id; ?>">Go to the topic</a></div> | |
<?php | |
} | |
else | |
{ | |
echo 'An error occurred while sending the message.'; | |
} | |
} | |
else | |
{ | |
?> | |
<form action="new_reply.php?id=<?php echo $id; ?>" method="post"> | |
<label for="message">Message</label><br /> | |
<div class="message_buttons"> | |
<input type="button" value="Bold" onclick="javascript:insert('[b]', '[/b]', 'message');" /><!-- | |
--><input type="button" value="Italic" onclick="javascript:insert('[i]', '[/i]', 'message');" /><!-- | |
--><input type="button" value="Underlined" onclick="javascript:insert('[u]', '[/u]', 'message');" /><!-- | |
--><input type="button" value="Image" onclick="javascript:insert('[img]', '[/img]', 'message');" /><!-- | |
--><input type="button" value="Link" onclick="javascript:insert('[url]', '[/url]', 'message');" /><!-- | |
--><input type="button" value="Left" onclick="javascript:insert('[left]', '[/left]', 'message');" /><!-- | |
--><input type="button" value="Center" onclick="javascript:insert('[center]', '[/center]', 'message');" /><!-- | |
--><input type="button" value="Right" onclick="javascript:insert('[right]', '[/right]', 'message');" /> | |
</div> | |
<textarea name="message" id="message" cols="70" rows="6"></textarea><br /> | |
<input type="submit" value="Send" /> | |
</form> | |
<?php | |
} | |
?> | |
</div> | |
<!-- <div class="foot"> | |
<p><b>Water Control System and Discussion Portal for Farmers</b></p> | |
</div> --> | |
</body> | |
</html> | |
<?php | |
} | |
else | |
{ | |
echo '<h2>The topic you want to reply doesn\'t exist.</h2>'; | |
} | |
} | |
else | |
{ | |
?> | |
<h2>You must be logged to access this page.</h2> | |
<div class="box_login"> | |
<form action="login.php" method="post"> | |
<label for="username">Username</label><input type="text" name="username" id="username" /><br /> | |
<label for="password">Password</label><input type="password" name="password" id="password" /><br /> | |
<label for="memorize">Remember</label><input type="checkbox" name="memorize" id="memorize" value="yes" /> | |
<div class="center"> | |
<input type="submit" value="Login" /> <input type="button" onclick="javascript:document.location='signup.php';" value="Sign Up" /> | |
</div> | |
</form> | |
</div> | |
<?php | |
} | |
} | |
else | |
{ | |
header("location:login.php?msg=Login First to use service");//zubair | |
} | |
?> |