Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. Quite awhile, as I've read http://searchengineland.com/manual-spam-action-revoked-case-study-186349
  2. Well the OP didn't ask for opinions on his db setup, and didn't post any information about his db structure, so I don't honestly know what his db looks like. I can't just assume he doesn't have a primary key index setup, but that seems to be what everyone is assuming.
  3. There's really no reason to grab all the files with PHP and then loop through them and do exclusions with PHP again. Just add your restrictions to the glob() call, and then you'll have only your image files. glob($root . $path . "*.{jpg,png,gif}", GLOB_BRACE); And yea, absolutely, get PHP 5.6+. Why live in the past? Looking in the manual, there doesn't appear to even be a v5.3.3, but 5.3.29 came out in 14 Aug 2014, while PHP 5.6.22 came out in 26 May 2016
  4. Another way of adding your variables to your strings is by using { } curly braces. Note: you can only do this when your string is enclosed with double quotes " because content between single quotes doesn't get parsed. echo "<input type='hidden' name='channel' value='{$_SESSION['channel_id']}' />";
  5. just add onto your current IF statement if($_GET['car'] == $row['car'] && !empty($row['car']) ){ echo "selected=\"selected\""; } print " value=\"$page_name&car=" . $row['car'] . "\">" . $row['car'] . "</option>\n"; }
  6. Not necessarily. One could use a combination of the file() function and in_array() function to prevent duplicates. // Completely untested!! # get the submitters IP address $remote_ip = getenv(REMOTE_ADDR). "\r\n"; $filename = "inbritain-ip-file.txt"; $theFile = file($filename); $fileRef = fopen($filename) or die("Unable to open file!"); foreach($theFile as $ip) { if( !in_array($remote_ip, $theFile) ) fwrite($fileRef, $remote_ip); } fclose($fileRef);
  7. Change this line fwrite($ip_file, $remote_ip . "\r\n"); Or change this line $remote_ip = getenv(REMOTE_ADDR). "\r\n"; The \r represents a carriage return (CR), while the \n represents an actual new line, or line feed (LF). This also means, though, that you will have a hanging/straggling newline at the bottom of your file.
  8. If you just trying to see if there are at least 2 digits, then temporarily strip all the non-numeric characters and count what is left. $example = '5teeth4'; function atLeast2Numbers($e) { return ( strlen( preg_replace("/[^0-9,.]/", "", $e) ) >= 2); // Has at least two digits. } var_dump( atLeast2Numbers('fail5'); //false var_dump( atLeast2Numbers('pass5and6'); //true
  9. I would completely disregard the "hack" I suggested. Kicken's fiddle clearly shows this working without a hack. I recommend you revert back to what it was before you took that advice, and then figure it out from there.
  10. Yea. a typo on my part. Like I said, it's untested
  11. Classes are cool too. .aCoolSelect { background-color;cool; color: black; font-weight:bold; font-family:"The Fonz" } <div class='aCoolSelect'>Eyyy!!</div>
  12. I would just pass it as reference, but that's just me. function changeKeyName (&$arr, $from, $to) { foreach($arr as &$k=>$val) $k = $k == $from ? $k = $to : $k; } $arr1 = ['abc'=>'one','def'=>'two','abc'=>'three']; changeKeyName($arr1, "abc", "xyz"); Note: This is untested.
  13. Probably just another item on the long list of bugs and caveats of having outdated forum software. Hopefully, that will change in the coming months.
  14. It's because you're calling the tab() function on an anchor link that is not in your .tabbed-area I'm assuming also that you're wanting these links to trigger clicking on the real tabs, and in order to target your tabs, you'll have to give them IDs. So for your 4th tab, for instance. Give it an ID of say, "step4" because these tabs are each unique to the page <a href="#tab4" id="step4">Your Acceptance</a> Then, for your links inside #tab1, first off, get rid of the hrefs, and replace them with a data attribute like data-target='step4', and also give them a class so you can target them with jQuery and use data-target to trigger a click on the appropriate tab. <a data-target="step2" class="tab1-anchor">One year before</a> Now that you have this, you can trigger a click on the step4 tab with this jQuery jQuery(function($){ $("a.tab1-anchor").click(function(e){ e.preventDefault(); var theTab = "#" + $(this).data('target'); $(theTab).trigger('click'); }); }); There's possibly other better ways of accomplishing this, but this is the first thing that came to mind. I feel like this solution of mine is more of a hack than it is the " proper" way to handle this. Kicken's fiddle, I notice, works just fine without my hack.. So now I'm a bit unsure why things aren't working for you..
  15. Yeah, I suppose the word "troll" wasn't the best word to use (a bit harsh), I'll apologize for that. I do agree though that teaching best practices is a great thing to be doing, and leading people away from sub-par tutorials. But, my point was that benanamen only ever mentioned obsolete code, never provided any relevant links, nor provided any example code or anything other than just saying, It's obsolete, it ain't 1337. Doing that is no different than the OP providing very vague information like "It doesn't work." Lead by example, make an effort to explain that: $connection = mysql_connect("localhost", "username", "password"); mysql_select_db('myDatabase'); can be upgraded and consolidated to just $connection = mysqli_connect("localhost", "username", "password", "myDatabase")'; Things like, what a prepared statement looks like, why is it better, yada yada. There is always the short and simple solution to RTFM, but I'd say that message is mainly warranted to users that repeatedly don't read the manual and continue to say "it doesn't work, why?" And perhaps this could be one of those cases. Anyway, this is way off topic and I probably shouldn't have drank all of those beers before posting that reply I know that I, myself, didn't provide any help in this topic, but I did make sure to ask questions that we would need to know. Regardless, I'm just rambling now.
  16. Benanamen, if you're just here to troll and not offer any help, then.... you know, move along. You can preach best practices until you're blue in the face, but it's not "help." Just as you pointed out yourself So what? We're not here to spoon-feed and shove best practices down our community members' throats. The basis of PHPFreaks is to allow someone with barely any knowledge of PHP (or web dev related things) to gain a firm grasp of it. If the user decides to continue using legacy code, then so be it. It's not like we're going to be held accountable, and even if someone attempted to do that, this is a volunteer based forum. Let them use their old code. In the long run, it means the user will return asking why XYZ isn't doing ABC, and someone will point out that the culprit is a line of legacy code, a legacy function. Ultimately, the main goal is to have the users be able to learn how to expand on their questions and provide just the right amount of information for someone to help them effectively. In due time, assuming the user pursues learning PHP, they will eventually see the error in their legacy methods and realize that the only fix is to be up-to-date. PHP7 is very young at this point, compared to PHP 5.6, which most people have been using for a long while. Although it would be an awesome feeling to know that you helped someone create an innovative idea using the most up-to-date methods, it's not something to expect of our members. Just my 2 cents. .
  17. No reason to undermine yourself, Muddy_Funster. At one point in time, while we were on SMF, one of our staff created a bbcode mod for creating links to user accounts based on their username, but I don't think the idea ever surfaced about notifying the member of it. It's a decent idea, but most definitely not a high priority thing, hardly even a low priority, but we do appreciate the suggestion! I encourage anyone to post any and all suggestions they may have, in this forum in particular, because that's what this forum is here for.... and if it wasn't made clear already, by "this forum" I mean "PHPFreaks.com Questions, Comments, & Suggestions"
  18. This looks promising, but I don't see any easy way to convert to it from IPB. http://flarum.org/ Would probably take a funnel of migrations... IPB to Vanilla to Flarum. or something like that.
  19. What does your table structure look like? What kind of data is inside the Scholarships column? What is inside $SETTINGS["data_table"]? Provide us either a screenshot of your structure and some data, or perform a DESCRIBE tableName query and give us the output. Your print_r is not inside a loop so I don't see how it's giving you that output
  20. From the looks of your print_r output, I'm guessing that you placed the print_r inside your loop, yes? That would indeed yield results like that.
  21. Since you are assigning mysql_fetch_array to $line, you can do $line['givenname'] $GIVENNAME = $line['givenname']; the same goes for payment. seriously, though. use mysqli functions instead of mysql. It's a one letter difference that literally updates your code.
  22. Take out the line break in your SELECT tag. It also wouldn't hurt to have a default option <select> <option value='0'>-------</option> <option value='1'>Yes</option> See, it works here
  23. For those having IRC withdrawals, rest easy because the IRC server is back up now.
  24. Zane

    Welcome Back!

    The site is running on new hardware now.
  25. Hello Everyone, We're finally back online now! The owner had the servers shut down and handed ownership to a friend of his to put it back online. It was April 4th when the site was shut off, and here it is pretty much an entire month later, and we're back online. So basically, PHPFreaks.com has changed owners.
×
×
  • 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.