Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. ah okay well, just be careful on that legal shit.. if there IS an issue with it, it's always the lowest guy in the totem pole who gets used as the scapegoat.. in any case, beer-bucks is not necessary, but i won't complain if you send it anyway; never turn down a drink I always say! My paypal link is in my sig
  2. well then it sounds like this website uses some advanced methods to ensure someone is accessing it through a browser. You can replicate this with php/cURL but it sounds like you're basically going to have to put in a lot of effort to basically code up your own mini-browser in order to do it. You will likely have better luck attempting this in something like vb or java using a prefab "browser" module/extension - and then altering it, because no doubt they will likely honor the same origin policy out-of-the-box. But in any case, I suggest you revise your definition of "legal access." Having an account on a website, even some kind of admin account, does not mean you have the right to do what you intend to do, and FYI most sites very explicitly say in their ToS that you canNOT do things like what you want.
  3. 1) you can use cURL, it just sounds like you don't know how to use it to "fool" the server into thinking it's a browser. The only difference between a regular browser request and a cURL request are the header values sent. Your browser auto-pops most all that stuff, whereas with cURL, you can set them to anything you want. 2) same origin policy has nothing to do with cURL. Assuming you actually tried to do it w/ cURL, it's failing because you didn't sufficiently "fool" the server. 3) If you have legal access to the server, change the server settings to bypass the same origin policy! You can do this in your apache or IIS config files, or in .htaccess file 4) If you do not have legal (direct) access to the server, there is no bypassing the same origin policy, short of altering your core browser code and recompiling it
  4. perhaps you are looking to use session variables instead?
  5. You have some whitespace before your opening <?php tag which should have given you a warning.. this may possibly be causing $_SESSION['expire'] to be unavailable on the logged in page (depending on some other settings), so try removing it. But other than that, at face value, the script works fine by itself..
  6. you cannot convert those to php, because those are DOM specific. php does have a DOM class that works similar, if you have a string or html file or xml file to work with, but this isn't really the same as grabbing or altering something from a live DOM on a page. Same thing with your getValue and setValue functions. You're going to have to refactor your code to leave those in javascript. If you absolutely must convert it 100% to php, your only option is to have the full page reload whenever the code is executed, and have it output updated html code each time.
  7. include or require
  8. There's no way that regex would have completely wiped the description. Are you sure you don't have some old code attempts in place? Are you sure some of those even had a description, other than the carousell text? Can you please post a full dump of what the code looks like from those screenshots, BEFORE the regex? IOW can you post what your $str value actually looks like, BEFORE anything is done to it.
  9. each line needs to end in a semicolon. The line before the one you pointed out has a dot, adn the one you point at has nothing.
  10. ...and it looks like from your screenshot it may or may not have a URL, so try this: $str = preg_replace('~Listed via (<em>)?Carousell(</em>)?(\s*-(\s*http://(the)?carousell.com?(/iphone)?)?)?~i','',$str);
  11. oh okay, so this stuff is within a larger string. It helps when you mention the full context of the situation in the first place.. $str = preg_replace('~Listed via (<em>)?Carousell(</em>)? - http://(the)?carousell.com?(/iphone)?~i','',$str);
  12. mysql_query returns a resultsource upon success; an object containing your data. In order to get the data out of $sql, you will need to use a function like mysql_fetch_assoc. Look at example #2 of the mysql_query for details.
  13. umm, not sure what you mean.. do you mean you want to remove the URL too? But then that just leaves an empty string, yes?
  14. Okay, if you want to strip everything except the URLs, try this: $str = preg_replace('~^[^-]+-\s*~m','',$str);
  15. Where are you even getting $dirtyString from? Are you sure it even has your list in it? I ask because you said this is "front end," which is supposed to mean it's happening client-side, like with javascript. If that is the case, then php isn't going to help you here.
  16. 1) Rounding up to the nearest 15m, 30m or 1h increment is standard practice. You'll find this in most service based industries, not just coding. 2) You don't know what the issue is or what's involved in fixing it, so it's pretty presumptuous of you to decide how long it should take to fix 3) Even if it only takes an experienced person 3m to fix something, point is, you can't do it yourself. It's like in Kill Bill when Uma spent years training to break a board with his fist from like 1 inch away. You'd cheapening her expertise by saying "So what, she just broke a board." Point is, getting to the point of being able to solve something in like 3 minutes takes a lot of time and effort, and you're being very disrespectful and cheapening things by claiming those 3 minutes worth of work is nothing more than 3 minutes worth of work. Why should you pay "lots of money" for it? You used (but entirely missed the point of) the keyword in your own statement: experienced. The value you are getting is that you don't have to go through all the time and effort to be able to solve it in 3 minutes. 4) "It worked before so i know it works" really? My car was working last week so I know it works. Yesterday it broke down. Things change, shit happens. At best, you're just pointing out the obvious. At worst, you're being pretentious. 5) "I already paid for the code.." And? wtf does that have to with not paying for fixing it now? Let me call up a mechanic and tell him I shouldn't have to pay him for his services on my broken car, since I already paid for the car. Do..do you see how silly that is? Maybe the person/company you bought it from offers support for it; have you tried there? But thinking some other random person shouldn't be paid for their work is just stupid. Kevin summed it up nicely:
  17. Technically you should check if $matches[0] exists before checking if $matches[0][$1] exists: if(isset($matches[0])&&isset($matches[0][$i]))But this is just to avoid a warning (assuming your error level is set to report warnings); the logic itself would have worked as-is. And yes, that is how you append a string to another string (concatenation). Sidenote: In your patterns, you use (.*) in several places. This is a greedy match, and it will yield unexpected results. You should use a non-greedy match instead: (.*?) Also, I would like to point out that regex isn't really the best method for parsing html. For example, if the links and iframes have any other attributes, or use single quotes instead of double quotes, spaced differently, or any number of other things, your regex would fail, since it doesn't account for any of that. What you should instead use is a DOM parser.
  18. I don't know what to tell you.. it works fine on my site and on the demo site. All I can tell you is keep playing the "spot the difference" game. I noticed in the code you posted, you have the same 4 images in each set of ul tags.. What? Are you talking about the leading "/" vs. not having it? Again I have to ask you, do you not understand how pathing works? <script src="http://www.yoursite.com/path/to/script.js"></script> this is an absolute URL, and will point to the exact domain/path/to/file. <script src="/path/to/script.js"></script> this is a relative URL. The leading "/" means to start at the web root. <script src="path/to/script.js"></script> this is a relative URL. Without the leading "/", you are telling the browser to start in the directory the main page is located in. So for example, my script is located at www.crayonviolent.com/ItemSlider/index.html My js script includes show js/.. without the leading "/". This means the browser expects the js file to be located at www.crayonviolent.com/ItemSlider/js/.." If I had a leading "/", it would expect to find the js files at www.crayonviolent.com/js/.. Overall, it doesn't matter what the path is, nor what the filename is, as long as you are correctly pointing to it. This isn't even javascript..this is true for any link, image, anchor tag, script include, etc.. you have on your page. This is basic HTML. What don't you understand? The demo script included a class for those containers. The fact that they didn't actually reference them in the css or js files means it's not relevant to the script. It's a common convention to add a class or id to your html elements, even if you aren't going to explicitly mark them up or reference them at the time. It makes it easier for other people to target or reference them for their own purposes later on down the road.
  19. http://crayonviolent.com/ItemSlider/ but I mean..it's basically the exact same thing as the demo.. I literally just grabbed it from the "download the source" link on the original http://tympanus.net/codrops/2012/12/31/how-to-create-a-simple-multi-item-slider/ page, and uploaded it to my server. Didn't change anything at all..
  20. Well, I just downloaded the source and put it on my own server, and it works just fine. So you're doing something wrong on your end. Did you upload modernizr.custom.63321.js to your server? Did you upload the css files to your server? Open your browser's development tools or firebug tab or whatever it is you use and look at the network/resources...do you see any 404 responses?
  21. Well uh, I don't really know what to tell you at this point.. did you try giving a shit about the images? As mentioned, seeing as how this script revolves around the images, maybe it's not working because you aren't pointing to valid images? If you are for realsies doing it exactly as they did on the demo, then maybe you have something else on the page that's conflicting with it. I don't really know how else I can help without seeing your page though.
  22. okay first off, i'm not sure why you posted your GA code, as that's not relevant to this in any way.. but anyways, if the browser says the file is not found, then you obviously didn't upload it to that location on your server. You need to make sure the script include on your page points to the location on your server where you uploaded it.
  23. If you don't want to change the script, how do you expect to make it do something more than what it already does?
  24. view the source on your own page. rightclick on your script include and copy the url. paste it into your browser. Does the code show up, or do you get a 404 (file not found) error?
  25. okay, the page you linked..had a bunch of javascript on it..that javascript is the plugin, the code for the slider. If you view the source of the demo, and then view the source of that js/jquery.catslider.js script include, you can see that it's the same code they showed you to add to the page. They just put it into a file and included the file on the page, for convenience. You need to save that javascript to a file and upload it to your server, and you need to change that script include to point to wherever you uploaded the file to. The demo has the file in a js subfolder, so you can create a subfolder on your server and put it there, or you can put the js file in the same directory as your page and then remove that part of the path in the script include. Do you understand how pathing works? Pathing isn't even javascript specific. Alternatively, you can just c/p the catslider.js code directly on your page (somewhere underneath the jquery script include - making sure it's wrapped in script tags). But most people put code in a separate js file because it's easier to organize and update stuff. Also, if you just blindly copy/pasted their source, then you probably will need to give a shit about the images, seeing as how this script has to do with images and probably won't work, or work funky or something, if the images don't exist..
×
×
  • 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.