hag++ 24 Junior Poster

The link http://thelightroomclothing.com/log/test.php now works. If you found the solution the best thing to do is post the solution here and mark this thread as "Solved". Thanks!

hag++ 24 Junior Poster

While an HTML5 solution is progressive it won't work for older browsers (specifically IE8 and under). You may want to consider a fallback to that, such as the html5media library which will provide video tag support for older browsers.

hag++ 24 Junior Poster

Do a right click > view source on the select element after the select2 is run on it... It changes absolutely everything and removes the select element (along with the class declarations) entirely.

I commented out the select2 and it does work fine as is because the select element is kept in tact. I don't know if this setup is going to work.

hag++ 24 Junior Poster

While the OP didn't say whether his app was using sessions or not I would definitely reccomend storing the names in session or in the cookie. If neither option is available then you would have to do some kind of workaround such as what Dani suggested.

hag++ 24 Junior Poster

Hmm well I would probably reccomend displaying the PDF in some kind of PDF viewer in the browser. This way you can initiate bi-directional communication about the state of the PDF's being viewed. Letting the user download the PDF and view it locally won't work obviously because you can't control anything about that process once the user has the file.

hag++ 24 Junior Poster

I highly agree with diafol if you have time to change it. If not and ryantroop's above comment is a concern then you could always redirect the user to the cart with every param except the ones used to add items.

hag++ 24 Junior Poster

There's no safety zones on php, it's a given.

Boy I hate it when people blame the tools instead of the developers. Sites built on ANY language can contain massive security holes if web security best practices are not followed. Blaming PHP is analagous to a bad carpenter blaming his hammer for the house collapsing.

hag++ 24 Junior Poster

The solution to your problem? Don't refresh. :-/

Not true. I would reccomend simply doing a redirect to the regular cart URL (without params) after you have updated the cart quantities. I put an example below. Since I don't know your URL's I improvised :)

if (isset($_GET['add']))
    $_SESSION['cart_'.$_GET['add']]+='1';
    header('Location: /cart.php');
}
hag++ 24 Junior Poster
hag++ 24 Junior Poster

Ok well first I would change your onreadystatechange function a little. he way it is will cause the "else" block to execute very often.

I would reccomend first checking that the readyState == 4, if it's not then just return. The readyState will become 4 when the request is finished (whether it errors out or not) so it's not worth doing anyhting with until it reaches that state.

 xhr.onreadystatechange = function() {
                if(this.readyState !== 4) return;

                if(this.status === 200) {                     
                         alert(this.responseText);
                }
                else {
                    alert("status " + this.status);
                    alert("readyState " + this.readyState);
                }
              };           

So the two things I changed was the readyState check and added the semicolon at the end of the statement. Since you are assigning an anonymous function you need the end semicolon. Also, keep in mind you are using the strict comparison operators (=== and !==). This is good but make sure that the datatypes are exactly the same or else the "if" block will never get run.

hag++ 24 Junior Poster

One of these is in regards to embedable scripts/ web apps/ widgets
What do you mean by this? You want to allow users to save their own html/javascript on your site? Upload flash content?

is it possible to store many sqlite databases in a mysql database?
Well ths is interesting... I suppose you could save them as blobs in a mysql database but I really don't see what you would want to do that. Why not just structure the main mysql database(s) so that users can save there?

hag++ 24 Junior Poster

I have no idea what you are trying to achieve with the copyFile() function being used to populate the href on the anchor tag. The copyFile() function does not return a value so you are not concatenating anything. On top of that, everytime the while loop iterates you are immediatly copying the files from $src to $dest.

Are you trying to make a link that will copy/download the file when it is clicked?

hag++ 24 Junior Poster

I don't see why not. You haven't given us a ton of information to work with but with the much improved support for classes in PHP 5.5x it shouldn't be a hard port at all.

hag++ 24 Junior Poster

Ok so as I thought the validate() method is called internally to check if the stored session captcha text is equal to the text passed to the check() method.

To troubleshoot, can you add var_dump() calls to line 18 in your form processor script? Please dump these and give me the results:

var_dump($_SESSION);
var_dump($_POST);
hag++ 24 Junior Poster

Can you post the code for the securimage.php script? I have a feeling this is happening because the required data is not being set properly in the session somewhere.
You could also dump the contents of the $_SESSION and $_POST superglobals and compare the data just to make sure the captcha stuff matches.

hag++ 24 Junior Poster

You're not going to see a huge difference efficiency wise, this all comes down to what design makes more sense for your project.

hag++ 24 Junior Poster

