PHP - [suggestion] Add Notification For Topic Replies
?
Is there an option somewhere in this cesspool infested IPB settings panel? Edited by Monkuar, 23 January 2015 - 10:17 PM. Similar TutorialsI am having trouble adding sub-topics to my home made blog system running under PHP-Fusion CMS with PHPver7.4.16 with cgi/fcgi interface and MySQL5.7.34-log. Here are 2 images: Here is the module that produces the output. <?php echo "<div class='col-sm-12'>\n"; echo "<table width='100%' border='0'><tr><td><span class='hdspan2'><b>".$locale['gb_810']."</b></span></td></tr></table>\n"; echo "<table align='center' width='80%' border='0'>\n"; $result = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_TOPICS." ORDER BY topic_order ASC"); if (dbrows($result)) { $cnt = 0; while($data = dbarray($result)) { $id = $data['topic_id']; $title = $data['topic_title']; $sub = $data['topic_sub']; $result1 = dbquery("SELECT * FROM ".DB_GRIMS_BLOG_POST." WHERE topic_id='$id'"); $num_rows = dbrows($result1); if ($sub == '1') { echo "<tr><td width='15'></td><td><a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$title</a><span style='font-size:11px;color:white;'> [$num_rows posts]</span></td></tr>\n"; } else { echo "<tr><td colspan='2'><a class='lnk-side' href='".BASEDIR."grims_blog/topics_page.php?topic_id=".$id."'>$title</a><span style='font-size:11px;color:white;'> [$num_rows posts]</span></td></tr>\n"; } } $cnt++; } echo "</table><p></div>\n"; ?> The topic_order field is a new field I added to get the desired output but it's not standard procedure and is in fact not really workable in a live setting because I would have to use php_myadmin to modify it everytime I added or deleted a topic or sub-topic. So the bottom line is that I can't figure out anyway to code the script to always show the sub-topic right under the associated main topic and all in order. If I add a sub-topic to one of the upper main topics it shows up at the bottom; hence the addition of the topic_order field. So right now it's basically a mess and I can't figure out how to code everything to work correctly. I have searched the forums here as well as several other sites and cannot get any clues.
Hi All, I'm having trouble with an email I'm trying to send out. While testing my code, the email that my script sends has the "Reply-To" email address in the headers but when I click "reply", the recipient's email, $to in the code below, is inserted instead of the "Reply-To" email. Am I missing anything? Thanks for the help in advance! $to = "abc@email.com"; $headers = "From: " .$admin_name. "<" .$admin_email. ">\r\n"; $headers .= "Reply-To: " .$host_name. "<" .$host_email. ">\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "<br>"; $subject = "Subject"; $body = "Body"; mail($to, $subject, $body, $headers); I've already made fully working create topic, etc; what would I need to make to reply to a thread? I've gotten this so far... <?php $result = mysql_query("SELECT id FROM b ORDER BY id DESC"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf("<a href='reply.php?id=%s'>Reply</a><hr><br /><br />", $row[0]); } mysql_free_result($result); ?> reply.php?id=%s (%s equaling the thread id) when I click it, it does bring me to the appropriate page, but I don't know where to go from there. Any help? any other info you might need just ask ignore Ok I found the culprit and it's easy! Code: [Select] function timeAgo2($timestamp, $granularity=3, $format='d:H:i:s'){ $difference = $timestamp; if($difference < 0) return '0 seconds ago'; elseif($difference < 864000){ $periods = array('week' => 604800,'day' => 86400,'hours' => 3600,'min' => 60,'seconds' => 1); $output = ''; foreach($periods as $key => $value){ if($difference >= $value){ $time = round($difference / $value); $difference %= $value; $output .= ($output ? ' ' : '').$time.' '; $output .= (($time > 1 && $key == 'day') ? $key.'s' : $key); $granularity--; } if($granularity == 0) break; } return ($output ? $output : '0 seconds').''; } else return date($format, $timestamp); } Now I will use: Code: [Select] timeAgo2(136622,5) Which works and it will output: 2 days 14 hours 57 min 2 seconds But, if I add another "1" to it like this: Code: [Select] timeAgo2(1136622,5) It shows: Code: [Select] 14:03:43:42 Which is not right, it needs to show, 14 Days, 3hours 43minutes and 42 seconds.... Thank you, I finally explained myself better here, hope you understand This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=343248.0 This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=332508.0 Hi guys Just wanted to knw whats the php logic needed to create this function which shows current users viewing a topic I knw we can have a database table which stores the topic ID as well as user id and that way we can record who is viewing a topic but what happens when they leave? some users can just close there browser in which case I would never know when they left? thank you guys Hi there I have a MySQL database table that has multiple records which look like (1, Which of these are your favorite color(s)?, Red||Blue||Orange||Green, question-type1 ) I have written some PHP code in extracting that data into a HTML form. (The above data looks like a question with multiple options (radio buttons/checkboxes) below it). Below is what I'm trying to achieve: When the action is Submit: store the question number, user responses of the options , time stamp and user name into a new database table. I came to know that passing arrays will do the job, but I got stuck in the middle. Please see the attached documents that has the code. TIA [attachment deleted by admin] hmm im having some trouble tackling this problem i have a database table with topicname then 3 columns with 3 pdfs in each one all the files are stored in a directory called topicfiles in the server so like 3 topicnames with 3 files in each one with this page i want to make i want to display each topic name with the files under it calling it from the server like Code: [Select] topic 1 file1.pdf file2.pdf file3.pdf topic 2 file4.pdf file5.pdf file6.pdf topic 3 file71.pdf file8.pdf file9.pdf i tried using dhandler to access all files in the folder and only managed to display all of the files in rows using foreach loop was thinkin of using mysql query to access the topic name and then each file for that topic but not sure hmmm Hey Guys, I posted a topic titled "Error while executing PHP script for Like/Dislike button" in the forum but am unable to access the topic. The link to the topic is http://www.phpfreaks.com/forums/index.php?topic=353877.new;topicseen#new. Kindly help me as I an unable to locate/search for it. Thank you. Helo, I am new here. I have a simple " Like " plugin for Vanilla Forums which does it work nicely. Sadly, it won't sent notifications when someone likes our post. I have another plugin from the same author which gives notifications on Profile-Like aka Kick/Poke. I am trying to use the notification part of the Kick plugin ( which I modified at my best to " Like ") added to the " Like " plugin so that I will able to provide notifications to post-authors on receiving a " Like ". I have created a GitHub repo with my attempt so far. It would be nice if someone can help me find a final solution. Thanks https://github.com/meetdilip/Like hey guys im interested in the jquery notification scripts...where a user registers and then gets redirected to homepage where a notification pops up saying "thank you for registering".
now ive looked at a few examples online but im clueless to how each individiual notification pops up is it activated by the refering url?
would be good to know...but thats the only way to me that makes sense on how it works.
thank you
Hello, I want this to Block NULLS and When its not there own. Please help. <?php if($_GET['usercp'] == 'vinbox' && $_GET['id']) { ?> <?php $id="{$_GET['id']}"; if($_GET['id'] == null or $_GET['id'] == 0){ die("You have reached a Null Page. <a href=\"index.php\">Go back home</a>"); } $view_a = mysql_query("SELECT * FROM notifications WHERE id='$id'"); while($view_b = mysql_fetch_array($view_a)){ $msgid = $view_b['id']; $msgname = $view_b['title']; $msgdate = $view_b['sent']; $msgsender = $view_b['senderid']; $msgreciever = $view_b['msgreciever']; $msgtext = $view_b['text']; $msgread = $view_b['read']; } $msgdatee = date('D, M d, Y h:i A', strtotime($msgdate)); $recieverfind = mysql_query("SELECT * FROM users WHERE id='$msgsender'"); While($recieverfound = mysql_fetch_assoc($recieverfind)) { $username = $recieverfound['username']; $userid = $recieverfound['id']; } if($userid == $msgreciever) { if($msgread <= 0){ mysql_query("UPDATE notifications SET `read`='1' WHERE `id`='".$id."'"); } ?> <div class="usercp_body"><!-- UserCP Notification Sent Start --> <div id="dash_chart" class="notifications" style="width:100%;margin: 0 auto;"> <div class="notifications-header"> <h4><center>Viewing Message: <?php echo ucfirst($msgname); ?></center></h4> </div> <div class="notifications-content" style="padding:10px 10px 10px 10px;"> <i><b>Sent From: </b></i><?php echo $username; ?><br> <i><b>Date Sent: </b></i><?php echo $msgdatee ;?><br> <i><b>Message: </b></i><br><hr><?php echo ucfirst($msgtext); ?> <br><hr><br> <i><b>Reply: </b></i><textarea> </textarea> </div></div></div><!-- UserCP Notification Sent End --> <?php } else { echo "This Message does not Belong to you"; } } Sorry for short explanation. I'm very tired hi all,
how can i create a notification badge in php eg like when i have a new message, it will display on the nav indicating new message and the number of messages. thanks Hey guys what should i look for in a script to make a small script that gets the DB information and shows notifications? like messages(3) members(23) ..... i know count rows can do it.i think? I apologize ahead if this is really an Apache question, but I suppose it could be in either forum. I have a web directory that when anything is accessed within it or its children from a range of IP addresses, they are redirected to a new URL, like so: .htaccess Options +FollowSymlinks RewriteEngine On RewriteCond %{REMOTE_ADDR} ^111\.111\.111\. [OR] RewriteCond %{REMOTE_ADDR} ^222\.222\.222\. RewriteRule !^(.*redirects.*)$ http://www.somedomain.com/something.php [L,NC,R] something.php <?php $to = "Someone <some@email.com>"; $subject = "Some Subject"; $headers = 'From: Somebody <no_reply@someone.com>' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $VisitorIp=$_SERVER['HTTP_X_FORWARDED_FOR']; else $VisitorIp=$_SERVER['REMOTE_ADDR']; trim($VisitorIp); $body = "Someone of IP " . $VisitorIp . " accessed resource\n"; mail($to, $subject, $body, $headers); ?> The problem is that I do not know on how to get the specific resource (URL) the client tried to access into the email, which I'd also like (e.g. more referrer information). The IP address is no problem though. Any ideas? Hi, ive been looking all over for a script to send an email once users on my site register their details, is this possible? all i want is it to send their username and password. Also the same sort of thing is needed for the "lost password" button? Any help suggested would be great, many thanks. Web Form/Registration: Code: [Select] <form action="sendAd.php" method="post"> <h4 class="style7">Type of company (Removal, Transport, Storage, Insurance, Local Area or Other):<br /> <input type="text" name="type"/> <br />Company name:<br /> <input type="text" name="company_name"/> <br /> Location:<br /> <input type="text" name="location"/> <br /> Six bullet point description of your company:<br /> <textarea rows="6" cols="21" name="description" ></textarea> </h4> <h4 class="style7"> <br /> <input name="submit" type="submit" id="submit" value="List your ad" /> </h4> <p> </p> </form> SendAd.php: Code: [Select] <?PHP $user_name = ""; $password = ""; $database = "removal2"; $server = "server"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "INSERT INTO ads (type, company_name, location, description) VALUES ('" .$type. "', '" .$company_name. "', '" .$location. "', '" .$description. "')"; $result = mysql_query($SQL); mysql_close($db_handle); header( 'Location: http://www.removalspace.com/advert-confirm.php' ); exit(); } else { print "Database NOT Found "; mysql_close($db_handle); } ?> MOD EDIT: code tags added. Dear friends. Now I am doing Mobile APP by Flutter and Backend I use PHP, for normally using like get information and save information it's work by API concept. so now I would like to push notification to the mobile APP. is it can work by PHP or I need to use feature of firebase? |