summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashantsinalkar2016-04-25 09:41:46 +0530
committerprashantsinalkar2016-04-25 09:41:46 +0530
commitae74b8b94d1b4799987d00be3fa460adaaae965e (patch)
tree6523600135d81610e4953974962a04d87a7f2960
parent132bb81c15456256e78610fd68c0cd729c3c0ecf (diff)
parent9cad4b7a60f0ebdd143b42b0bdae4f0d2f5bedb9 (diff)
downloadscilab_cloud_interface-ae74b8b94d1b4799987d00be3fa460adaaae965e.tar.gz
scilab_cloud_interface-ae74b8b94d1b4799987d00be3fa460adaaae965e.tar.bz2
scilab_cloud_interface-ae74b8b94d1b4799987d00be3fa460adaaae965e.zip
Merge branch 'master' of https://github.com/prashantsinalkar/scilab_cloud_interface
-rwxr-xr-x[-rw-r--r--]comment.php95
1 files changed, 62 insertions, 33 deletions
diff --git a/comment.php b/comment.php
index f2d2e57..ecd867b 100644..100755
--- a/comment.php
+++ b/comment.php
@@ -1,37 +1,66 @@
- <?php
- require_once('db-connect.php');
- $types = array(
- 1 => "Blank Code / Incorrect code",
- 2 => "Output error",
- 3 => "Execution error",
- 4 => "Missing example(s)",
- 6 => "Blank output",
- 7 => "Any other"
- );
- if(isset($_POST['type']) && isset($_POST['comment'])){
- $query = "insert into scilab_cloud_comment (type, comment, email,category,books,chapter,example) values(".$_POST['type'].", '".$_POST['comment']."', '".$_POST['email']."', '".$_POST['category']."', '".$_POST['books']."', '".$_POST['chapter']."', '".$_POST['example']."')";
- if(mysql_query($query)){
+<?php
+require_once('db-connect.php');
+$types = array(
+ 1 => "Blank Code / Incorrect code",
+ 2 => "Output error",
+ 3 => "Execution error",
+ 4 => "Missing example(s)",
+ 6 => "Blank output",
+ 7 => "Any other"
+);
+if (isset($_POST['type']) && isset($_POST['comment']))
+ {
+ $query = "insert into scilab_cloud_comment (type, comment, email,category,books,chapter,example) values(" . $_POST['type'] . ", '" . $_POST['comment'] . "', '" . $_POST['email'] . "', '" . $_POST['category'] . "', '" . $_POST['books'] . "', '" . $_POST['chapter'] . "', '" . $_POST['example'] . "')";
+ if (mysql_query($query))
+ {
+ echo "<p>Thank you for your valuable feedback.</p>";
+ $query_details = "SELECT tcp.book as book, tcp.author as author, tcp.publisher as publisher,
+ tcp.year as year,tcp.category as category, tce.chapter_id, tcc.number AS chapter_no,
+ tcc.name AS chapter_name, tce.number AS example_no, tce.caption AS example_caption
+ FROM textbook_companion_preference tcp
+ LEFT JOIN textbook_companion_chapter tcc ON tcp.id = tcc.preference_id
+ LEFT JOIN textbook_companion_example tce ON tce.chapter_id = tcc.id
+ WHERE tce.id = '" . $_POST['example'] . "'";
+ $exmpale_id = $_POST['example'];
+ $result = mysql_query($query_details);
+ $row = mysql_fetch_object($result);
+ $category = _tbc_list_of_category($row->category);
+ $to = "email@email.in";
+ $subject = "New Cloud Comment";
+ $message = "
+ A new comment has been posted. <br><br>
- echo "<p>Thank you for your valuable feedback.</p>";
+ Type: {$types[$_POST['type']]} <br>
+ Book: {$row->book} <br>
+ Chapter: {$row->chapter_name} ({$row->chapter_no}) <br>
+ Example: <a href= 'http://cloud.scilab.in/index.php?eid={$exmpale_id}' target='_blank' >{$row->example_caption}</a> ({$row->example_no}) <br><br>
+
+ Comment: {$_POST['comment']} <br>
- $to = "scilab-cloud@fossee.in";
- $subject = "New Cloud Comment";
- $message = "
- A new comment has been posted. <br>
- Type: {$types[$_POST['type']]} <br>
- Comment: {$_POST['comment']} <br>
Link: http://scilab.in/cloud_comments
";
- $from = "textbook@scilab.in";
-
- $headers = "From: " . $from . "\r\n";
- $headers .= "MIME-Version: 1.0\r\n";
- $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
- mail($to,$subject,$message,$headers);
-
-
- }else{
- echo "<p>Sorry for the inconvience, please try again</p>";
- }
- }else{ ?>
-<?php } ?>
+ $from = "textbook@scilab.in";
+ $headers = "From: " . $from . "\r\n";
+ $headers .= "MIME-Version: 1.0\r\n";
+ $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
+ mail($to, $subject, $message, $headers);
+ }
+ else
+ {
+ echo "<p>Sorry for the inconvience, please try again</p>";
+ }
+ }
+else
+ {
+?>
+<?php
+ }
+function _tbc_list_of_category($category_id)
+ {
+ $query = "SELECT * FROM list_of_category WHERE category_id = " . $category_id;
+ $category_list = mysql_query($query);
+ $category_list_data = mysql_fetch_object($category_list);
+ $category = $category_list_data->category_name;
+ return $category;
+ }
+?>