-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
You just need to set the CSS left property back to 0: $("#box").stop().animate({"left": 0}, "slow");
-
JavaScript runs in the user's browser, so is unable to get whatever files are in a folder on the server. You need to use a server-side language that has access to the file system, like PHP.
-
Devices sometimes use landscape as the default orientation. That means 0 degrees on one device could be portrait, and on others 0 degrees is landscape. Some devices also allow you to turn the phone upside down which introduces a 180 degree orientation value. window.orientation is therefore very inconsistent. You're far better off avoiding trying to compensate for all these differences, and just working out the portrait/landscape orientation for yourself. For example: function getOrientation() { if (document.documentElement.clientWidth > document.documentElement.clientHeight) { return 'landscape'; } return 'portrait'; } Using that, your code would become: if (getOrientation() == 'landscape') { $("#naming").removeClass("naming_sided"); $("#drop2").removeClass("drop_sided"); $("#drop").removeClass("drop_sided"); } else { $("#drop2").removeClass("drop_sided"); $("#drop").addClass("drop_sided"); $("#drop2").addClass("drop_sided"); $("#naming").addClass("naming_sided"); } I don't really understand your actual question though. Not sure about the second either?
-
So mm, post just that part? In tags too, please Ok, well using your exact words, Google finds plenty of examples: http://www.google.co.uk/search?q=how+to+redirect+on+button+press+to+another+page Do you not have any luck researching this before?
-
How about a small donation to my bank account? Seriously, you can't just post about a thousand lines of code and say 'fix it'. You haven't even explained what this continue shopping button does?
-
My No Will No Skill blog/website [responsive/HTML5]
Adam replied to Grandioso's topic in Website Critique
There's no solution for responsive CSS in older IE versions, but you can use still use html5shiv to render it correctly for desktop size resolutions. Also a nice tool for testing responsive design, without having to manually resize the browser: http://responsive.is/http://test.no-will-no-skill.com/ The font looks awful on Chrome/Safari desktop. The whole site needs some colour if you ask me. -
Bit harsh that, don't you think?
-
Hmm I would definitely recommend benchmarking the two methods. Both have positives and negatives that stretched over 175000 repetitions could be quite a substantial difference. I would still lean towards the exif_imagetype() method though to be honest, just because it's a native function and more robust. I don't think the additional file read and rename would cause much of a difference. Benchmark them and find out though..
-
I would recommend using ignace's method by the way, given you're already writing to a file and it's only what exif_imagetype() does internally. Just posted the alternative method so you're a bit clearer on how it works.
-
Alternatively.. Each image type has it's own unique 'signature' within the first few bytes of the image. That means you can just run through an array of pre-defined signatures and check which matches, then write to a file: function getImageTypeFromBlob($imageData) { $signatures = array( 'jpg' => "\xFF\xD8\xFF", 'gif' => "GIF", 'png' => "\x89PNG", 'bmp' => "BM", 'swf' => "CWS" ); $first4Bytes = substr($imageData, 0, 4); foreach ($signatures as $imageType => $signature) { if (strpos($first4Bytes, $signature) === 0) { return $imageType; } } return false; }
-
You need to provide us with more information. Where abouts does the update and delete code live? What are "entire entries"? Has anything changed recently that might explain why some code has randomly stopped working? We're happy to help you but you need to meet us half way.
-
Nope, just run it through htmlspecialchars as you output it. That will convert all HTML-related characters into their entity format, so "<b>" will literally be displayed in the browser as "<b>", and in the source as "<b>". That is unless you want to allow HTML emails of course..
-
If you're only ever comparing it to a list of exact values, you don't have anything to worry about. The reason you need to escape user input before using it in an SQL query, is because you embed the user input directly into a variable. That means whatever the user enters, left unescaped, could alter what the statement does. For example, say the user enters "' OR 1=1 --". The PHP could look like: $sql = "select * from users where username = '{$userInput}'"; But what you're actually sending to the server is: Comparing variables doesn't have this issue.
-
You've already posted this website before: http://forums.phpfreaks.com/index.php?topic=310458
-
reading material regading Request Method var order
Adam replied to ricmetal's topic in PHP Coding Help
^ What CPD said. Despite those errors though, there's still no reason why 'anotherPHPscript.php' would be executed first. Is that the exact code you have? Edit: seen your latest post. I would suggest posting the exact code. -
Can you explain a little more what the template's job is? I'm having a hard time picturing what you're trying to do here.
-
reading material regading Request Method var order
Adam replied to ricmetal's topic in PHP Coding Help
I'm not sure I follow? $_SERVER['REQUEST_METHOD'] contains a string. This value is define before any of your code runs, but any uses of it will only be evaluated in line with the normal flow. There's no special parsing of it, to the best of my knowledge. I would guess the problem lies elsewhere in your logic. Can you post an example reproducing the issue you're talking about? -
No the credentials are still sent in the request when the user logs in. The difference being that it's the identity provider that performs the authentication, and then returns a success/failure response to the consumer. So yeah, all consumers or "service providers" if you prefer, must use identity to perform the login. If your partner already has an established login system, that could be a fair chunk of work on both ends. I'm not saying SSO is the be all and end all by the way, just explaining what SSO is exactly. I've not researched SAML or simpleSAMLphp enough to give an accurate answer on whether you should use them. I was just going on first impression, although I'm not a fan of such bloated XML-based services so I could be biased.
-
Does "SMSPrinter" give any more information about why it failed? Couldn't find server? 404 HTTP error?
-
They're called "WYSIWYG" editors; What You See Is What You Get. What do you consider to be a security risk character though?
-
By having to manually update their details, I meant they first have to input them into your service to login to somewhere else. Then if they ever changed their password for example, they would need to update it within your service too. Right? If so, that's not what SSO is, and not what SAML was built for. Which would explain your confusion.. SSO is meant to be a central, true single login for multiple sites. No duplicate data, it's just all one database of users that multiple websites use, through a service-based interface. Obviously a consumer (a website) can then store more more information specific to the user if they like, but the core of the data is all managed by the "identity provider".
-
SAML isn't a "term", it's an XML-based protocol. The point of it is to provide a standard way of exchanging authentication details via XML. Given it is XML though, I'm not really keen, especially if SOAP was wrapped around it. SimpleSAMLphp is an implementation of it, but after a quick look at some of the examples it looks too tightly coupled with the XML. The "identity provider" is generally a central server, communicated with through some kind of web service that controls user access. "Consumers" or "service providers", are different websites that connect to the identity provider and request access to their service for an end-user, based on the credentials included. The identity provider not only managers the users, but the consumers too. I wouldn't really call what you described as SSO, it sounds like you're just redirecting a user to another website with some POST data. Also is sounds like they have to manually update their details.. So I'm kind of wondering what the point of it is? Do you own/run the other sites you're logging users into? If not I don't think the other websites would appreciate you doing that.
-
I think you would benefit from using an existing package for this, like Fancybox or Tiny Box 2. Both have plenty of examples in their documentation.
-
I think it would make a lot more sense to post this on the CKSource forums.
-
Yeah, although even relying on those kind of false positive results such as null evaluating as 0 is a bad idea. You should always be over-explicit.