GuestofHonor Posted February 20, 2013 Share Posted February 20, 2013 Hello guyz, i need a help to stop a script from running after posting a message. Original code <?php if ($talk == true) { $check = Check_Link($chat, $user_file, $date); if ($check == true); else { if (strpos($chat, 'Stupid Bot') != 0 || strpos($chat, 'stupid bot') != 0) { //Save file + time $log = fopen($user_file,"a",1); $today = getdate(); $data = $date.'-'.$chat.'|'; fwrite($log, $data); fclose($log); $mess = "[color=blue][b]".$name."[/color] haha go [/b] :sleep"; post_cbox($mess); } elseif (strpos($chat, 'alt="thanks"/>') != 0 && strpos($chat, 'Gasolina') != 0 || strpos($chat, 'alt="thanks"/>') != 0 && strpos($chat, 'gasolina') != 0) { //Save file + time $log = fopen($user_file,"a",1); $today = getdate(); $data = $date.'-'.$chat.'|'; fwrite($log, $data); fclose($log); $mess = "@ [color=blue][b]".$name."[/b][/color] You Are Most welcome "; post_cbox($mess); } what i want to do is to stop script from writing user folder but still stop after posting the $mess, i tried exit and goto but it keep posting the message infinitly when i do. thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/ Share on other sites More sharing options...
AyKay47 Posted February 20, 2013 Share Posted February 20, 2013 Use stripos which is the case-insensitive version of strpos(), will save you some writing. Also, in the elseif block conditional statement, place parens around each && condition for correct order of operations: (this && that) || (this && that) I don't quite understand you logic, I believe you want the post_cbox() function to execute but do not want any data to be written to a file? Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1413625 Share on other sites More sharing options...
GuestofHonor Posted February 20, 2013 Author Share Posted February 20, 2013 Use stripos which is the case-insensitive version of strpos(), will save you some writing. Also, in the elseif block conditional statement, place parens around each && condition for correct order of operations: (this && that) || (this && that) I don't quite understand you logic, I believe you want the post_cbox() function to execute but do not want any data to be written to a file? Thanks for the reply this script was not written by me, but whoever wrote it made every thing write to log, now when it writes to log it will force users who the script reply to to wait 5 minutes before doing any more actions, i dont want them to wait for chat or for other things, thats why i asked if there's a way for the script to post the message without storing the name in the log. so i just want it to send message and stop without writing any file. Regards Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1413629 Share on other sites More sharing options...
AyKay47 Posted February 20, 2013 Share Posted February 20, 2013 Comment out the lines that are relevant to sending data to the log? I don't recommend removing them altogether as you may need them in the future, there is a reason the logic was implemented the way it was. Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1413632 Share on other sites More sharing options...
GuestofHonor Posted February 20, 2013 Author Share Posted February 20, 2013 Comment out the lines that are relevant to sending data to the log? I don't recommend removing them altogether as you may need them in the future, there is a reason the logic was implemented the way it was. can i explain the main concept of the whole script ? it is a bot that login to cbox chat box to give links to users, each user is allowed to get one link from the bot each 5 minutes or whatever i set time, but i dont want users to wait if they just chat with bot or bot chat with users. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1413638 Share on other sites More sharing options...
GuestofHonor Posted February 22, 2013 Author Share Posted February 22, 2013 No one is helping on this one !!! it shouldn't be that hard for PHP pro's !! all i want is for script to post msg and stop Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1414076 Share on other sites More sharing options...
Jessica Posted February 22, 2013 Share Posted February 22, 2013 die Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1414077 Share on other sites More sharing options...
AyKay47 Posted February 22, 2013 Share Posted February 22, 2013 can i explain the main concept of the whole script ? it is a bot that login to cbox chat box to give links to users, each user is allowed to get one link from the bot each 5 minutes or whatever i set time, but i dont want users to wait if they just chat with bot or bot chat with users. Thanks in advance this sounds a little different then the issue in the OP. If you do not want the script to write data to a log then remove the code that does so. Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1414079 Share on other sites More sharing options...
GuestofHonor Posted February 23, 2013 Author Share Posted February 23, 2013 this sounds a little different then the issue in the OP. If you do not want the script to write data to a log then remove the code that does so. if i remove the lines it will keep posting the message non stop ! Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1414330 Share on other sites More sharing options...
GuestofHonor Posted February 23, 2013 Author Share Posted February 23, 2013 die Thanks for your reply Jessica, please note that i'm like a noob in PHP so please be specific Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1414331 Share on other sites More sharing options...
GuestofHonor Posted February 23, 2013 Author Share Posted February 23, 2013 die i changed to: else { if (strpos($chat, 'Stupid Bot') != 0 || strpos($chat, 'stupid bot') != 0) { $mess = "".$name." haha go :sleep"; post_cbox($mess); die(); } and still kept posting sorry for the trouble Quote Link to comment https://forums.phpfreaks.com/topic/274726-php-exit/#findComment-1414336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.