Pricing a job is highly dependent on a few major factors like the complexity of the project, the skill/experience of the development organization, and current market rates. I can't give you an exact number but this article is a good read on the subject.

http://goodcode.io/blog/pricing-fixed-vs-agile/

hag++ 24 Junior Poster

It just shows you, how one can use the prepare() method, and run statements with it, but it never shows, what/how the prepare method is created, what is inside the prepare method, or what is inside the PDO() class for that matter. I want to know, what is the in PDO() class, and its, properties & methods, how it looks, but the manual never shows that.

And that is exactly the point of creating a class in the first place. All of the logic and details of "how" are hidden within the interface. All one needs to know is how to use it, not how it works.

Say you have a method "abc". The documentations says that it takes a string input and returns it in all capital letters. Thats all you need to know in order to use it. You don't need to know how it goes about capitalizing each letter.

hag++ 24 Junior Poster

It doesn't look like you've included the correct script(s) yet or have any code related to SecurImage on your form processing page. Can you update the code and repost?

hag++ 24 Junior Poster

I believe the lock item has to be an object as well so if you wanted to put a lock on the counter you would have to use the Integer type instead of the primitive "int".

hag++ 24 Junior Poster

The htaccess file is used to limit/grant access to files in the current working directory and below only.

You are already taking a step in the right direction by disabling risky functions such as symlink. To further protect against unauthorized file access in PHP you also want to make sure you never pass unsanitized user input to any file access functions such as include/require. Remember, if user input does not make it into those functions it cannot do any harm. The risk comes when you need to dynamically include files based on user input.

hag++ 24 Junior Poster

The problem is here:

when i click on link CONNECT TEST1 of test1.php from web_index.php it says
The requested URL /test1.php was not found on this server.

In a directory sense you are not in the myweb_application directory. When you go to http://example.com and the index.php file is called, it loads web_index.php via a require/include statement. That does not change the current working directory. You're document root is still set to public_htm.

In order to get index1.php you need to call index1.php from the index.php script. You will probably want to do this via URL params but be warned, do not just pass a url parameter directly into an include/require statement. That is a huge security risk. What you need to do is have a whitelist of available param options. If the params passed in do not match the whitelist then reject it.

Something like this would work:
http://example.com/index.php?action=someActionHere

hag++ 24 Junior Poster

Also it's best practice to wrap all values to element attributes in double quotes.

<form method="POST" action="/myaction.php">

</form>
hag++ 24 Junior Poster

Ok well it sounds like you already have the server side/ajax setup so all you have to do is attach an onChange listener to the select element.

var select = document.getElementById('select_id');
select.onChange = function() {
    // Get the selected value
    var value = this.options[this.selectedIndex].value;
    // Process change event
};
hag++ 24 Junior Poster
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    define('CAKE_CORE_INCLUDE_PATH', DS.'C:'.DS.'xampp'.DS.'htdocs'.DS.'mysite'.DS.'cakecore');
}

You have a leading 'DS' in the define statement. Try removing that.

hag++ 24 Junior Poster

Ok well a couple things here. One, don't do this ever:
$sql="SELECT branch_name,branch_address,branch_contact,branch_nostaffs,branch_furniture FROM branch_details WHERE branch_id = '" . $name ."'";
That's wide open to SQL injection.

As far as why your search isn't working I'll need more info.
If you run the query directly against the database does it return data? Either run the query via the command line or in mysql workbench.

If it does not return data then you need to investigate why. If it does return data then we need to look more into your script.

Kyle Wiering commented: Awesome security catch! +0
hag++ 24 Junior Poster

using position: fixed with top: 0; left: 0 should place the image at the top left of the screen regardless of the viewport size. The issue you are going to run into with using position: fixed is that is does not work well on mobile devices at all. If you want this to work on mobile devices I would reccomend a javascript solution instead.

hag++ 24 Junior Poster

This question is far too vague to truly answer. This could be a question about AJAX, submitting data then accessing it on any other pages within the same domain (cookies/local storage) or CORS (sending data via AJAX to other domains). We need a better question here.

hag++ 24 Junior Poster

What you need to do is have the server return a link to the image. Something like "http://mysite.com/images/my_image.jpeg". Then take that link and apply it to the "src" tag of an image element. designershiv's answer above would do it if you were using jQuery but it doesn't look like you are. To apply the source do this:

var imageElem = document.getElementById('image_elem_id');
imageElem.src = 'http://mysite.com/images/my_image.jpeg';
hag++ 24 Junior Poster

Can you please post the code pertaining to this functionality and be specific about which part(s) you are stuck on?