gottaloveit 44 Newbie Poster

Currency.js also works very well for this

gottaloveit 44 Newbie Poster

This is just an initial observation / question, but why are you running every step through rawurlencode? Look at the definition of the function - every time you run it on a string it will encode everything non numeric except -_.~ ... so if you run it once and it returns %20 for example and you run it again on that string, that %20 will become like %blah%20 or whatever. If it were me, I would not have any rawurlencode in your sign function. Build your query string in plain ole English, like you are typing into the browser, then right before you send it you encode it. Or better yet use curl_escape.

FarrisFahad commented: Yay +12
gottaloveit 44 Newbie Poster

Agree with Biiim, you need to loop through the results. example below. note I took the body out of the loop.

<?php

                                /*error_reporting(E_ALL);
                                ini_set('display_errors', 1);*/

                                $CustomerName = $_GET['customername'];
                                //echo htmlentities($CustomerName);

                                $sql = "SELECT 
                                                    tblorders.InvoiceNumber,
                                                    tblorders.LorryName,
                                                    tblorders.CustomerName,
                                                    tblorders.DeliveryDate,
                                                    tblorders.PaymentMode,
                                                    tblorders.DeliveryMethod,
                                                    GROUP_CONCAT(CONCAT(tblorders.Quantity, ' of ', tblproducts.ProductName) SEPARATOR ', ') AS productnames, 
                                                    tblorders.InvoiceGenDate
                                                FROM tblorders 
                                                JOIN tblproducts ON tblproducts.id = tblorders.ProductId
                                                JOIN tblcustomers ON tblorders.CustomerName = tblcustomers.customername
                                                WHERE tblorders.CustomerName = :CustomerName";

                                $statement = $dbh->prepare($sql);
                                $statement->bindValue(':CustomerName', $CustomerName);
                                $result = $statement->execute();

                                if(!$result)
                                {
                                    //Query failed
    echo "Query failed";
    //Add debugging code
                                }
                                elseif(!$statement->rowCount())
{
    //No results returned
    echo "No user found for user " . htmlentities($CustomerName);
   //Add debugging code
}
                                else
{
?>
                                <tbody>
 <?php
    //A record was returned, display results
    while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {

                                    ?>


                                    <tr>
                                        <td><?php echo $row['InvoiceNumber']; ?></td>
                                        <td><?php echo $row['LorryName'] ;?></td>
                                        <td><?php echo htmlentities(date("d-m-Y", strtotime($row['DeliveryDate'])));?></td>
                                        <td><?php echo $row['PaymentMode'];?></td>
                                        <td><?php echo $row['DeliveryMethod'];?></td>
                                        <td><?php echo htmlentities(date("d-m-Y", strtotime($row['InvoiceGenDate'])));?></td>
                                        <td><?php echo $row['productnames'];?></td>
                                        <td class="project-actions text-right">
                                        <a class="btn btn-primary btn-sm" href="#">View Invoice</a></td>
                                    </tr>
<?php } ?>
                            </tbody>

                            <?php

    //echo "Start Date: {$row['CustomerName']}<br/>\n";
}

$statement->closeCursor();
                                ?>
Biiim commented: You need to remove the GROUP_CONCAT, it merges together all rows and is the problem he is having -2
gottaloveit 44 Newbie Poster

In whatever code language is running on the server, use a well known database library that is well documented and features XSS aka sql injection prevention.

gottaloveit 44 Newbie Poster

it's complaining the index "gambarvk_image" is not defined on line 821 which is code we can't see. I assume that the HTML form file input field is not named exactly "gambarvk_image" or maybe is named "gambarvk_image[]" or some variant or the form is not the right encoding. So check that first.

All the rest of the notices and errors are cascading because of that.

Also its not the best idea to get the type of image from the filename. If you have GD extension in your php enabled, a better method is something like the function image_type_to_mime_type

But verify the HTML form first

gottaloveit 44 Newbie Poster

I agree with everyone else, you can never prevent downloading, since the browser has to download, but you can make it harder for people to save and re-use the images. Here's a PHP script using standard PHP GD library, nothing special. It will break the image down into small chunks and then generate HTML to load them in the browser. So viewing source or inspecting the "image" will show up as a huge amount of really small images with totally random names. So reassembly would be tricky unless they did a lot of work copying the original HTML source to reassemble them.

Please don't flame me on the code. I know it can be improved for performance and other reasons, this is just an example of a possible solution, and it does work.

<?php

# the below width and height are set static and work out with no extra width or height
# from the source image.
# in production, it would probably be better to dynamically create the height and width 
# using a method to make sure there is no space left over
# or track the space left over in the loop and adjust the specs
# this is just for an example of the requirements of the OP

$width = 30; 
$height = 30; 
$sourceFile = "https://sample-videos.com/img/Sample-jpg-image-50kb.jpg";
$source = @imagecreatefromjpeg( $sourceFile ); 
$source_width = imagesx( $source ); 
$source_height = imagesy( $source ); 
$randomStringLength = 32;

$numberOfPixels = (($source_height * $source_width) / ($width * $height));
if ($numberOfPixels …
Dani commented: Creative solution! +34
gottaloveit 44 Newbie Poster

First your htaccess rules are written to NOT redirect index.php

The rules are: If the request filename (index.php) is not a file and is not a directory then redirect to index.php. Well obviously index.php is a file, so your conditions don't apply.

Also you have 2 things to worry about, first is redirecting /index.php to / and then handling the / with index.php

I would do something like this in the .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_URI} /index\.php [NC]
RewriteRule ^ / [NE,L,R]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php/$1 [L]
</IfModule>

Also, very important, in the Apache HTTP server configuration, make sure AllowOverride All is set for the website document root and make sure the Apache mod_rewrite module is loaded in the main config.

gottaloveit 44 Newbie Poster

I'm assuming you are using some sort of Javascript Ajax click event to call a url that PHP routes to this function contractor_email_details

If that's the case, and you are simply passing the ID in the url like for instance:

/url/php_page.php?id=X

Then the variable $data in the function variables is (should be) the ID. So, I would change line 3 to:

$rollout_id = $data;

See if that works for you. If not, then it could be passing something like the form object, so I would try:

$rollout_id = $data[id];

Where id is the variable name in the URL that you are using for the Ajax click event

gottaloveit 44 Newbie Poster

try zoho crm

gottaloveit 44 Newbie Poster

From watching the video, I am understanding your question to be

Why does the application load so slowly in the browser?

So, judging from the task manager, I am going to assume you are using a laptop (since it has a dual core processor with 8gb of ram) and that you are running PHP's built in web server (since it is accessing port 8000 on localhost) and you are running MySQL locally. Not looking at your code at all, I would expect some delays in this environment as a laptop, PHP web server are not production suited environments. Have your tried the code and the database on an actual server?

Also, just in case, make sure you are properly indexing your MySQL tables.