Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Everything posted by Lamez

  1. well I get an error when I use the re-posted code. It says there is an extra closing bracket, but I am not too sure how to fix it since I did not make the modification. http://links.krazypicks.com/file.php
  2. lol, what did you do? Did you just add the exit's at the bottom?
  3. Lamez

    Links

    take a look at session variables. You could use a session variable, combined with a if statement, and if the statement is true, then redirect them. http://php.about.com/od/advancedphp/ss/php_sessions_2.htm
  4. whole code: <?php ob_start(); session_start(); $connection = mysql_connect("****", "****", "****"); mysql_select_db("****", $connection); $results = mysql_query("SELECT * FROM `site`")or die(mysql_error()); $row = mysql_fetch_array($results)or die(mysql_error()); $title = $row['name']; $back_address = 'http://www.krazypicks.com'; function addPro($str){ if(!strstr(strtolower($str), "http://")){ $str = "http://".$str; } return $str; } function addwww($str){ $h = parse_url(strtolower($str)); $pro = strtolower($h['scheme']); if(!strstr(strtolower($str), "www.")){ $str = $pro."www.".$str; } $str = strtolower($str); return $str; } $url = $_GET['url']; $url = stripslashes($url); $url = htmlspecialchars($url); $n_url = $url; $links = "<a href=\"http://www.krazypicks.com\">".$title."</a> or <a href=\"?\">Enter URL</a>"; $switch = "00"; $black = md5("this has been black listed :D :D ////*****/////*****////****"); if($url == ($switch)){ echo $links; }else if($url == ($black)){ echo "<font color=\"red\"><b>WARNING:</b></font> This website has been blacklisted by KrazyPicks<br>"; echo "<b>Reason:</b> ".$r['level']."<br><br>"; echo $links; }else if(empty($url)){ print'Enter URL<br> <form id="form1" name="form1" method="get" action="?"> <label> <input name="url" type="text" id="url" size="50" maxlength="100" /> </label> <input type="submit" name="'.md5("go_s").'" id="'.md5("go_s").'" value="Go!" /> </form><br> <a href="http://www.krazypicks.com">'.$title.'</a> :: <a href="http://www.servage.net/?coupon=cust33591">Hosted by Servage</a>'; }else{ $url = addPro($url); //adds http:// $churl = @fopen($url,'r'); if (!$churl && !empty($url)){ echo "<br><center>The URL does not exist, or the server is down.<br>".$links."</center>"; }else{ //begin checking for blacklisted... $par = parse_url($n_url); $n_url = $par['host'];//grab base url $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$n_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); exit; } $www_url = $n_url; $www_url = addwww($www_url);//add www $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$www_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); exit; } $pro_url = $n_url; $pro_url = addPro($n_url);//add http:// $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$pro_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); exit; } $n_url = addwww($n_url);//add www $n_url = addPro($n_url);//add http:// $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$n_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); exit; } //end check, everything cleared... //check for a youtube video... $link = parse_url($url); $youtube = $link['host'].$link['path']; $watch = "www.youtube.com/watch"; $watch_2 = "youtube.com/watch"; $watch_3 = "http://www.youtube.com/watch"; $watch_4 = "http://youtube.com/watch"; $qu = $link['query']; $qu = str_replace("v=", "", $qu); if ($youtube == $watch || $youtube == $watch_2 || $youtube == $watch_3 || $youtube == $watch_4) { print'<object width="425" height="349"><param name="movie" value="http://www.youtube.com/v/'.$qu.'&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'.$qu.'&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="349"></embed></object>'; } //end check for youtube video... //check for mp3 file... $string = $link['path']; $keyword = ".mp3"; $keyword_1 = ".MP3"; if (strpos($string, $keyword) > 0 || strpos($string, $keyword_1) > 0 ) { print'<object data="'.$url.'" type="application/x-mplayer2" width="200" height="50"> <param name="src" value="'.$url.'"> <param name="autoplay" value="false"> <param name="autoStart" value="0"> </object>'; } //end check for mp3 file... print 'You are about to leave '.$title.', do you want to continue?'; print '<br> <center> <form id="con_form_url" name="con_form_url" method="post" action=""> Yes <label> <input type="radio" name="con_tin" id="radio" value="yes" /> </label> No <label> <input type="radio" name="con_tin" id="radio2" value="no" /> </label> <label> <input type="submit" name="button" id="button" value="Continue" /> </label> </form> </center>'; if (isset($_POST['con_tin'])){ if ($_POST['con_tin'] == ("yes")){ header("Location: ".$url); }else{ //header("Location: ".$back_address); header("Location: ?url=".$switch); } } }//pinged webpage, closing bracket. }//url is not empty, closing bracket. ?>
  5. Lamez

    Links

    take a look at this really popular website: http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=disabling+links+with+javascript+after+clicked lol
  6. Lamez

    Links

    take a look at maybe ajax or javascript.
  7. well I added exit; after every header redirect, and it sill allows the second site. I am really baffled. Would posting the whole code make a difference?
  8. Okay, When a user puts a url in the input box, and the script is suppose to take it down to the base url, it strips off the querys, and protocol. Then it check the database to see if it is blacklisted, then it checks the string for www., if it does not it adds it, then it checks the database, then it adds http:// (protocol), and checks the database, then it adds both, and check the database one more time, if no matches then it finishes the rest of the script. Well if it does match, then it redirects to an error message saying it has been blacklisted. Well the script works if I use the first URL in the database, but when I use the second URL it allows the script to continue. Do you guys know why? Here is the check code: <?php //begin checking for blacklisted... $par = parse_url($n_url); $n_url = $par['host'];//grab base url $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$n_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); } $www_url = $n_url; $www_url = addwww($www_url);//add www $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$www_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); } $pro_url = $n_url; $pro_url = addPro($n_url);//add http:// $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$pro_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); } $n_url = addwww($n_url);//add www $n_url = addPro($n_url);//add http:// $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$n_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ //$_SESSION['o_url'] = $r['url'];** header("Location: ?url=".$black); } //end check, everything cleared... ?> Here are the custom functions: <?php function addPro($str){ if(!strstr(strtolower($str), "http://")){ $str = "http://".$str; } return $str; } function addwww($str){ $h = parse_url(strtolower($str)); $pro = strtolower($h['scheme']); if(!strstr(strtolower($str), "www.")){ $str = $pro."www.".$str; } $str = strtolower($str); return $str; } ?>
  9. Wow that worked wonders, thank you so much, here is how I used that code: <?php //begin checking for blacklisted... //$par = parse_url($n_url); //$n_url = $par['host'];//grab base url $n_url = addwww($n_url);//add www //$n_url = addPro($n_url);//add http:// $string = $_POST['string']; $sql = mysql_query("SELECT * FROM `blacklist` WHERE `url`='".$n_url."'"); $r = mysql_fetch_array($sql); if (mysql_num_rows($sql) >= 1){ $_SESSION['o_url'] = $r['url']; header("Location: ?url=".$black); } //end check, everything cleared... ?>
  10. using, "../" will always go up in the directory tree, so you can use "../../../" and that will take you up three directory. This also used in HTML.
  11. ok I have a page where the user can put in a string, and I have strings in the database. I want to know the best way to check to see if the user's string matches the database string. -Thanks Guys!
  12. make a new file and type this in: <?php echo phpinfo(); ?> then post a link to the newly made file, so we can see your configuration settings.
  13. ok I have this bit of code (shown below), this is a snippet from my ELC, well it is not working well at all. It is suppose to take the base url of the inputted url, then check to see if it matches in the database, and if it does then it redirects the user to a error saying it has been blacklisted for this reason, but the reason all ways take the last result in the database. Why? Snippet: <?php //begin checking for blacklisted... //$par = parse_url($n_url); //$n_url = $par['host'];//grab base url $n_url = addwww($n_url);//add www $n_url = addPro($n_url);//add http:// $sel = mysql_query("SELECT * FROM `blacklist`"); while($ck = mysql_fetch_array($sel)){ $ck_url = $ck['url']; $o_url = $ck_url; $ck_url = addwww($ck_url);//add www $ck_url = addPro($ck_url);//add http:// if($n_url == ($ck_url)){ $_SESSION['o_url'] = $o_url; header("Location: ?url=".$black); } }//end while loop //end check, everything cleared... ?> Entire Code: <?php ob_start(); session_start(); $connection = mysql_connect("****", "****", "****"); mysql_select_db("****", $connection); $results = mysql_query("SELECT * FROM `site`")or die(mysql_error()); $row = mysql_fetch_array($results)or die(mysql_error()); $title = $row['name']; $back_address = 'http://www.krazypicks.com'; function addPro($str){ if($str != '' && strpos(strtolower($str), 'http://') !== 0){ $str = 'http://'.$str; } return $str; } function addwww($str){ if (substr($str,0,4) != 'www.') { $str = 'www.'.$str; } return $str; } $links = "<a href=\"http://www.krazypicks.com\">".$title."</a> or <a href=\"?\">Enter URL</a>"; $switch = "00"; $black = "black"; $url = $_GET['url']; $url = stripslashes($url); $url = htmlspecialchars($url); $n_url = $url; if($url == ($switch)){ echo $links; }else if($url == ($black)){ $new_url = $_SESSION['o_url']; $q = mysql_query("SELECT * FROM `blacklist` WHERE `url` = '".$new_url."'")or die(mysql_error()); $r = mysql_fetch_array($q); $reason = $r['level']; echo "<font color=\"red\"><b>WARNING:</b></font> This website has been blacklisted by KrazyPicks<br>"; echo "<b>Reason:</b> ".$reason."<br><br>"; echo $links; }else if(empty($url)){ print'Enter URL<br> <form id="form1" name="form1" method="get" action="?"> <label> <input name="url" type="text" id="url" size="50" maxlength="100" /> </label> <input type="submit" name="'.md5("go_s").'" id="'.md5("go_s").'" value="Go!" /> </form><br> <a href="http://www.krazypicks.com">'.$title.'</a> :: <a href="http://www.servage.net/?coupon=cust33591">Hosted by Servage</a>'; }else{ $url = addPro($url); //adds http:// $churl = @fopen($url,'r'); if (!$churl && !empty($url)){ echo "<br><center>The URL does not exist, or the server is down.<br>".$links."</center>"; }else{ //begin checking for blacklisted... //$par = parse_url($n_url); //$n_url = $par['host'];//grab base url $n_url = addwww($n_url);//add www $n_url = addPro($n_url);//add http:// $sel = mysql_query("SELECT * FROM `blacklist`"); while($ck = mysql_fetch_array($sel)){ $ck_url = $ck['url']; $o_url = $ck_url; $ck_url = addwww($ck_url);//add www $ck_url = addPro($ck_url);//add http:// if($n_url == ($ck_url)){ $_SESSION['o_url'] = $o_url; header("Location: ?url=".$black); } }//end while loop //end check, everything cleared... //check for a youtube video... $link = parse_url($url); $youtube = $link['host'].$link['path']; $watch = "www.youtube.com/watch"; $watch_2 = "youtube.com/watch"; $watch_3 = "http://www.youtube.com/watch"; $watch_4 = "http://youtube.com/watch"; $qu = $link['query']; $qu = str_replace("v=", "", $qu); if ($youtube == $watch || $youtube == $watch_2 || $youtube == $watch_3 || $youtube == $watch_4) { print'<object width="425" height="349"><param name="movie" value="http://www.youtube.com/v/'.$qu.'&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/'.$qu.'&hl=en&fs=1&color1=0x006699&color2=0x54abd6&border=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="349"></embed></object>'; } //end check for youtube video... //check for mp3 file... $string = $link['path']; $keyword = ".mp3"; $keyword_1 = ".MP3"; if (strpos($string, $keyword) > 0 || strpos($string, $keyword_1) > 0 ) { print'<object data="'.$url.'" type="application/x-mplayer2" width="200" height="50"> <param name="src" value="'.$url.'"> <param name="autoplay" value="false"> <param name="autoStart" value="0"> </object>'; } //end check for mp3 file... echo $url; }//pinged webpage, closing bracket. }//url is not empty, closing bracket. ?>
  14. If you do not have a cheap web host, take a look at servage, a link in my sig!
  15. Well I am fairly new to php, so I do not know. So if I set a session variable, there is no way a user can see its contents. example <?php $_SESSION['var'] = "google.com"; echo $_SESSION['var']; ?> so using something like that will not give a user access to the information that is stored in the session variable var?
  16. people would rather you post the problem, and the code.
  17. ok, I am working on my ELC again, and I am working on the blacklisting part. Well I am tying to hide the url that is blacklisted, and if I use a session variable, then you can just look in your cookies and find the url. I am dealing with multiple pages, so I need a way to carry variables through different pages. How? Thanks Guys!
  18. I know this is possible, but I do not know how. http://www.google.com/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=P7G&q=running+command+line+with+php&btnG=Search
  19. I took this snippet out of my ELC(External Link Checker), http://links.lamezz.com Type in the IP address to ping. <?php $url = "127.0.0.1"; $churl = @fopen($url,'r'); if (!$churl && !empty($url)){ echo "<br><center>The URL does not exist, or the server is down.</center>"; }else{ echo "<br><center>The URL does exist!</center>"; } ?>
  20. lol, seems like any loop would be appropriate. Just which one is easier\more efficient.
×
×
  • 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.