Jump to content

AzeS

Members
  • Content count

    85
  • Joined

  • Last visited

Community Reputation

0 Neutral

About AzeS

  • Rank
    Guy Who Asks Many Questions

Profile Information

  • Gender
    Not Telling
  1. AzeS

    Unexpectet String causes me cancer

    Thanks kicken, that solved it, i will concider to use the json encode
  2. I am working on a revision of the product cart in my shop, have found a suitable design and implement the required PHP snippets. So far so good, everything works, but somewhere an unexpected string has crept in. which i dont find because of an lack of experience in js. Shopping lists origin: https://codepen.io/bartveneman/pen/KHxLG?q=Cart%20&order=popularity&depth=everything&show_forks=false Generated HTML code: <script type="text/javascript"> /* jslint browser: true*/ /*global $*/ // https://github.com/jasonmoo/t.js (function(){function c(a){this.t=a}function l(a,b){for(var e=b.split(".");e.length;){if(!(e[0]in a))return!1;a=a[e.shift()]}return a}function d(a,b){return a.replace(h,function(e,a,i,f,c,h,k,m){var f=l(b,f),j="",g;if(!f)return"!"==i?d(c,b):k?d(m,b):"";if(!i)return d(h,b);if("@"==i){e=b._key;a=b._val;for(g in f)f.hasOwnProperty(g)&&(b._key=g,b._val=f[g],j+=d(c,b));b._key=e;b._val=a;return j}}).replace(k,function(a,c,d){return(a=l(b,d))||0===a?"%"==c?(new Option(a)).innerHTML.replace(/"/g,"""): a:""})}var h=/\{\{(([@!]?)(.+?))\}\}(([\s\S]+?)(\{\{:\1\}\}([\s\S]+?))?)\{\{\/\1\}\}/g,k=/\{\{([=%])(.+?)\}\}/g;c.prototype.render=function(a){return d(this.t,a)};window.t=c})(); // end of 't'; Number.prototype.to_$ = function () { return "$" + parseFloat( this ).toFixed(2); }; String.prototype.strip$ = function () { return this.split("$")[1]; }; var app = { shipping : 5.00, products : [ { "name" : "2.4GHz GPS WIFI Drone" "price" : "164.99" "img" : "IMG/COV/SHOP/IMG/REG/2017.10.2815.17.5925474Drone_SML.PNG" "desc" : "Flugzeit: 12 - 15 Minuten Ladezeit: 3- 4h" "pid" : "38" "qua" : "1" }, { "name" : "Dongguan Thermomixer" "price" : "349.89" "img" : "IMG/COV/SHOP/IMG/REG/2017.10.2612.04.3727212China-cheap-food-processor-dough-maker-with.png" "desc" : "Der Thermomixer feiert seit mehr als einem Jahrzehnt herausragende Erfolge. Schneiden, Zermahlen, Garen, Kochen, Mixen und Frittieren alles in einem Gerät, alles bald in Ihrer Küche." "pid" : "37" "qua" : "1" }, ], removeProduct: function () { "use strict"; var item = $(this).closest(".shopping-cart--list-item"); item.addClass("closing"); window.setTimeout( function () { item.remove(); app.updateTotals(); }, 500); // Timeout for css animation }, addProduct: function () { "use strict"; var qtyCtr = $(this).prev(".product-qty"), quantity = parseInt(qtyCtr.html(), 10) + 1; app.updateProductSubtotal(this, quantity); }, subtractProduct: function () { "use strict"; var qtyCtr = $(this).next(".product-qty"), num = parseInt(qtyCtr.html(), 10) - 1, quantity = num <= 0 ? 0 : num; app.updateProductSubtotal(this, quantity); }, updateProductSubtotal: function (context, quantity) { "use strict"; var ctr = $(context).closest(".product-modifiers"), productQtyCtr = ctr.find(".product-qty"), productPrice = parseFloat(ctr.data("product-price")), subtotalCtr = ctr.find(".product-total-price"), subtotalPrice = quantity * productPrice; productQtyCtr.html(quantity); subtotalCtr.html( subtotalPrice.to_$() ); app.updateTotals(); }, updateTotals: function () { "use strict"; var products = $(".shopping-cart--list-item"), subtotal = 0, shipping; for (var i = 0; i < products.length; i += 1) { subtotal += parseFloat( $(products[i]).find(".product-total-price").html().strip$() ); } shipping = (subtotal > 0 && subtotal < (100 / 1.06)) ? app.shipping : 0; $("#subtotalCtr").find(".cart-totals-value").html( subtotal.to_$() ); $("#taxesCtr").find(".cart-totals-value").html( (subtotal * 0.06).to_$() ); $("#totalCtr").find(".cart-totals-value").html( (subtotal * 1.06 + shipping).to_$() ); $("#shippingCtr").find(".cart-totals-value").html( shipping.to_$() ); }, attachEvents: function () { "use strict"; $(".product-remove").on("click", app.removeProduct); $(".product-plus").on("click", app.addProduct); $(".product-subtract").on("click", app.subtractProduct); }, setProductImages: function () { "use strict"; var images = $(".product-image"), ctr, img; for (var i = 0; i < images.length; i += 1) { ctr = $(images[i]), img = ctr.find(".product-image--img"); ctr.css("background-image", "url(" + img.attr("src") + ")"); img.remove(); } }, renderTemplates: function () { "use strict"; var products = app.products, content = [], template = new t( $("#shopping-cart--list-item-template").html() ); for (var i = 0; i < products.length; i += 1) { content[i] = template.render(products[i]); } $("#shopping-cart--list").html(content.join("")); } }; app.renderTemplates(); app.setProductImages(); app.attachEvents(); </script> Internal PHP Code: <script type="text/javascript"> /* jslint browser: true*/ /*global $*/ // https://github.com/jasonmoo/t.js (function(){function c(a){this.t=a}function l(a,b){for(var e=b.split(".");e.length;){if(!(e[0]in a))return!1;a=a[e.shift()]}return a}function d(a,b){return a.replace(h,function(e,a,i,f,c,h,k,m){var f=l(b,f),j="",g;if(!f)return"!"==i?d(c,b):k?d(m,b):"";if(!i)return d(h,b);if("@"==i){e=b._key;a=b._val;for(g in f)f.hasOwnProperty(g)&&(b._key=g,b._val=f[g],j+=d(c,b));b._key=e;b._val=a;return j}}).replace(k,function(a,c,d){return(a=l(b,d))||0===a?"%"==c?(new Option(a)).innerHTML.replace(/"/g,"""): a:""})}var h=/\{\{(([@!]?)(.+?))\}\}(([\s\S]+?)(\{\{:\1\}\}([\s\S]+?))?)\{\{\/\1\}\}/g,k=/\{\{([=%])(.+?)\}\}/g;c.prototype.render=function(a){return d(this.t,a)};window.t=c})(); // end of 't'; Number.prototype.to_$ = function () { return "$" + parseFloat( this ).toFixed(2); }; String.prototype.strip$ = function () { return this.split("$")[1]; }; var app = { shipping : 5.00, products : [ <?php if (isset($_SESSION['cart'])) { foreach ($_SESSION['cart'] as $row) { if ($row > 0) { #var_dump($_SESSION['quant']); #echo $row; $cur_pro_on_car = $Shop->product_get($row); echo "{\n"; echo '"name" : "' . $crud->word($cur_pro_on_car['prdname'], 'UTF-8') . '"' . "\n"; echo '"price" : "' . $crud->word($cur_pro_on_car['price'] / 100, 'UTF-8') . '"' . "\n"; echo '"img" : "' . $crud->word($cur_pro_on_car['prdpicsml'], 'UTF-8') . '"' . "\n"; echo '"desc" : "' . $crud->word($cur_pro_on_car['detailsstr'], 'UTF-8') . '"' . "\n"; echo '"pid" : "' . $crud->word($cur_pro_on_car['PID'], 'UTF-8') . '"' . "\n"; echo '"qua" : "'; if (in_array($cur_pro_on_car['PID'], array_keys($_SESSION['quant']))) { echo $crud->word($_SESSION['quant'][$cur_pro_on_car['PID']], 'UTF-8') . '"' . "\n"; } else { echo "1". '"' . "\n"; } echo "},\n"; } } } ?> ], removeProduct: function () { "use strict"; var item = $(this).closest(".shopping-cart--list-item"); item.addClass("closing"); window.setTimeout( function () { item.remove(); app.updateTotals(); }, 500); // Timeout for css animation }, addProduct: function () { "use strict"; var qtyCtr = $(this).prev(".product-qty"), quantity = parseInt(qtyCtr.html(), 10) + 1; app.updateProductSubtotal(this, quantity); }, subtractProduct: function () { "use strict"; var qtyCtr = $(this).next(".product-qty"), num = parseInt(qtyCtr.html(), 10) - 1, quantity = num <= 0 ? 0 : num; app.updateProductSubtotal(this, quantity); }, updateProductSubtotal: function (context, quantity) { "use strict"; var ctr = $(context).closest(".product-modifiers"), productQtyCtr = ctr.find(".product-qty"), productPrice = parseFloat(ctr.data("product-price")), subtotalCtr = ctr.find(".product-total-price"), subtotalPrice = quantity * productPrice; productQtyCtr.html(quantity); subtotalCtr.html( subtotalPrice.to_$() ); app.updateTotals(); }, updateTotals: function () { "use strict"; var products = $(".shopping-cart--list-item"), subtotal = 0, shipping; for (var i = 0; i < products.length; i += 1) { subtotal += parseFloat( $(products[i]).find(".product-total-price").html().strip$() ); } shipping = (subtotal > 0 && subtotal < (100 / 1.06)) ? app.shipping : 0; $("#subtotalCtr").find(".cart-totals-value").html( subtotal.to_$() ); $("#taxesCtr").find(".cart-totals-value").html( (subtotal * 0.06).to_$() ); $("#totalCtr").find(".cart-totals-value").html( (subtotal * 1.06 + shipping).to_$() ); $("#shippingCtr").find(".cart-totals-value").html( shipping.to_$() ); }, attachEvents: function () { "use strict"; $(".product-remove").on("click", app.removeProduct); $(".product-plus").on("click", app.addProduct); $(".product-subtract").on("click", app.subtractProduct); }, setProductImages: function () { "use strict"; var images = $(".product-image"), ctr, img; for (var i = 0; i < images.length; i += 1) { ctr = $(images[i]), img = ctr.find(".product-image--img"); ctr.css("background-image", "url(" + img.attr("src") + ")"); img.remove(); } }, renderTemplates: function () { "use strict"; var products = app.products, content = [], template = new t( $("#shopping-cart--list-item-template").html() ); for (var i = 0; i < products.length; i += 1) { content[i] = template.render(products[i]); } $("#shopping-cart--list").html(content.join("")); } }; app.renderTemplates(); app.setProductImages(); app.attachEvents(); </script> I hope we can find a solution together and I look forward to your recommendations.
  3. ok now ive seen it, im the worst, i assume that i just needed an other pair of eyes, thanks psycho
  4. I have to create an id check. For this, an id is generated and written in a cookie, encrypted by the md5 algorithm and a password phrase.Then the id sent to the page and encrypted with the same process and afterwards written to a variable.Then the cookie is read out and compared with the variabele, all well until the fact that the two strings are not considered equal even though they are. <?php $reference = $_GET['id']; setcookie("meoid", md5($reference . "Password") . " OID:" . $reference,time()+(600)); if (isset($_GET['id'])) { $hash = md5(trim(strip_tags($_GET['id'])) . "Password"); if ($hash == $_COOKIE['meoid']) { echo "yes: hash= " . $hash . "::::meoid: " . $_COOKIE['meoid']; } else { echo "no: hash= " . $hash . "::::meoid: " . $_COOKIE['meoid'] . " GENERATET: " . md5($_GET['id'] . "Password"); } } else { header("Location: ../../../../report.php?x=Abuse of Success"); } ?> what am i doing wrong here
  5. Ok, ill do it; what will work out the best for me? Sometimes I have: Split("\n", $foo); #and Split("\|", $bar);
  6. the issue is that you're not adding the mysqli connection. Change the result1 to: $result1 = mysqli_query($connection, $query1);
  7. But, but, i need halp, there are more than 3000 pages of php that i would have to go through and yes i have no life
  8. yes, thank you for that, but id like to change the name for preg_split() to split() in the php lib or install php 5 alongside with 7 without losing 7 as the standart and not to be informed in the fact that its removed/ deprecated
  9. I moved my website to an server and installed php7, but now 50% of data processing dosnt work anymore because split isnt working, how can i migrate split to php7 ? Or how can i accomplish that older functions still work in php7 ?
  10. AzeS

    UTF Umlaut problem

    REQUINIX I FOUND IT http://php.net/manual/en/function.urldecode.php
  11. AzeS

    UTF Umlaut problem

    In case that the error is in the htaccess i post the code below: #DirectoryIndex index.php Options +FollowSymLinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_METHOD} ^TRACE RewriteRule ^ - [F] # Redirect non-www to www: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Unless directory, remove trailing slash RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/$ http://www.vii7.eu/$1 [R=301,L] # Redirect external .php requests to extensionless url RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/ RewriteRule ^(.+)\.php$ http://www.vii7.eu/$1 [R=301,L] # add extension if the php file exists: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [L] # add extension if the png file exists: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.png -f RewriteRule ^(.*)$ $1.png [L] # add extension if the txt file exists: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.txt -f RewriteRule ^(.*)$ $1.txt [L] # add extension if the html file exists: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html [L] # etc. # finally, route to profile.php if all else fails #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^([a-zA-Z0-9-_.]*)$ /profile.php?id=$1 [L]
  12. AzeS

    UTF Umlaut problem

    Release is at November 23th
×

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.