1. Post #1
    Gold Member
    Tools's Avatar
    November 2009
    6,317 Posts
    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.

  2. Post #2
    Jacko2007's Avatar
    April 2007
    534 Posts
    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.

  3. Post #3
    Facepunch iSeries!
    rieda1589's Avatar
    November 2007
    4,363 Posts
    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
    die();
    ?>
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Funny Funny x 1 (list)

  4. Post #4
    Gold Member
    Tools's Avatar
    November 2009
    6,317 Posts
    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.
    Right.

    Index.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>

    Menu.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();
    ?>

    Main.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>';
    
    ?>

    player.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();
    }
    ?>

    functions.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";
    }
    ?>

    Edited:

    I fixed it. For whatever reason my index.php had changed to a filesize of 0 bytes. :raise:
    Reply With Quote Edit / Delete Reply Denmark Show Events Informative Informative x 1 (list)

  5. Post #5
    Facepunch iSeries!
    rieda1589's Avatar
    November 2007
    4,363 Posts
    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.

  6. Post #6
    Gold Member
    Tools's Avatar
    November 2009
    6,317 Posts
    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.
    Done. :buddy:

  7. Post #7
    Gold Member
    MD1337's Avatar
    June 2005
    152 Posts
    Wouldn't 644 be more secure then 755?
    Reply With Quote Edit / Delete Reply Netherlands Show Events Agree Agree x 1 (list)

  8. Post #8
    I spent $10 on this.
    :awesome:'s Avatar
    April 2009
    5,468 Posts
    just a question. why would you make a website for southpark when you can watch them in HD on their website for free?
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 7Agree Agree x 1 (list)

  9. Post #9

    December 2008
    552 Posts
    just a question. why would you make a website for southpark when you can watch them in HD on their website for free?
    If you don't live in the US you can only see season 1 - 11..

  10. Post #10
    turb_'s Avatar
    February 2010
    2,202 Posts
    Code:
    codez
    :wtc:
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Useful Useful x 1Agree Agree x 1 (list)

  11. Post #11
    :^)
    Wipmuck's Avatar
    May 2009
    1,759 Posts
    Turby did you get banned again? Silly.

  12. Post #12
    turb_'s Avatar
    February 2010
    2,202 Posts
    I got banned unfairly. Obviously some mod agreed with me, and unbanned me.

  13. Post #13
    :^)
    Wipmuck's Avatar
    May 2009
    1,759 Posts
    I got banned unfairly. Obviously some mod agreed with me, and unbanned me.
    Still fp is a any kind of warez nazi, What did you expect.

  14. Post #14
    turb_'s Avatar
    February 2010
    2,202 Posts
    Wasn't warez.

    It was a tool that aims to enhance the experience of trialling Sublime Text

  15. Post #15
    :^)
    Wipmuck's Avatar
    May 2009
    1,759 Posts
    Wasn't warez.

    It was a tool that aims to enhance the experience of trialling Sublime Text
    But this is what the mods saw "OMG CRACK FOR PROGRAM YOU DIDN'T PAY FOR".

  16. Post #16
    turb_'s Avatar
    February 2010
    2,202 Posts
    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

  17. Post #17
    :^)
    Wipmuck's Avatar
    May 2009
    1,759 Posts
    I don't think you explained it probably.