PHP - Php, Could It Push Notification To Andriod And Iso App?
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? Similar TutorialsHi I found a php file ( http://www.howtocreate.co.uk/php/dnld.php?file=6&action=1 ) that acts as a fake push server and I am trying to make it work by actually pushing a another php file with no success yet. This PHP script provides a simple function to enable server push. All you need to do is tell it what file to serve, and update that file whenever a new version is available. See link for the code can anyone help please? What i want to do is to have it push ex. data.php file every x seconds but have yet to make it work. If I am not mistaking in the head or somewhere on the page add this line ( stated from there example ) Code: [Select] require('serverpush.php'); doServerPush('some_image.jpg','image/jpeg',1000);I changed some_image.jpg to data.php and delete 'image/jpeg', ( still tinkering ) but that caused errors tried other ways but errors again. can anyone help me like I said I would like to have this file push data.php if anyone can help I would be grateful. Thanks in advance for any help and remember I am a beginner and still learning. 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? 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 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? 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 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 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
I use the following code to create a 48x7 array for my application: Code: [Select] // Loop through each time division for($i=0; $i<$div; $i++) { // Loop through the week we're displaying for($j=0;$j<$dayPerPage; $j++) { $dateArray = getDate( mktime( 0, 0, 0, date("m"), date("d")+$j+$dateOffset, date("Y") ) ); $date = sprintf('%04d-%02d-%02d',$dateArray["year"],$dateArray["mon"],$dateArray["mday"]); $datetime[]="$time|$date"; list($start_date) = explode('|',$datetime[1]); list($end_date) = explode('|',end($datetime)); } $min += $step_size; if($min >= 60) { $min = 0; $hr++; } $time = sprintf('%02d:%02d:00',$hr,$min); }Now, I'm under the assumption that list($start_date) and list($end_date) should give me the beginning and ending dates inside the array (say 2011-10-01 and 2011-10-07), but instead I get the beginning and ending times in it ('00:00:00' AND '23:30:00'). Could someone clarify what I'm doing wrong and how I can fix it? I'm really new to php EDIT: Sorry... used the wrong tags for the code the first time around. Fixed. Hi Guys, I am having a small problem with an array. I want to push information from a form into an array. However each time I do it it just replaces the last entry in the array with the information in stead of adding a new value to the array. Code: [Select] <?php // if generate is pressed if(isset($_POST['generate'])){ // get values from form $name = htmlspecialchars($_REQUEST['add']); array_push($stack, $name); print_r($stack); } ?> Can anybody help? Thanks Ed I would like to have my site automatically email me about progress of users at certain times of the day. I am using PHP, but I think this is a server issue. I just need someone to point me in the right direction so I can search out the solution. Thank you. 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. i have the following which sends an email whenever a post is made within the topic the user is subscribed to. However it still sends the email to the person who made the reply. I need to take out the email of the poster if they are in the notification list. This is what i have but it doesnt seem to remove them. $notification_query = $db->query("SELECT u.user_id, u.user_email, u.user_username, n.notification_user_id FROM ".DB_PREFIX."members as u LEFT JOIN ".DB_PREFIX."notifications as n ON n.notification_user_id = u.user_id WHERE n.notification_topic_id = '$post_id'") or trigger_error("SQL", E_USER_ERROR); $num_rows = mysql_num_rows($notification_query); while ($notification_list = mysql_fetch_object($notification_query)) { $users4[] = $notification_list->user_email; } $emailAddress = implode(', ', $users4); if (in_array($_SESSION['user_username'], $emailAddress)) { $emailAddress = str_replace($_SESSION['user_username'], ' ', $emailAddress); } if ($num_rows >=1) { putenv('TZ=EST5EDT'); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: no-reply@thevault.0sites.net' . "\r\n"; $message .= "A Reply Has Been Made To {$_POST['subject']}.<br /><br />"; $message .= "You are receiving this message because you have subscribed to the topic {$_POST['subject']},<br /> which has a new post since your last one.<br />"; $message .= "Click the link below to view the new thread now.<br />"; $message .= "<a href=\"{$site_root}/index.php?forum={$forum_id}\"> {$site_root}/index.php?forum={$forum_id}&topic={$thread_topic_id}</a><br /> <br />To Unsubscribe from this topic visit the link below.<br /><br /> <a href=\"{$site_root}/subscribe.php?forum={$forum_id}&topic={$topic_id}&uid={$notification_list->user_id}&do=unsubscribe\"> {$site_root}/subscribe.php?forum={$forum_id}&topic={$topic_id}&uid={$notification_list->user_id}&do=unsubscribe</a><br /><br /> Thanks"; $subject = "A Reply Has Been Made To {$_POST['subject']}."; mail($emailAddress,$subject,$message,$headers); } } Hello, I defnitely don't consider myself a coder but have been installing and troubleshooting pre-made php scripts for a few years now and figure now is a good time to learn as I'm quite sick of having to rely on outsourced help I am currently trying to create a simple (hope so) script that will run on a cron every other minute to insert a specific piece of data each time a new member joins and it should only insert the data once based on criteria. Here's what I'm trying to do exactly with a php script check members table if field signup_date is TODAY's Date and if user_balance field is 0.00 then alter/update user_balance field 25.00 Now, I've hit a bit of a roadblock with getting the MySQL query format correct. The SIGNUP_DATE field in the database is DATETIME format and the like with wildcard thing isn't working for me. Is there anyone who can point me in the right direction with the proper wildcard date format? It'd be a great help. Anything at all is massively appreciated. Here's the code I have so far...the echo is in there so I can see if it's working correctly. I'm pretty sure I haven't got the right function to display the result of the query either but I think I can figure that out pretty easily. Code: [Select] <?php $today = date("Y-m-d"); mysql_connect("localhost", "DBUSER", "DBUSER") or die(mysql_error()); mysql_select_db("DBNAME") or die(mysql_error()); $sql1 = mysql_query("SELECT USER_NAME FROM members WHERE SIGNUP_DATE LIKE '$today%"); if($sql1 == false) { user_error("Query failed: " . mysql_error() . "<br />\n$query"); } elseif(mysql_num_rows($sql1) == 0) { echo "<p>Sorry, no rows were returned by your query.</p>\n"; } $memberseligible = mysql_fetch_array($sql1); echo "$memberseligible"; ?> i am working on this search engine. and in the advanced section you can turn on/off some of the options. So it you turn on an option it will search another table and so on. Instead of building a massive query and left joining lots of stuff. I tried a different approach. There is always a basic query and it returns the results to an array like this Code: [Select] $sql = mysql_query("SELECT SQL_CACHE id FROM table WHERE field LIKE '$getquery' ORDER BY field"); while ($row = mysql_fetch_array($sql)) { $idArray[] = $row['id']; } mysql_free_result($sql); and if something is turned on then it adds something like this: Code: [Select] if($_POST['value'] == "1") { $sql = mysql_query("SELECT SQL_CACHE table1_relation_id FROM table2 WHERE field2 LIKE '$getquery' ORDER BY field2"); while ($row = mysql_fetch_array($sql)) { $idArray[] .= $row['table1_relation_id']; } mysql_free_result($sql); } //end if so basicy i just continue the array and it keeps pumping ids into a big aray. after that i run array_unique and remove all duplicate results and then i foreach and get the whole item info ased on every id. it runs pretty fast. now i would like to make the second one a function. but when i do that it does not work. Code: [Select] function sample($query, $table, $field) { $sql = mysql_query("SELECT SQL_CACHE naziv_id FROM ".$table." WHERE ".$field." LIKE '$query'"); while ($row = mysql_fetch_array($sql)) { $return[] .= $row['naziv_id']; } mysql_free_result($sql); return $return; } before i put it into a function $idArray vas a single continuous array. And if i try to do it like this: Code: [Select] $arr[] = sample($query, "table1", "filed_id"); $arr[] .= sample($query, "table2", "filed_id"); it returns the result of the first array ok but if there are more then one results in other arrays it returns and arary inside of the array. like this: Code: [Select] array(4) { [0]=> array(2) { [0]=> string(4) "9057" [1]=> string(5) "14186" } [1]=> string(5) "Array" [2]=> string(5) "Array" [3]=> string(0) "" } and all i wanna have is a single id variable that has all the id's in it. like $array = 1,2,3,4,5 but from different sources/functions can you help? thank you so much. I need help for get this result in foreach loop.
ok64|33|37|Test1|Test2|Test3|
But with my looping i get this result:
ok64|Test1|33Test2|37|Test3|
<? $check = array('ok'); foreach($results as $rows) { array_push($check, $rows['votes']."|"); array_push($check, $rows['value']."|"); } ?> ? Is there an option somewhere in this cesspool infested IPB settings panel? Edited by Monkuar, 23 January 2015 - 10:17 PM. I have subscription system which want to allow people to add personal reminder notes including an email notification. For example, let's say I set up a social networking site based on gardening. Someone can log in and add a reminder that they a revolutionary new lawn mower goes on sale in six weeks time and they want to receive an email on that specific day in six weeks time of this event. I call it 'Gardening Notes' and use it to increase return rate by 50% a members of the gardening social networking site are very satisfied when using it. How would I do this? Does anyone have any advice? This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319172.0 Is thier some code I can use to Notifiy me of files that are downloaded from my site. I would like to put some public files (PDF) in a folder to where the public could download what ever, but I want to know who downloaded these files. Dont know much more than that just got the idea from another site cause they new I downloaded a file and I thought it would be a good idea on may site to do something like that. |