Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. servers don't parse css, browsers on clients do.
  2. example of how to dynamically build a drop down, using your comma seperated string: [code] <?php   $sql = "select * from table";   $result = mysql_query($sql) or die(mysql_error());   while ($list = mysql_fetch_assoc($result)) {       echo "<select name = 'color'>";       $colors = explode(',',$list['Colors']);       foreach($colors as $c) {         echo "<option value='$c'>$c</option>";       } // end foreach color       echo "</select>";   } // end while ?> [/code]
  3. no.
  4. $PHP_SELF is an environment var that holds the current script's path/name. You really should be using $_SERVER['PHP_SELF'] instead of $PHP_SELF, though.  However, this would not be what is causing your PREV 123 NEXT text to not become links. Are you sure that $page variable is getting passed right?  somewhere before you use this $page variable, you should have something like this: [code=php:0] $page = $_GET['page']; [/code] right?
  5. -create a field in your table called lastActive with a timestamp datatype. -When user logs in, update lastActive. -On each page load, update lastActive. -In your "user's online" script, select * where lastActive < 1 minute or 5 minutes or 10 minutes or whatever how long you wish. This is not really 100% accurate though.  Someone could spend an hour reading a thread and they'd technically be online, but according to the script, they won't be.  There's really no way around that.
  6. well, the only way I see that happening is that you only have one page of results.  If you only have 1 page of results, then it's doing exactly what it's supposed to be doing.
  7. .josh

    MSFirefox

    LoL. I wonder how much MS tries to sue them for. Or..maybe they will hire them for their brilliant idea :D
  8. okay first you say it's on another page, now you say it's on another server? If you expect results, try starting with non-vague questions/descriptions. no, you cannot pass a session from one server to another.  Well actually, you can, but I have a sneaking suspicion that that circumstance does not apply to you.  So no.
  9. http://www.phpfreaks.com/tutorials/142/0.php
  10. well..other than your condition needing quotes around the "Yes" it's technically right.
  11. What? What is this Google thing that which you speak of? It seems like an incredibly useful tool for finding things! Maybe we could start some kind of campaign to tell people about this Google thing? I bet lots of people would use it for their searching needs, to the point that it might even become some kind of alias word for "search" or something, and then nobody will ever again have to ask questions such as "Anybody know where I can find..." because they could just say "Hey I know! I can [i]google[/i] it!"
  12. session id's wouldn't really work.  Random Joe goes to your site and views the page, and you start a session, it only prevents the counter from incrementing as long as he's at your site, or even has the browser open.  But as soon as he closes it, the session expires.  Joe comes back to your site, gets assigned a new session id, and bam, he's another unique visitor. The only [i]more[/i] accurate way is if the only way a user can view the page is if the user is logged in.  Then you can keep track of whether each user has viewed the topic or not.  But really, that's a whole lot of useless data buildup.  If you have 1,000 users and 1,000 topics that's up to 1,000,000 rows in a table to keep track of whether the view was unique or not.  And 1,000 users and 1,000 topics is a drop in a bucket.  And again, that's assuming you only want to make the topics only viewable by logged in members. Keeping a list of IP addresses to find out unique views does leave a margin of error, as peoples' IP address change all the time, but it's an acceptable tradeoff.  What you can also do to narrow that margin is to set a cookie and have your script check for it.  Some people don't allow cookies, so again, it's not a 100% thing, but a lot of people do allow cookies, so it should help narrow the margin. You could also force cookies on the user.  That is, have your script try to make a cookie and if it fails, give a message to the user that they can't view your site without enabling cookies.  Then, you can have your counter only increment if it doesn't find a cookie initially.  This may or may not be a desirable thing, though. Just keep in mind that simply keeping a list of ip addresses and checking for a cookie (but not forcing it) does leave an acceptable margin of error for most professional sites.  It really depends on the nature of your site, what type of people your expected visitors are, and how your site is setup in the first place, etc.. as to what really is the most efficient way to go about this is. 
  13. Wow..other than the fact that you decided to rez an old topic.. Heroscape! Man, my brother and I have spent about $400 on heroscape stuff. We follow the general rules of the game, but we have tossed out so many of its rules and made so many of our own rules that, other than the game pieces, it's not really the same game. We have actually been thinking about sending our rules revision to them.  We feel it was poorly written and does not take many things into consideration.  Other than that, it's great! Setting up the board and choosing our armies in and of itself takes us about 2 hours.  No seriously, I wasn't kidding about the $400.  We bought like 4 of the big starter packs and also have the various board pieces that come with the various units.  And we have minimal 2 copies of each unit pack.  My dining room table is around 4 foot by 6 foot, and the board easily covers it. We have devised a process of picking units that involves dice rolling and other stuff, but overall it ends with each of us having 10 units and 5 heroes. Longest game so far: 13h42m It was long and grueling and I lost :( but it really came down to the wire. It literally came down last man standing.
  14. yes. but fyi,  it's not 100% accurate.
  15. yeah...An array of random stuff like that is really just as useless as the source page itself.  Scraping a remote webpage is more of an artform than a rigid 123 procedure.  You just need to get really good at regex and get good at finding a consistent pattern in the target source.  And even then, you can spend a lot of time perfecting the regex on the scrape and boom! they change up their layout the next day.  Very frustrating.  My first advice for you is to contact the site and see if they can't offer some kind of xml version of their data for you to easily grab.  Doesn't hurt to ask.
  16. just put session_start(); at the beginning of your script. It tells php that you have a session going on (or to start one, if you don't). [code] <?php   session_start();   $_SESSION['blah'] = 'something';   echo $_SESSION['blah']; // output: something ?> [/code] you need to have session_start(); on every page you wish to access your session vars if it is still echoing out nothing, then I would check your $to and $subject to see if they are holding what you are expecting them to hold.
  17. your script needs to start with session_start();
  18. [quote author=neylitalo link=topic=101004.msg497785#msg497785 date=1168038739] Assembly is a very low-level "language" that's used for interacting with the hardware, even below the operating system's control. The most common application for assembly is in a computer's BIOS, for communicating with the various hardware devices in the system. Comparing assembly to other languages is less than "apples and oranges" - more like apples and rocks. (Crappy analogy, I know.) [/quote] I would say more like comparing apples to seeds. 
  19. the function is needed to clean the variables. the other 2 things are seperate examples. The first example shows how to do it individually.  The 2nd example shows how to loop through all of them, so that you don't have to individually type out each variable, which is useful if your form has lots and lots of variables. Also it is useful because if you go and add another input field in your form, you won't have to go back and add it to the list of vars to clean here.  but if you want to do it individually, it works just the same.  and doing [code] $blah = $_POST['blah']; [/code] does not clean the posted variable. It simply assigns the same (possibly tainted) data to $blah.  That's what the clean_var function is for. It should look like this: [code] $blah = clean_var($_POST['blah']); [/code] I looked back and made a mistake in my example. I did clean_var($blah) it should be like ^
  20. no.
  21. yes. every variable. and it's a function that you pass the variable to and it returns the cleaned variable.  example: [code] <?php // put this  function somewhere in your script or include it from another file or something function clean_var($value){   if (get_magic_quotes_gpc()) { stripslashes($value); }   if (!is_numeric($value)) { mysql_real_escape_string($value); }      return $value; } // end clean_var // example: if ($_POST['blah']) {   $blah = clean_var($_POST['blah']); } // end if posted var // example to automate it with multiple posted vars: if ($_POST) {   foreach ($_POST as $key => $val) {       $val = clean_var($val);              $$key = $val;   } // end foreach $_POST   // you now have a list of variables named whatever you named them in   // your form input fields, cleaned and ready to go. } // end if posted vars ?> [/code]
  22. [code] function clean_var($value){   if (get_magic_quotes_gpc()) { stripslashes($value); }   if (!is_numeric($value)) { mysql_real_escape_string($value); }      return $value; } [/code]
  23. The most efficient way I can think of is (assuming that the user whether paid or unpaid has to login) to find out whether the user is paid or unpaid when they first login.  I assume that there is some kind of column with a paid/unpaid flag of some kind.  Get that info when the user logs in, so that you can do something like this: pseudo code: [code] $sql = "select * from properties "; $sql .= ($user['paymentstatus'] == 'unpaid') ? "where {propertydate > 3 months}" : ""; $result = mysql_query($sql); [/code]
  24. [quote author=businessman332211 link=topic=121121.msg497561#msg497561 date=1168023414] [quote]But [IMO] as a customer, best case scenario is that I look at that as being a somewhat shady word game.  Kind of like when you see an ad on TV or in the newspaper and it offers some really great thing for a really low price and then you notice that tiny little * next to it that points to the footnotes where in really tiny print that they make really small because they don't want you to read, they have all sorts of conditions and stipulations that, while technically don't contradict their big shiny bold offer, are just plain shady. [/quote] For some reason the meaning of what you said in this one paragraph didn't make sense to me.  I understand what you mean about stipulations, adn conditions, and trying to avoid things that seem like false advertising, and fine print. I don't understand the relation to marketing locally, what exactly did that mean. [/quote] I was basically saying that by you living in Montana, and yet advertising yourself locally in Georgia, to me, it would be the same as those ads with the little * at the end of it. example: [quote] [i]<While Crayon does a search to find someone locally to collaborate on a project with, he comes across this:>[/i] [size=5]I work locally in Georgia![size=3][sup][color=gray]*[/color][/sup][/size][/size] [i]<Crayon reads the footnote, rolls his eyes and moves on, wondering how many people out there didn't bother to read the fine print and called this place up>[/i] [color=gray][size=1]* well, I don't [i]really[/i] live in Georgia; I live in Montana, but I can do it on a 'local' level through the internet! But that's okay![/size][/color] [/quote] Yeah that sort of thing. 
  25. okay so you did [code] echo "img=$IMG_WIDTH"; [/code] and it printed out the width.  That means it's not a constant, but a regular variable.  And your if/else statement then looks like this: [code] <?php if ($IMG_WIDTH < 750) {   (include "/pathname/file1.htm"); } else {   (include "/pathname/file2.htm"); } ?> [/code] according to your code, it should work.  Now, you mentioned [code] width={IMG_WIDTH} [/code] in this instance,  IMG_WIDTH is being used as if it were a constant, not a regular variable.  somewhere in your script do you have like [code] define('IMG_WIDTH', $IMG_WIDTH); [/code] because if you don't, you either need to add that so that your use of the constant will work, or else, change it from using a constant to a regular variable with the $
×
×
  • 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.