Jump to content

Boxerman

Members
  • Posts

    275
  • Joined

  • Last visited

Everything posted by Boxerman

  1. $server = 'LIAMJAY-PC\SQLEXPRESS'; $link = mssql_connect($server, 'username', 'password'); if (!$link) { die(print_r( sqlsrv_errors(), true)); } Try that, not tested.
  2. How are you hosting? WAMP? if so make sure you installed the right version (i.e 32 bit for 32 bit) most people get this when they install the 32bit on a 64 bit system.
  3. Sorry, to add something else to the questions. When you say "I basically want to run one query which will return the number of items that a account has." did you want to output * or did you want to COUNT ?
  4. There are some great places to learn some stuff on Google - w3schools - php snippets etc... some websites offer a sample code where you need to fix it etc. Like myself - Google taught me the basics!
  5. So would: <? $hosts = array( array ( "hostdescription" => "B1", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "B2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BB1","hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BB2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BB3", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBB1", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBB2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBBB1", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBBB2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBBB3", "hostaddress" => "IP HIDDEN" ) ); $pingcount = 1; foreach ($hosts as $host){ $hostdescription = $host["hostdescription"]; $hostaddress = $host["hostaddress"]; exec("ping -c $pingcount -w $pingcount $hostaddress", $pingoutput, $Spingstatuscode); if($Spingstatuscode === 1){ $to = "EMAIL HIDDEN"; $subject = "SERVER DOWN"; $message = "ATTENTION: $hostdescription is currently down please investigate"; $headers .= "From: EMAIL HIDDEN\r\n"; $mail_sent = @mail( $to, $subject, $message, $headers ); } ?> Work?
  6. But this will still send multiple emails? right? as its in a loop?
  7. Hi there, Thanks for the response, however from what i can see, this will send the status of all servers. What i would like to get is a way off builiding the list of DOWN (pingstatus != 1) and sending just the down server via email while ignoring the up ones. Thanks again buddy! B-Man
  8. Evening all, I'm trying to get a script then will run on a CRON job at some point. it works as you see it, however when more than one server is down it sends a new email for every server, how would i go about getting it to grab all down servers and sending in just 1 email? Thanks guys! (code below). <? $hosts = array( array ( "hostdescription" => "B1", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "B2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BB1","hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BB2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BB3", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBB1", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBB2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBBB1", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBBB2", "hostaddress" => "IP HIDDEN" ), array ( "hostdescription" => "BBBB3", "hostaddress" => "IP HIDDEN" ) ); $pingcount = 1; foreach ($hosts as $host){ $hostdescription = $host["hostdescription"]; $hostaddress = $host["hostaddress"]; exec("ping -c $pingcount -w $pingcount $hostaddress", $pingoutput, $Spingstatuscode); if($Spingstatuscode === 0){ echo("$hostdescription ($hostaddress) is Up <BR>"); }else{ echo("$hostdescription ($hostaddress) is Down <BR>"); $to = "EMAIL HIDDEN"; $subject = "SERVER DOWN: $hostdescription"; $message = "ATTENTION: $hostdescription is currently down please investigate"; $headers .= "From: EMAIL HIDDEN\r\n"; $mail_sent = @mail( $to, $subject, $message, $headers ); } } ?>
  9. MORE INFO: This is pinging from Linux to a windows box
  10. Hi guys, wacking together a ping script with alert however, i cant seem to get it to work no matter what the IP is it says UP! <? $hosts = array( array ( "hostdescription" => "B01","hostaddress" => "REALIPHIDDEN" ), array ( "hostdescription" => "B02", "hostaddress" => "REALIPHIDDEN" ) ); $toemail = "email@mail.com"; $fromemail = "ALERTER@mail.com"; $pingcount = 1; foreach ($hosts as $host){ $hostdescription = $host["hostdescription"]; $hostaddress = $host["hostaddress"]; exec("ping -c $pingcount -w $pingcount $hostaddress", $pingoutput, $Spingstatuscode); if($pingstatuscode == 0){ echo("$hostdescription ($hostaddress) is Up <BR>"); }else{ echo("$hostdescription ($hostaddress) is Down <BR>"); mail($toemail,"Host Down","$hostdescription ($hostaddress) is Down!","From: $fromemail"); } } ?> Can a second set of eyes see where im going wrong? Thanks, B-Man
  11. Hi there, Thanks for your help. Currently im in the stages of using a linux box to grab windows disk sizes. That being said, is there any basic scripts floating around (i have tired searching but has appeared unsuccessful).
  12. Hi guys, I'm trying to build a script which will sum up all the hard drive space and remaining space on several server on the network. My question is, is this possible considering to access each drive it requires a username and password? What i want to get is: SERVERNAME - C:\ - 12GB remaining of 120GB SERVERNAME2 - C:\ - 1GB remaining of 120GB etc these are all on the same network. Is this possible? if so can someone point me in the right way? Many thanks guys! B-Man
  13. As stated above the website works when goin to test.com/?movies but not when going to test.com/movies
  14. I have tested both ways For example: If I got to test.com/home this shows a blank page But... If I go to test.com/?home this shows correctly. It's confusing me now.
  15. Please note this is the new code: RewriteEngine On Options +FollowSymlinks RewriteRule ^watch/([a-z0-9-/]+)$ index.php?menu=watchmovie&perma=$1 [L] RewriteRule ^([a-z0-9-/]+)\.html$ index.php?menu=$1 [L] RewriteRule ^pages/([a-z0-9-/]+) index.php?menu=page&permalink=$1 [L] RewriteRule ^movies/ /index.php?menu=movies [L] RewriteRule ^tv-shows index.php?menu=tv-shows [L] RewriteRule ^home index.php?menu=home [L] RewriteRule ^([a-zA-Z0-9-]+)/season/([0-9]+)/episode/([0-9]+)$ index.php?menu=episode&perma=$1&season=$2&episode=$3 [L] RewriteRule ^([a-zA-Z0-9-]+)/season/([0-9]+)$ index.php?menu=show&perma=$1&season=$2 [L] RewriteRule ^([a-zA-Z0-9-]+)$ index.php?menu=show&perma=$1 [L]
  16. Sorry I forgot. Basically you have to put /?home in order for it to work. It does not work when doing /home
  17. Hi guys could someone just double check this for me please I need a fresh set of eyes. RewriteEngine On RewriteRule ^/admin /admin [L] RewriteRule ^/?watch/([a-z0-9-/]+)$ index.php?menu=watchmovie&perma=$1 [L] RewriteRule ^/?([a-z0-9-/]+)\.html$ index.php?menu=$1 [L] RewriteRule ^/?pages/([a-z0-9-/]+) index.php?menu=page&permalink=$1 [L] RewriteRule ^/?movies index.php?menu=movies [L] RewriteRule ^/?tv-shows index.php?menu=tv-shows [L] RewriteRule ^/?home index.php?menu=home [L] RewriteRule ^/?([a-zA-Z0-9-]+)/season/([0-9]+)/episode/([0-9]+)$ index.php?menu=episode&perma=$1&season=$2&episode=$3 [L] RewriteRule ^/?([a-zA-Z0-9-]+)/season/([0-9]+)$ index.php?menu=show&perma=$1&season=$2 [L] RewriteRule ^/?([a-zA-Z0-9-]+)$ index.php?menu=show&perma=$1 [L] Thanks!
  18. HI guys! Just a quickie (i hope) I've been playing and failing at changing a space for - here's an example: CURRENT: /watch/movie%20title WANTED: /watch/movie-title Here is what i have so far: RewriteRule ^watch/([^/\.]+)/?$ watch.php?title=$1 [L] Thanks all!
  19. Jordan, sorry for the slow response. After leaving this for a few hours and coming back it was clear as daylight. If this helps anyone else. It was because I was doing watch.php?id= where I should of done watch.php?title= Thanks again Jordan.
  20. Hi there, thanks for your post. [/font][/color]<? /* function to return the first N words of a string */ function shorten_string($string, $wordsreturned) { $retval = $string; $array = explode(" ", $string); if (count($array)<=$wordsreturned) { $retval = $string; }else{ array_splice($array, $wordsreturned); $retval = implode(" ", $array)." ..."; } return $retval; } /* check to see if an article has been selected */ if(!$_GET['title']) { $query_title = NULL; }else{ $query_title = $_GET['title']; // you should use either mysql_real_escape_string or mysqli_real_escape_string here } /* set the number of words for the brief */ $N = 15; /* if id is set display the news */ if(isset($query_title)) { $query = "SELECT * FROM movies WHERE title='$query_title' ORDER BY id DESC"; $result = mysql_query($query); $row = mysql_fetch_array($result); $title = $row['title']; $timestamp = $row["added"]; $format='F j, Y, g:i a'; $formatedTime = date($format, strtotime($timestamp)); $imdb_id = $row['imdbid']; $imdb = new IMDb(true); $q = "$imdb_id"; $imdb->summary=true; $movie = $imdb->find_by_id($q); ?><p> <b><font size="5"><? print_r($movie->title);?> (<? print_r($movie->year);?>)</font> </b><br /> <? print_r($movie->tagline); ?></p><br> <?php $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android"); $palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS"); $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); if ($iphone || $ipod == true){ ?> <iframe width='200' height='150' src='http://truvibefm.com/movies/<? echo "".$row['filename'].""; ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder='0' allowfullscreen></iframe><br> <? }else{ ?> <video src="http://truvibefm.com/movies/<? echo "".$row['filename'].""; ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls/> <script type="text/javascript" src="jwplayer.js"></script> <script type='text/javascript' src='swfobject-2.2.js'></script> <div id="movie"> <iframe width='200' height='150' src='http://truvibefm.com/movies/<? echo "".$row['filename'].""; ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder='0' allowfullscreen></iframe></div> <script type="text/javascript"> jwplayer("movie").setup({ flashplayer: "player.swf", file: "http://truvibefm.com/movies/<? echo "".$row['filename'].""; ?>", autostart: "true", bufferlength: "1", smoothing: "0" }); </script> </video> <br> <? } } ?> Posted At: <?php echo $formatedTime ?> <br><br>[color=#282828][font=helvetica, arial, sans-serif] This now display the title in the URL = watch.php?id=American%20Fails This however does now grab the data from the database to display the title and the movie url etc, instead i get the following errors: Notice: Undefined index: title in C:\xampp\htdocs\devbox\watch.php on line 137 and Notice: Undefined index: formatedTime in C:\xampp\htdocs\devbox\watch.php on line 137 Any advice on this?
  21. If any more info is require please let me know.
  22. Evening all, The mission is to change the below script from grabbing the $id to grabbing the $title I have no idea where to start or what to do, anything to help is much welcome. <? /* function to return the first N words of a string */ function shorten_string($string, $wordsreturned) { $retval = $string; $array = explode(" ", $string); if (count($array)<=$wordsreturned) { $retval = $string; }else{ array_splice($array, $wordsreturned); $retval = implode(" ", $array)." ..."; } return $retval; } /* check to see if an article has been selected */ if(!$_GET['id']) { $id = 0; }else{ $id = (int) $_GET['id']; } /* set the number of words for the brief */ $N = 15; /* if id is set display the news */ if($id>0) { $query = "SELECT * FROM movies WHERE id='$id' ORDER BY id DESC"; $result = mysql_query($query); $row = mysql_fetch_array($result); $title = $row['title']; $timestamp = $row["added"]; $format='F j, Y, g:i a'; $formatedTime = date($format, strtotime($timestamp)); $imdb_id = $row['imdbid']; $imdb = new IMDb(true); $q = "$imdb_id"; $imdb->summary=true; $movie = $imdb->find_by_id($q); ?><p> <b><font size="5"><?PHP print_r($movie->title);?> (<? print_r($movie->year);?>)</font> </b><br /> <? print_r($movie->tagline); ?></p><br> <?php $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android"); $palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS"); $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry"); $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); if ($iphone || $ipod == true){ ?> <iframe width='200' height='150' src='http://*****/movies/<? echo "".$row['filename'].""; ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder='0' allowfullscreen></iframe><br> <? }else{ ?> <video src="http://****/movies/<? echo "".$row['filename'].""; ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls ?>" width="500" height="300" controls/> <script type="text/javascript" src="jwplayer.js"></script> <script type='text/javascript' src='swfobject-2.2.js'></script> <div id="movie"> <iframe width='200' height='150' src='http://*****.com/movies/<? echo "".$row['filename'].""; ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder="0" allowfullscreen ?>' frameborder='0' allowfullscreen></iframe></div> <script type="text/javascript"> jwplayer("movie").setup({ flashplayer: "player.swf", file: "http://******/movies/<? echo "".$row['filename'].""; ?>", autostart: "true", bufferlength: "1", smoothing: "0" }); </script> </video> <br> <? } } ?> Posted At: <?php echo $formatedTime ?> I have tried to change all id's to title but that failed. Thanks guys!
  23. Super that makes sense, i will test this. Thank you.
  24. Evening all, Your mission if you choose to accept is... My problem is, at the current moment i have the following url: movie.php?id=1 where i would like to rewrite to /watch/title-of-movie-here How would i go about this? what do i need to do? Many thanks all.
  25. I missed that out. Sorry! Thanks for the help both of you! this appeared to have worked! Many thanks to all.
×
×
  • 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.