Jump to content

knight47

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.knight47.com

Profile Information

  • Gender
    Not Telling

knight47's Achievements

Member

Member (2/5)

0

Reputation

  1. yeah that does work, but i'm wondering why it's not working in my case above, I would like to know why so I won't get into the same problem in future cases.
  2. Does anyone know why this script won't properly work? It actually does work, but it's giving me a problem with the lines commented below: <?php $htm = glob('*.htm'); $html = glob('*.html'); $php = glob('*.php'); $jpg = glob('*.jpg'); $jpeg = glob('*.jpeg'); $xml = glob('*.xml'); $swf = glob('*.swf'); $gif = glob('*.gif'); $add_all = count($htm) + count($html) + count($php) + count($jpg) + count($jpeg) + count($xml) + count($swf) + count($gif); echo "There are " . count($htm) + count($html) . " HTML files <br /><br />"; // it seems to ignore the "There are " part echo "There are " . count($php) . " php files <br /><br />"; echo "There are " . count($jpg) + count(jpeg) . " jpeg files <br /><br />"; // Same with the first one, is it because I'm adding them? Why would this hinder it's output?? echo "There are " . count($swf) . " swf files <br /><br />"; echo "There are " . count($gif) . " gif files <br /><br />"; echo "There are " . count($xml) . " xml files <br /><br />"; echo "Total: $add_all"; ?> View it here to understand what I'm talking about: www.knight47.com/files.php Why is it not displaying the "There are " for the HTML and jpg files? Thanks again.
  3. Sorry for the triple posting, but I seem to have figured it out. I think the problem was I am not supposed to put a function inside of in_array() What I had was in_array(strtolower($url), $banned_sites); that didn't work, so what I did was: $site = strtolower($displayed_url); if ($_POST['Submit'] && in_array($site, $banned_sites)); this seemed to work. so for future references, don't put functions inside of in_array()
  4. For now I'm just using this: if ($_POST['Submit'] && strtolower($displayed_url) == "porn.com" || strtolower($displayed_url) == "boysfood.com") which seems to be working fine, but I'm just curios on why the array didn't work...
  5. ok, I made the switch, and now I get: Fatal error: Call to undefined function: () in /home/sbai/public_html/advertise.php on line 23 - no matter what url I submit Line 23 is: if ($_POST['Submit'] && in_array($strtolower($displayed_url), $banned_sites)) btw, if you would like to test it out ???
  6. hello everyone, thanks for all the help. This is all of my code, nothing too advanced, but for some reason it's still not working, any ideas on why? <?php $url = htmlspecialchars($_POST['url'], ENT_QUOTES); // cleans the submitted url $clean_url = stripslashes($url); // removes slashes from the submitted url $disc = htmlspecialchars($_POST['disc'], ENT_QUOTES); // cleans the submitted disc. $cleaner_disc = stripslashes($disc); // removes slashes from the submitted disc. $replace = array("http://www.", "HTTP://WWW.", "http://WWW.", "HTTP://www", "http://", "HTTP://", "www.", "WWW."); // what is going to be replaced form the URL $displayed_url = str_replace($replace, "", $clean_url); // removes the "http://www." from the URL, this is going to be what is advertised $code = '<h1 class="style4"><a href="' . $clean_url . '">' . $displayed_url . '</a> </h1> <center><table width="94%" border="0" cellspacing=" " cellpadding=" "> <tr> <td><div align="left"><span class="style15">' . $cleaner_disc . '</span></div></td> <td><div align="right"><span class="style15"><a href="advertise.html">Replace with your link... </a></span></div></td> </tr> </table></center>'; $banned_sites = array("boysfood.com", "porn.com"); // porn websites if ($_POST['Submit'] && in_array($banned_sites, strtolower($displayed_url))) { echo "Sorry, but this URL has been banned from being advertised on our site."; echo '<meta HTTP-EQUIV="REFRESH" content="5; url=index.htm">'; } elseif ($_POST['Submit'] && strlen($displayed_url) < 31 && strlen($cleaner_disc) < 63) { $link = "link.php"; $create = fopen($link, 'w') or die("The file could not be created, please try again later"); fwrite($create, $code); fclose($create); echo '<meta HTTP-EQUIV="REFRESH" content="0; url=index.htm">'; } else { echo "Sorry, but you broke the internet! No not really, but on a more seriose note, you probably exceeded the max character limit on the URL, or the description field, please note that \"http://www.\" does not count, so please do not exclude this from you're URL. Thank you!"; } ?> I'm now getting an error: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/sbai/public_html/advertise.php on line 23 Line 23 is: if ($_POST['Submit'] && in_array($banned_sites, strtolower($displayed_url))) and it still allows the blocked URL from being submitted. and yes, my coding is probably very very sloppy, i'm fairly new to php, and i'm not really looking for a solution that i can copy/paste, because I won't learn anything from that! I'm looking for a solution that I would understand, I know there are probably different methods to achieve this, but i'm just a beginner
  7. thanks footballkid4, havn't tried it yet. but any idea why my code wouldn't work?
  8. Hello Skali, thanks for your reply. I tried this, and for some reason it didn't work, would you happen to know why? $url = htmlspecialchars($_POST['url'], ENT_QUOTES); // cleans the submitted url $clean_url = stripslashes($url); $replace = array("http://www.", "HTTP://", "http://", "WWW.", "www."); $displayed_url = str_replace($replace, "", $clean_url); // removes the http:// or the www. from a link $banned_sites = array("site1.com", "site2.com"); if ($_POST['Submit'] && strtolower("$displayed_url") == $banned_sites) { echo "Sorry, but this URL has been banned from being advertised on our site."; } elseif.... { // code } The code works fine, but for some reason the blocking of a link will not work. Thanks.
  9. I have a small advertising script that will advertise a link on the main page of my site, what I'm wondering is how I can block a link from being submitted, what I currently have is an if statement that will not allow a specific link, but it is case sensitive. so for example, if I want to block site1.com, the user can submit SITE1.com, or sItE1.com, SiTE1.com, etc.. and they would all go through fine. How can I have it so that it doesn't matter the case, it will block the whole site1.com, no matter what the case is? OR, an alternative I was thinking about is forcing all letters to go lower case, is that a possibility in php? thanks in advance
  10. in the image I provided, the one with the red arrow dosn't work. just type in 1 for example, and then type something into that one, and it won't do anything.
  11. Hello again, OK, so I have a form that accepts numbers 1 - 99 only. I'm wondering how I can have it so that if for example, 8 is inputted, then 1 form, and 8 text fields appear on the next page, each with a diffrent name. Now once you fill out all those text fields, you hit submit, and it creates an .xml file of what you've typed in. Somehow I need to set all those 8 forms to a variable, but I don't know how. For an example, visit http://knight47.com/rss_project/, but on this one, I'm having a problem after you submit a number, when you hit submit again, for the second time, it doesn't create the title field, labeled in this image, but it does create everything else: Ultimately what I'm trying to do is create an online RSS feed gen, and I don't think the way I'm doing it will work. If anyone can give me any ideas on how I can accomplish this, that would be great. Thanks.
  12. Hello again, I set the permission to 770, and that seems to be working fine, but do you think this is safe?
  13. Didn't know you could do that! Thanks!! jesirose, I will look into that. thanks
  14. it's at the very end: $file = $link . ".htm"; if ($_POST['create'] && !file_exists($file)) { $create = fopen($file, 'w') or die("Hm... There seems to be a problem, I hope you didn't break anything!"); fwrite($create, $site_code); fclose($create); } else { echo "oops, i think you have already created a file that already exists"; echo '<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.knight47.com/create/' . $file . '>'; }
×
×
  • 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.