• My website's officially gone down the shitter, need help fixing.
    16 replies, posted
  • Avatar of Tools
  • Right, so I'm a horrible coder, but I do my best which is enough for me. I have this problem that my entire website has just stopped working all of sudden. I have no idea why, and I'm pretty much giving up. I need some professionel help fixing it this time. If you're willing to take a short look at my code, feel free to post and I'll gladly PM you the source. Thanks in advanced.
  • Avatar of Jacko2007
  • It's going to be much easier if you paste the code onto the forum so that everyone can have a look at it and offer advice. If you're a horrible coder we can try and help combat some fundamental problems.
  • Avatar of rieda1589
  • Well what kinda site is it? PHP, using mysql? any javascript? It just looks like the connection is closing before anything gets sent, like [php]<?php die(); ?>[/php]
  • Avatar of Tools
  • [QUOTE=Jacko2007;20257051]It's going to be much easier if you paste the code onto the forum so that everyone can have a look at it and offer advice. If you're a horrible coder we can try and help combat some fundamental problems.[/QUOTE] Right. Index.php [php]<html><head> <title>Scallex - No idea, I've lost track.</title> <script src="jquery.js"></script> <meta name="description" content="Hurr.."> <meta name="keywords" content="Tools is a faggot"> <meta name="copyright" content="Copyright Scallex 2010"> <meta name="author" content="Tools"> <meta name="email" content="tools@scallex.net"> <meta name="Charset" content="US-ASCII"> <meta name="Distribution" content="Global"> <meta name="Rating" content="General"> <meta name="Robots" content="INDEX,FOLLOW"> <meta name="Revisit-after" content="1 Day"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <!-- shit going wild --> <?php require_once('functions.php'); $web = $_SERVER['REQUEST_URI']; $host = 'http://'.$_SERVER['SERVER_NAME']; ?> <!--styles--> <link rel="stylesheet" type="text/css" href="styles.css" /> <!--end styles--> <body bgcolor="#373737" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table id="Table_01" width=850 border="0" cellpadding="0" cellspacing="0"> <tr> <a href="<?php echo $host; ?>"><img src="images/logo.png"></a> </td> </tr> <tr> <td background="images/index_05.gif" width=14 height=26></td> <td background="images/index_06.gif" height=26 width=100></td> <td background="images/index_07.gif" width=16 height=26></td> <td>-</td> <td background="images/index_10.gif" width=28 height=26></td> <td bgcolor="#292929" width=650><a href="http://scallex.net<?php echo $web; ?>"><img src="./images/dk.jpg"></a><a href="http://scallex.com<?php echo $web; ?>"><img src="./images/usa.jpg"></a></td> <td background="images/index_12.gif" width=29 height=26></td> </tr> <tr> <td bgcolor="#292929"></td> <td background="images/index_15.gif" height=90%> <!--menu--> <?php require_once('menu.php'); ?> <!--/menu--></td> <td bgcolor="#292929"></td> <td>-</td> <td bgcolor="#292929"></td> <td bgcolor="#292929"> <!--everything--> <?php require_once('main.php'); ?> <!--/everything--></td> <td bgcolor="#292929"></td> </tr> <tr> <td background="images/index_20.gif" width=14 height=27></td> <td background="images/index_21.gif" width=80 height=27></td> <td background="images/index_22.gif" width=16 height=27></td> <td>-</td> <td background="images/index_23.gif" width=28 height=27></td> <td bgcolor="#292929"><font size="1" face="Comic Sans MS" color="#CCCCCC">Best viewed in 1024x768 or above.</font></td> <td background="images/index_25.gif" width=29 height=27></td> </tr> </table> </center> <!-- it's all over mate :( --> </body> </html>[/php] Menu.php [php]<?php //Mysql stuff\\ $mysql = @mysql_connect('scallex.com', '****', '***') or print('Unable to contact Database'); @mysql_select_db('scallexc_info', $mysql) or print('Unable to select Database'); $q = "SELECT * FROM types"; $r = mysql_query($q, $mysql); html('<table border="0"><font color="#FFFFFF">'); while($data = mysql_fetch_array($r)) { html('<div id="div'.$data['types'].'">'.$data['types'].'</div>'); $epQ = "SELECT * FROM menus WHERE type = '".$data['types']."'"; $epGet = mysql_query($epQ, $mysql); echo '<div id="eps"><div id="ep'.$data['types'].'">'; while($epGot = mysql_fetch_array($epGet)) { html('<a class="menu" href="?b='.$epGot['link'].'">'.$epGot['menus'].'</a><br />'); } echo '</div></div>'; } echo '<script> $(document).ready(function () {'; $q = "SELECT * FROM types"; $r = mysql_query($q, $mysql); while($data = mysql_fetch_array($r)) { echo '$("#ep'.$data['types'].'").slideToggle("slow"); '; } echo '});'; $q = "SELECT * FROM types"; $r = mysql_query($q, $mysql); while($data = mysql_fetch_array($r)) { echo ' $("#div'.$data['types'].'").click(function () { $("#ep'.$data['types'].'").slideToggle("slow"); });'; } echo '</script>'; echo '</font></table>'; mysql_close(); ?>[/php] Main.php [php]<?php $browse = mysql_escape_string($_GET['b']); $episode = mysql_escape_string($_GET['e']); $season = mysql_escape_string($_GET['s']); $ephost = mysql_escape_string($_GET['h']); $host = $_SERVER['HTTP_HOST']; $web = $_SERVER['REQUEST_URI']; $address = 'http://'.$_SERVER['SERVER_NAME'].$web; $address = str_replace("&h=", "", $address); $address = str_replace("us", "", $address); $address = str_replace("dk", "", $address); $row = 0; echo '<table><tr>'; if(empty($ephost)) { if($host == "scallex.com" OR $host == "www.scallex.com") { $country = "us"; } elseif($host == "scallex.net" OR $host == "www.scallex.net") { $country = "dk"; } } else { if($ephost == "us") { $country = "dk"; } if ($ephost == "dk") { $country = "us"; } } if(!empty($browse) && empty($season)) { //Mysql stuff\\ $mysql = @mysql_connect('scallex.com', '*****', '****') or die('Unable to contact Database'); @mysql_select_db('scallexc_info', $mysql) or die('Unable to select Database'); //find excistance $q = "SELECT * FROM menus WHERE shortname = '".$browse."'"; $r = mysql_query($q, $mysql); $count = mysql_num_rows($r); if($count == 0) { echo 'Show not found. Please check the URL.'; } else { $q = "SELECT * FROM series WHERE series = '".$browse."' ORDER BY season ASC"; $r = mysql_query($q, $mysql); while($data = mysql_fetch_array($r)) { if($row == 6) { $row = 1; $line = "</tr><tr>"; } else { $row++; $line = ""; } echo $line.'<td class="off" onmouseover="this.className=\'on\'" onmouseout="this.className=\'off\'"><a href="?s='.$data[season].'&b='.$browse.'"><img src="./images/'.$browse.'/'.$data[img].'.jpg"><br><font size="1" face="Comic Sans MS" color="#CCCCCC">Season '.$data[season].'</font></a></td>'; } } mysql_close(); } elseif(!empty($season) && empty($episode)) { //Mysql stuff\\ $mysql = @mysql_connect('scallex.com', '****', '****') or die('Unable to contact Database'); @mysql_select_db('scallexc_info', $mysql) or die('Unable to select Database'); $q = "SELECT * FROM episodes WHERE series = '".$season."' AND host = '".$country."' ORDER BY episode ASC"; $r = mysql_query($q, $mysql); $count = mysql_num_rows($r); if($count == 0) { echo 'No episodes found. Please check the URL or <a href="'.$address.'&h='.$country.'">switch host</a>.'; } else { while($data = mysql_fetch_array($r)) { if($browse == $data['name']) { if($row == 6) { $row = 0; $line = "</tr><tr>"; } else { $row++; $line = ""; } post_episode($line, $browse, $season, $data[episode], $data[img], $data[ep_name]); } } } mysql_close(); } elseif(!empty($browse) && !empty($season) && !empty($episode)) { require_once('player.php'); } elseif(empty($browse)) { $news = 'So I\'m almost done now, and all I need is to upload all the episodes to our new host at hosting24.com, which is by the way an excellent host.'; text($news); } echo '</tr></table>'; ?>[/php] player.php [php]<?php //Mysql stuff\\ $mysql = @mysql_connect('scallex.com', '****', '****') or die('Unable to contact Database'); @mysql_select_db('scallexc_info', $mysql) or die('Unable to select Database'); $browse = mysql_real_escape_string($_GET['b']); $episode = mysql_real_escape_string($_GET['e']); $season = mysql_real_escape_string($_GET['s']); $host = $_SERVER['HTTP_HOST']; //danish or us link?\\ if($host == "scallex.net") { $q = "SELECT * FROM episodes WHERE name = '".$browse."' AND series = '".$season."' AND episode = '".$episode."' AND host = 'dk'"; } else { $q = "SELECT * FROM episodes WHERE name = '".$browse."' AND series = '".$season."' AND episode = '".$episode."' AND host = 'us'"; } //attempt find episode $r = mysql_query($q, $mysql); $worked = mysql_num_rows($r); $r = mysql_fetch_array($r); //found episode? if($worked == 0) { echo 'Unable to find episode matching settings. Attempting a different location...'; //trying again\\ if($host == "scallex.net") { $q = "SELECT * FROM episodes WHERE name = '".$browse."' AND series = '".$season."' AND episode = '".$episode."' AND host = 'us'"; } else { $q = "SELECT * FROM episodes WHERE name = '".$browse."' AND series = '".$season."' AND episode = '".$episode."' AND host = 'dk'"; } //episode found this time? $r = mysql_query($q, $mysql); $failed = mysql_num_rows($r); $r = mysql_fetch_array($r); if($failed == 0) { echo 'No episodes found.'; mysql_close(); } else { echo 'Found working link.'; //the player\\ ?> <script type="text/javascript" src="swfobject.js"></script> <div id="flashcontent">Player will show here</div> <script type="text/javascript"> var so = new SWFObject('mwplayer.swf','player','520','330','9'); so.addParam('wmode','opaque'); so.addParam('quality','high'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('flashvars','playerOpts=playListPath*^^<?php echo $r[url]; ?>*s'); so.write("flashcontent"); </script> <? mysql_close(); } } else { //the player\\ ?> <script type="text/javascript" src="swfobject.js"></script> <div id="flashcontent">Player will show here</div> <script type="text/javascript"> var so = new SWFObject('mwplayer.swf','player','520','330','9'); so.addParam('wmode','opaque'); so.addParam('quality','high'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('flashvars','playerOpts=playListPath*^^<?php echo $r[url]; ?>*s'); so.write("flashcontent"); </script> <? mysql_close(); } ?>[/php] functions.php [php]<?php function text($text) { echo "<font size=\"1\" face=\"Comic Sans MS\" color=\"#CCCCCC\">$text</font><br/>\n\r"; } function html($html) { echo "$html\n\r"; } function post_episode($line_, $browse_, $season_, $episode_, $img_, $name_) { echo "<!-- table for episode -->\n"; echo $line_."<td valign=\"top\" height=\"135px\" class=\"off\" onmouseover=\"this.className='on'\" onmouseout=\"this.className='off'\" width=101 height=80><a href=\"?b=".$browse_."&s=".$season_."&e=".$episode_."\"><img src=\"./images/".$browse_."/".$img_.".jpg\"><br/>\n<font size=\"1\" face=\"Comic Sans MS\" color=\"#CCCCCC\">E".$episode_." - ".$name_."</font></a></td>\n"; echo "<!-- end of episode table -->\n\r"; } ?>[/php] [editline]12:08AM[/editline] I fixed it. For whatever reason my index.php had changed to a filesize of 0 bytes. :raise:
  • Avatar of rieda1589
  • Try making all of your files chmod 755 so nothing but the owner can write to them (unless it's a temp dir or something you're actively changing) so it won't happen again.
  • Avatar of Tools
  • [QUOTE=rieda1589;20257496]Try making all of your files chmod 755 so nothing but the owner can write to them (unless it's a temp dir or something you're actively changing) so it won't happen again.[/QUOTE] Done. :buddy:
  • Avatar of :awesome:
  • just a question. why would you make a website for southpark when you can watch them in HD on their website for free?
  • [QUOTE=:awesome:;20288680]just a question. why would you make a website for southpark when you can watch them in HD on their website for free?[/QUOTE] If you don't live in the US you can only see season 1 - 11..
  • Avatar of turb_
  • I got banned unfairly. Obviously some mod agreed with me, and unbanned me.
  • Avatar of Wipmuck
  • [QUOTE=turb_;20429429]I got banned unfairly. Obviously some mod agreed with me, and unbanned me.[/QUOTE] Still fp is a any kind of warez nazi, What did you expect.
  • Avatar of turb_
  • Wasn't warez. It was a tool that aims to enhance the experience of trialling Sublime Text
  • Avatar of Wipmuck
  • [QUOTE=turb_;20429510]Wasn't warez. It was a tool that aims to enhance the experience of trialling Sublime Text[/QUOTE] But this is what the mods saw "OMG CRACK FOR PROGRAM YOU DIDN'T PAY FOR".
  • Avatar of turb_
  • Sublime Text has a free trial. The only limitation is that if you want to use it continuously, you must pay for it. My crack didn't remove that, only the nags