Jump to content

Texan78

Members
  • Posts

    272
  • Joined

  • Last visited

Texan78's Achievements

Advanced Member

Advanced Member (4/5)

2

Reputation

6

Community Answers

  1. They are EXACTLY the same line numbers. I copy and pasted them into a notepad to save for later then commented out the DB connection to stop it from making connections. This.... /* Lets connect to the database */ //include('dbconn.php'); Has zero to do with the error as I still get the SAME error regardless if it is commented out or not. So ignore it even exists. Had I not posted that part at all then I am sure I would be getting completely different responses. No worries, thanks for the help. Its apparent no one is looking BEYOND what I am saying and only focusing on that being commented out instead of listening to what I am saying that it doesn't matter. I get the same error regardless even with waiting a couple hours which is plenty of time for the varnish cache to clear.
  2. So I guess I just fantasized that someone gained root access via shell. So I guess it is completely valid to comment out the entire query which renders the entire script useless. So I guess that if I uncomment the DB connection it will work perfectly fine with no errors correct? That is what you're saying right? Guess what, it is uncommented, the errors have returned. So now what all mighty know it all? What does your magic 8 ball have to say about that? Cool story bro? Yeah stick it keyboard warrior.
  3. Genius!!! Even better I should just remove the entire query! That should do the trick!
  4. Again, the errors were happening BEFORE I commented out the code. I commented it out because it was throwing errors in the logs BEFORE commenting it out. It was also causing performance and resource issues on my host which was causing the page not to load. I commented it out in the script AND on the page it was being included on until I could resolve the issue. Once I did both those things the page loaded AND the errors went away.
  5. Yes, it is commented out because it was causing serious issues with the page loading so I commented it out until I could get this sorted.
  6. I have a serious issue. I am not sure if I have been hacked or what but my site is completely messed up. I have a ton of these errors in the error log and I am not sure what is causing this. I don't recall this being part of the script Which is referring to this line. //lets execute the query $executingFetchQuery = $mysqli->query("SELECT `StreamStatus` FROM streamdb WHERE 1"); if($executingFetchQuery) { while($arr = $executingFetchQuery->fetch_assoc()) { $resultArr[] = $arr['StreamStatus'];//storing values into an array } } This is the full code. /* Lets connect to the database */ //include('dbconn.php'); $resultArr = array();//to store results //lets execute the query $executingFetchQuery = $mysqli->query("SELECT `StreamStatus` FROM streamdb WHERE 1"); if($executingFetchQuery) { while($arr = $executingFetchQuery->fetch_assoc()) { $resultArr[] = $arr['StreamStatus'];//storing values into an array } } $counts = array_count_values($resultArr);//lets count the results $online = $counts['true']; // Let's assign the table some styles $divStyle = "padding:5px; margin:auto; margin-bottom:20px"; // Lets assemble the banners to display $notifyOffline = "<div class='alert alert-danger' style='{$divStyle}' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no chasers streaming at this time.'> There are currently no chasers streaming at this time.</div>"; $notify1Online = "<div class='alert alert-success' style='{$divStyle}' role='alert' data-toggle='tooltip' data-placement='top' title='There is currently 1 chaser streaming LIVE...'> There is currently 1 chaser streaming LIVE... </div>"; $notifyOnline = "<div class='alert alert-success' style='{$divStyle}' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently ".$online." chasers streaming LIVE...'> There are currently ".$online." chasers streaming LIVE... </div>"; //lets display the banners if ( $online == "1" ) { echo $notify1Online; } elseif ( $online >= "2" ) { echo $notifyOnline; } else { echo $notifyOffline; } Any and ALL help would be greatly welcomed. -THANKS!
  7. Still looking for a solution to this that implements into my current script that will filter certain values and then sort them.
  8. Still no solution to what I think is a very simple question.
  9. Should I guess how to implement those snippets or you going to show me an example of how to implement it into my current code since you're not making any sense or listening to anything I am saying. I also can't ditch the IF statement because it is doing two different things as it is suppose to. Have you ever heard of the KISS method?
  10. This is doing just that. What is set in the array is style classes and IDs. From what I can tell that is assigning it to the same variable $type. This is the alert or event ['Tornado Warning'] and these are styles array('Tornado', 'AlertTornado'); $type = array(); $type['Tornado Warning'] = array('Tornado', 'AlertTornado'); $type['Severe Thunderstorm Warning'] = array('SevereThunderstorm','AlertSevereThunderstorm'); $type['Flash Flood Warning'] = array('FlashFlood','AlertFlood'); $type['Flood Warning'] = array('FlashFlood','AlertFlood'); How else am I going to pass the values to it to filter out what I want? It's not just going to know if you don't pass something to it to filter through. Like I said, those snippets would probably be useful it you included examples of how to implement it into my current code.
  11. Why on Gods green earth would you ever want to assign your style classes and IDs to the same variable that's outputting data? Lastly, the switch is being used in more than just once script on other areas of the site. Which is why it is being used in a included file so I can pull what I need instead of having to write the logic out every single time across multiple scripts. Which BTW, was something that was suggested by a member of this forum several years ago when that script was originally created. As I have mentioned before as well, that is the thing about PHP and online forums. You will get multiple ways to do the same thing and not everyone is going to agree. Those snippets would probably be useful it you included how to implement it into my current code because this below doesn't work and throws tons of errors. // get path info & protect for cross-site scripting vulnerability $sri = ($_SERVER['REQUEST_URI']) ? str_replace('#SA', '', htmlspecialchars(strip_tags($_SERVER['REQUEST_URI']))) : ''; $error = false; //Set initial output to false $AlertData = false; $entries = simplexml_load_file($data); if(count($entries)): //Registering NameSpace $entries->registerXPathNamespace('prefix', 'http://www.w3.org/2005/Atom'); $result = $entries->xpath("//prefix:entry"); if(!$result){ $error = true; } foreach ($result as $entry): $updated = $entry->updated; if($updated == ''){ $error = true; } $Updated = date("D, M d, g:i a", strtotime($updated)); $summary = $entry->summary; if($summary == ''){ $error = true; } // Replaces all triple periods with single periods $summary = trim(str_replace('...', '.', $summary), '.') . '.'; //now capitalize every letter after a . ? and ! followed by space $Summary = preg_replace_callback('/([.!?*])\s*(\w)/', function ($matches) { return strtoupper($matches[1] . ' ' . $matches[2]); }, ucfirst(strtolower($summary))); $event = $entry->children("cap", true)->event; if($event == ''){ $error = true; } $updated = $entry->updated; $link = $entry->link; $effective = $entry->children("cap", true)->effective; $expires = $entry->children("cap", true)->expires; $updated = date("l M jS, g:i A", strtotime($updated)); $effectiveDate = date("l M jS, g:i A", strtotime($effective)); $expiresDate = date("D M jS, g:i A", strtotime($expires)); $status = $entry->children("cap", true)->status; $severity = $entry->children("cap", true)->severity; $urgency = $entry->children("cap", true)->urgency; $area = $entry->children("cap", true)->areaDesc; //include ('alertColors.php'); $type = array($event); $type['Tornado Warning'] = array('Tornado', 'AlertTornado'); $type['Severe Thunderstorm Warning'] = array('SevereThunderstorm','AlertSevereThunderstorm'); $type['Flash Flood Warning'] = array('FlashFlood','AlertFlood'); $type['Flood Warning'] = array('FlashFlood','AlertFlood'); $alertID = ''; $alertClass = ''; if(isset($type[$event])) { list($alertID,$alertClass) = $type[$event]; } // Let's assign the table some styles $divNoStorms = "padding:5px; width:50%; margin:auto; margin-top:5px; margin-bottom:5px"; // If no storms were in the source, set no storm message if($error) { $AlertData .= "<div style='{$divNoStorms}' class='alert alert-danger' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n"; $AlertData .= "{$noStormMessage}\n"; $AlertData .= "</div>\n"; } else { $AlertData .= "<div class='col-md-3'>\n"; $AlertData .= "<div id='{$alertID}' class='individualAlert'>\n"; $AlertData .= "<div class='text_alert'>\n"; $AlertData .= "<span class='title {$alertClass}'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i>{$type}</span>\n"; $AlertData .= "<span class='state'>{$stateShort}</span>\n"; $AlertData .= "<span class='counties'>{$area}</span>\n"; $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n"; $AlertData .= "</div>\n"; $AlertData .= "<div class='alert__view'>\n"; $AlertData .= "<span class='fa fa-eye'></span>\n"; $AlertData .= "</div>\n"; $AlertData .= "</div>\n"; } $AlertData .= "</div>\n"; endforeach; endif; echo $AlertData;
  12. None of that makes any sense to me because I have no idea where that is to be used or how to implement it into my current script. Guess I will have to hire someone for 5 mins to update it.
  13. Well one brain fart solved. This seems to work for producing 4 columns per row. Will need to keep an eye on it to see if it messes up when there isn't equal number of entries. // If no storms were in the source, set no storm message if($error) { $AlertData .= "<div class='alert alert-danger' style='padding:5px;' role='alert' data-toggle='tooltip' data-placement='top' title='There are currently no active severe weather alerts.'>\n"; $AlertData .= "{$noStormMessage}\n"; $AlertData .= "</div>\n"; } else { $AlertData .= "<div class='col-md-3'>\n"; $AlertData .= "<div id='{$alertID}' class='individualAlert'>\n"; $AlertData .= "<div class='text_alert'>\n"; $AlertData .= "<span class='title {$alertClass}'><i class='fa fa-exclamation-triangle severe-icon__tornado'></i> {$event}</span>\n"; $AlertData .= "<span class='state'>{$stateShort}</span>\n"; $AlertData .= "<span class='counties'>{$area}</span>\n"; $AlertData .= "<span class='expires'>Expires: {$expiresDate}</span>\n"; $AlertData .= "</div>\n"; $AlertData .= "<div class='alert__view'>\n"; $AlertData .= "<span class='fa fa-eye'></span>\n"; $AlertData .= "</div>\n"; $AlertData .= "</div>\n"; } $AlertData .= "</div>\n"; endforeach; endif; echo $AlertData; <div class="panel-body" style="background-color: #878787; padding: 5px;"> <div class='row'> <div id="alerts"></div> </div> </div> So last issue is only pulling certain events or in this case "alerts" and prioritizing them so they will show in a certain order. This one seems to be puzzling me.
  14. No worries, long hours in front of a computer can melt your brain for sure. Yes, those are the events and the order of display. Here is the complete script. https://www.tehplayground.com/kjbl8UqUd3EyA0fp
  15. Parsing the XML file is not my issue. The specific nodes I am parsing are in my original post within the first code block. I am able to do that just fine and create variables to insert into the HTML. The issues are as follows... 1. Only show certain events and sort them by priority to show certain ones first. $event = $entry->children("cap", true)->event; if($event == 'Tornado Warning, Severe Thunderstorm Warning, Flash Flood Warning, Flood Warning') 2. Dynamically create the Bootstrap columns (4) for each row to display the parsed information.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.