Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. Unfortunately the more time we give, the greater chance there is of people retroactively deleting their posts because they don't like leaving "I'm asking noob question" paper trails. And since the point of this site is to provide a resource and help people learn, we don't allow for it. But then at the other end of the spectrum we have people who legitimately want to edit their posts for things like what you mentioned.. so it's a balancing act. We've experimented with shorter edit windows and longer edit windows and so far where it is currently at seems like a nice warm butter zone (though for sure, there is no perfect spot). If you find yourself in that situation feel free to report your post and staff can edit it for you.
  2. you can make an ajax request, as long as the file is on the same domain as the page requesting it
  3. You found that code from google? How is that relevant to your code? How does the user login? do you already have a script for that, which works? If so, there should be a session variable with the info for you to use, or else a session variable with an id associated to the user, for you to query your database for the user's name. I'm starting to get the impression you have some 3rd party script you are trying to tweak...is this the case?
  4. Where is the user name coming from? It *looks* like maybe you want: $user = $_GET['user_login']; header( "Location: http://www.mydomain.com/{$user}-manager" ) ; exit(); This assumes that you are receiving the user_login from a GET request like www.yoursite.com/thescriptabove.php?user_login=someuser and it will redirect you to for example: http://www.mydomain.com/someuser-manager
  5. Yes, it goes in order. You have to first disallow everything and then allow the exceptions. Also dunno if you know or not but the crawlers don't have to obey the rules of robots.txt. Most major crawlers respect the rules but they don't *have* to and you shouldn't rely on robots.txt for other random bots/crawlers out there. Hell I personally don't really rely on it even for the major crawlers. Who knows when their policy might change. Better to look at the headers server-side and do something there. But even then that doesn't stop someone from faking headers. Anyways...
  6. In my job, I do a lot of QA/Testing of websites. Many times I need certain things, for instance, I may need a dummy email address so I can go through a registration form. This has led me to create a little script that helps make my job easier. For example, one of the things my script does is it generates a timestamp based throwaway email address (and I have a filter setup to redirect to a specific qa email address if it is one of the generated email addresses, so that I can do things like validate email address to complete registration on a site if I need to go that far). My script also gives ability to save the generated email address along with other notes (like URL of form, password used etc..) for reference if I need it. Other things I have is a timestamp/datestring converter. Basically just put in a timestamp and it converts to datestring and visa versa. I also have a textarea where you can put in some random string and do things to it, like count the length of the string, truncate it to n chars, encode/decode, upper case, lowercase, convert from bin/hex/dec, md5 it, etc... Anyways, not really trying to advertise a script or nothin', just trying to give you an idea of what I mean by a "qa/test" script, so that I can ask the following: do you have any scripts like this, that you use for random things during your coding efforts? And if so, what kind of cool things does it do?
  7. There is nothing wrong with the code you posted, your error is elsewhere. Or else the code you posted differs from the code you're running.
  8. Math works the same way here as it does on paper...technically in this case you don't even need to wrap anything in parens (though I usually do for better readability)...order of operations will have the division happen first...
  9. I have a sneaking suspicion when OP refers to "header" he is talking about html content(like different top of the page menu/links), not http request/response headers.
  10. echo just outputs literal strings (or parsed variables if in double quote). If you are wanting to execute/output the content of those scripts then you need to use include or require instead of echo.
  11. Your first line of code has a / right after the opening ", and right before the closing ". How...HOW did you translate that to using a backslash as the opening delimiter, and putting the closing delimiter somewhere before your pattern ends? Man, you are making this WAY harder than it needs to be....I'm being serious here, not mean..if this is seriously too hard for you to understand, then you need to find another hobby besides coding, because this is NOT coding, this is copy and paste. If you cannot understand basic copy and paste, then you cannot even begin to code.
  12. before... $pageed = ereg_replace(".*<$loop[$y]>", "", $page); after: $pageed = preg_replace("/.*\<{$loop[$y]}\>/", "", $page); before... $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); after: ??? You have two lines of code that have the same problem: using a deprecated function. You have been told what you need to change, and someone even did the first line for you, so all you need to do is follow the instructions, or failing that, look at the changes in your first line and apply the same changes to the second line. Exactly what part of this are you having trouble with? Because at this point, this isn't even about coding, it's simple clerical skills...find and copy...
  13. array_search() searches the array values and returns the key an array is array(key => value). As far as the Notice...maybe you snagged the code before I edited it..I forgot to add the 2nd param when I first posted it.
  14. what does nr mean?
  15. First off, in your conditions, = is the assignment operator, whereas == is the equality operator...you should be using == in your conditions. But anyways, you can cut all those conditions out by using an array: $catIDs = array( 3 => "Automotive", 4 => "Business", // etc... ); $catid = array_search(trim($_POST['catid']), $catIDs); echo $catid; array_search will search the array and return the key (like 3,4, etc..) or if value not found, it will return boolean false.
  16. check if it isset before checking the value.
  17. foreach ($array["MPI"] as $key => &$value) { foreach ($value as $k => &$v) { if ( isset($array["Competitive set"][$key][$k]['data'])&&isset($array["Test"][$key][$k]['data']) ) { $v['data'] = ( $array["Competitive set"][$key][$k]['data'] / $array["Test"][$key][$k]['data'] ) * 100; } } }
  18. It depends on your question...in general, if you have a question about php code (and it is your code, not a 3rd party script) or how a php function works etc.. then this is the right place, yes. Try to figure out what your problem is about. Then read the forum descriptions.
  19. What timezone is your server located in? What is the server time zone the server goes by?
  20. You apply the same principle you just learned to this line...use the gray matter between your ears bro...
  21. Php doesn't have a g modifier for pcre functions. preg_replace() by default performs global search and replace, and if you want to limit it there's an optional argument to pass to it
  22. But as you pointed out, he should be using an array anyways
  23. You wouldn't have to use eval() for it. Just access it through the window object. window["itm" + i].model Ah, the flexibility of JavaScript. Oh yeah...duh...i even wrote a script the other day doing that...can't believe that slipped my mind...you win again old age
  24. hmm also I don't think requinix's example quite matches what you are trying to do. I think what you are looking for is the following: <script type='text/javascript'> var itm = [ {"make" : "porche", "model" : "boxter"}, {"make" : "mazda", "model" : "protege"} ]; var g = <?php echo $count?>; for(i=1; i<=g; i++){ $('#writer').append(itm[i].model + "<br/>"); } </script>
×
×
  • 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.