-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
Yep, this is a forums, and you are here to ask questions. And you did get an answer. However, I'm free to point out when something isn't a "best practice" or generally not a good idea, or just plain stupid. It's like if my kid were to ask me what's the best way to make a homemade parachute to jump out of a tree. I could tell him which sheet to use and how to tie the rope around the corners..or I could tell him that jumping out of a tree with a homemade parachute is damn stupid. We aren't here to just blindly answer questions. We're here to try and help people become better programmers. Sometimes becoming a better programmer is recognizing that there are better ways to do what you are doing, or accepting that what you are doing doesn't make sense or is just stupid. Instead of acting like a 2 year old stomping your feet, swallow your pride and listen to advice given, and you just might learn something.
-
What's the point in even having a line that says "Current Password: **********" anyways? What function does that possibly serve anyone? The only "useful" thing that's related is when password change forms require you to ENTER your current password, in addition to the new one, as final verification. Simply displaying a line of text with stars is pointless and IMO kinda dumb.
-
1) this isn't a regex question. Thread moved. 2) There are a ton of "basic form" tutorials on the internet. 3) Are you sure you want to have 3 separate .php files that just show a message in a slightly different way? At face value, it sounds like it would be better for you to have a single php script that keeps your messages in an array and then just select a random element of the array.
-
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
-
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.
-
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
-
perhaps you are looking to use session variables instead?
-
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..
-
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.
-
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.
-
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.
-
...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);
-
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);
-
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.
-
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?
-
Okay, if you want to strip everything except the URLs, try this: $str = preg_replace('~^[^-]+-\s*~m','',$str);
-
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.
-
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:
-
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.
-
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.
-
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..
-
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?
-
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.
-
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.