davy_yg 2 Posting Whiz

Hello,

I get this error message: syntax error, unexpected '(', expecting variable (T_VARIABLE) or '{' or '$'

When running this code:

`
Rp. <div id="total"></div>

<script>

    $("#total").html({<?php number_format($("#subtot").val(), 0, '', '.'); ?>});

</script>

`

Any idea why?

AdamFriska commented: You can use AJAX for this kind of situtation +0
davy_yg 2 Posting Whiz

Hello,

This is PHP.

Help me understand this code:

    if($selectDB == true){
    $query = "INSERT INTO recruitment 
            (ID, nama, jenis_kelamin, tanggal_lahir, nohp, email, alamat, provinsi, kota, zip, status_nikah, jumlah_tanggungan, agama, file_attachment, cover_letter)
          VALUES (NULL, '$nama', '$jenis_kelamin', '$tanggal_lahir', '$nohp', '$email', '$alamat', '$provinsi', '$kota', '$zip', '$status_nikah','$jumlah_tanggungan','$agama','$file_attachment', '$cover_letter');";

        // "INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country)
        // VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Norway');";

    $simpan = mysqli_query($connect, $query);
    echo "save - ".$simpan;

    if(!$simpan){
        echo 'failed';
    }else{
            echo 'success';
    }
}

I wonder why $simpan = '' ?

1simpan - failed?

What did I do wrong?

davy_yg 2 Posting Whiz
var valtgl = $("#val-tgl").val();

var dateori = new Date(valtgl);

I would like something like this:

Tuesday, 2 October 2018

instead of:

Tue Oct 02 2018 07:00:00 GMT+0700 (Waktu Indonesia Barat)

Any clue how to?

davy_yg 2 Posting Whiz

How to downgrade mysqldump tools:

I am using mysql bench and when trying to export online databases from mysql bench to sql file I am getting this error:

mysqldump.exe is version 8.0.13 but the MySQL Server to be dumped has version 5.7.21. Because the version of mysqldump is not the same as the server, some features may not be backed up properly. It is recommeded you upgrade or downgrade your local MySQL client programs, including mysqldump, to a version equal to or newer than that of the target server. The path to the dump tool must then be set in Preferences -> Administrator -> Path to mysqldump Tools.

I cannot find the link to download mysqldump.exe version 5.7 and how to install it?

Thanks in advance.

davy_yg 2 Posting Whiz

I already put a link to css and it still does not works out.

<html>
<head>

<link rel="stylesheet" href="anime-master/documentation/assets/css/documentation.css">
<link rel="stylesheet" href="anime-master/documentation/assets/css/anime.css">

<script src="anime-master/anime.min.js"></script>

<script>
    var cssSelector = anime({
    targets: '#cssSelector .el',
    translateX: 250
});
</script>

<script>
    var el = document.querySelector('#JSarray .el-01');

    var JSarray = anime({
        targets: [el, '#JSarray .el-02', '#JSarray .el-03'],
        translateX: 250
    });
</script>
</head>
<body>

HTML

<div id="cssSelector">
  <div class="line">
    <div class="square el"></div>
  </div>
</div>

<div id="JSarray">
  <div class="line">
    <div class="square el-01" style="transform: translateX(250px);"></div>
  </div>
  <div class="line">
    <div class="square el-02" style="transform: translateX(250px);"></div>
  </div>
  <div class="line">
    <div class="square el-03" style="transform: translateX(250px);"></div>
  </div>
</div>

</body>

</html>
davy_yg 2 Posting Whiz

Hello all,

I am trying to understand how to use animation.js:

This is what I did:

And the result is only HTML text. I expect to see : http://animejs.com/documentation/#functionBasedDuration

The first animation appears. I wonder what's lacking. My link to the js is already correct:

<html>
<head>

<script src="anime-master/anime.min.js"></script>

<script>
    var cssSelector = anime({
    targets: '#cssSelector .el',
    translateX: 250
});
</script>

</head>
<body style="background-color: gray;">

HTML

<div id="cssSelector">
  <div class="line">
    <div class="square el"></div>
  </div>
</div>

</body>

</html>
davy_yg 2 Posting Whiz

Hello,

This is my first time using Python. I only know the basic syntax of python but I never actually run the code itself.

Therefore, I am trying to figure out how to install Python web server on localhost ?

I have this installer - GoogleCloudSDKInstaller

When trying to install it:

hecking network connection...done.
Reachability Check passed.
Network diagnostic (1/1 checks) passed.

You must log in to continue. Would you like to log in (Y/n)? y

Your browser has been opened to visit:

https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&access_type=offline

and it stops right there!

What else do I need to do?

Please advice me. Thanks in advance.

davy_yg 2 Posting Whiz

It's on Windows 10 - where can I find the msi installer?

davy_yg 2 Posting Whiz

I downloaded - httpd-2.4.34.tar.gz

and still cannot understand the file structure.

First, how to run the apache web server? which file do I need to click?

Second, in which folder do I need to put my web project files?

davy_yg 2 Posting Whiz

Hello,

I am trying to install apache on my localhost but cannot find the file that I need to install apache.

https://projects.apache.org/projects.html?name

Why there are so many apache installer file?

Which one should I download?

davy_yg 2 Posting Whiz

Hello,

Check this out - http://loudev.com/ .

I would like to add one more button called Select All to select all the email on leftside to move them to the right side. Any clue how to?

Thanks in advance.

davy_yg 2 Posting Whiz

Hello all,

I am quite impress knowing that Python has been the most popular programming language in July 2018.

Check this statistic: https://pypl.github.io/PYPL.html

It looks like there is a changing in trends - in 2015 PHP is rank no 2 and now rank 4. While Python rank 3 moves up to rank no. 1.

I wonder what makes it so populer?

Thanks in advance,
Davy

davy_yg 2 Posting Whiz

Hello,

I installed Turtoise Git and has been unable to pull:

From https://gitlab.com/website.com/restapi
= [up to date]      master     -> origin/master
Updating dad62f8..d807062
error: Your local changes to the following files would be overwritten by merge:
application/controllers/User.php
application/models/ContributionModel.php
application/models/OrderModel.php
Please commit your changes or stash them before you merge.
Aborting

git did not exit cleanly (exit code 1) (4391 ms @ 16/07/2018 10.08.12)

I should create git stash first but do not undetstand how to?

I already read https://git-scm.com/docs/git-stash

Can anyone guide me how to create git stash?

davy_yg 2 Posting Whiz

Okay let's say:

SELECT username, password FROM Users WHERE Id=$id by
injecting the following-
Id value: $id=1 UNION ALL SELECT username, passsword
FROM Othertable

We will have the following query: -

SELECT username, password FROM Users WHERE Id=1
UNION ALL SELECT username, password FROM
Othertable

Now what's the point of using UNION Query for the attacker since you don't know what is in Othertable ?

davy_yg 2 Posting Whiz

How to prevent Illegel/ Logically Incorrect Queries?

Illegal/Logically Incorrect Queries

1)Original
URL:http://www.arch.polimi.it/eventi/?id_nav=886
2)SQLInjection:
http:/`/www.arch.polimi.it/eventi/?id_nav=8864'
3) Error message showed:
SELECT name FROM Employee WHERE id =8864\' from
the message error we can find out name of table and fields:
name; Employee; id. By the gained information attacker can
arrange more strict attacks

Should I hide the error message into 404 - Error instead of showing all of them? or is there any other method to prevent this?

davy_yg 2 Posting Whiz

Let say :

$stmt = $dbh->prepare("SELECT * FROM users WHERE userID = $id");
$stmt->bindParam(':id', $name);

If I input: userID: tom' or '1'='1

What will be detected as the userID ? What will the query be like?

This is taken from the article. I only add the prepared statement.

davy_yg 2 Posting Whiz

Hello,

I am trying to understand prepared statement and what it does.

https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet#Defense_Option_1:_Prepared_Statements_.28Parameterized_Queries.29

"Prepared statements ensure that an attacker is not able to change the intent of a query, even if SQL commands are inserted by an attacker. In the safe example below, if an attacker were to enter the userID of tom' or '1'='1, the parameterized query would not be vulnerable and would instead look for a username which literally matched the entire string tom' or '1'='1. "

If an attacker input: userID of tom' or '1'='1

what will prepared statement detect as a userID?

userID: tom

Is that true? If all of them userID: tom' or '1'='1
then the SQLIA will be successful correct ?

davy_yg 2 Posting Whiz

Hello,

One type of SQLIA is UNION Query and I still do not completely understand what is the point.

SELECT Name, Address FROM Users WHERE Id=$id by
injecting the following-
Id value: $id=1 UNION ALL SELECT creditCardNumber,1
FROM CreditCarTable.

We will have the following query: -
SELECT Name, Address FROM Users WHERE Id=1
UNION ALL SELECT creditCardNumber, 1 FROM
CreditCarTable

What is the point of uniting the sqlia with another table which values are being kept secret?

Are main point is to be able to login to the admin for example.

davy_yg 2 Posting Whiz

Also What is PHP - PDO ?

I wonder why in the Query Parameterization it mentions:

https://www.owasp.org/index.php/Query_Parameterization_Cheat_Sheet

PHP - PDO ?

I thought PDO is only for the first query connections - is that true?

Such as in: https://www.w3schools.com/php/php_mysql_prepared_statements.asp

davy_yg 2 Posting Whiz

Hello,

I am trying to prevent SQL Injection on Codeigniter. I am reading this link:

https://www.roytuts.com/prevent-sql-injection-in-codeigniter/

I do not understand what is the purpose of Escaping Queries, Query Binding and Active Record.

Thanks in advance.

davy_yg 2 Posting Whiz

@pty,

What is a "sane ORM and coding standards that eliminate the angles of attack" ?

Is this prevention techniques a perfect one to prevent SQL Injection ?

https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet

Using ORM would requires frameworks then? Can Native PHP uses ORM ? And will that be safe from SQLIA ?

davy_yg 2 Posting Whiz

Hello,

I am planning to do my Thesis on SQLIA and now I am trying to understand something about SQLrand.

SQLrand - a system for preventing SQLIA against web servers. The main intuition is that by using a randomized SQL query language, specific to a particular CGI application, it is possible to detect and abort queries that include injected code.

Now, I do not understand how to randomized the SQL query language?

https://www.w3schools.com/sql/func_sqlserver_rand.asp

is that how you randomize the SELECT SQL command ?

Please gives me some guidelines.

Thanks in advance.

davy_yg 2 Posting Whiz

How to install Keras, Phython framework on Windows?

https://ankivil.com/installing-keras-theano-and-dependencies-on-windows-10/

C:\xampp\htdocs\python>cd "%USERPROFILE%\Anaconda3\Lib\site-packages"
The system cannot find the path specified.

What's missing?

Is installing CUDA and Theano a prerequisite before installing Keras?

davy_yg 2 Posting Whiz

Hello,

I am new to python.

I am trying to run this python program using xampp.

first.py

print('Interest Calculator:')
amount = float(input('Principal amount ?'))
roi = float(input('Rate of Interest ?'))
years = int(input('Duration (no. of years) ?'))
total = (amount * pow(1 + (roi/100), years))
interest = total - amount
print('\nInterest = %0.2f' %interest)

I wonder why it showing me the whole text ? Looks like I am missing something.

davy_yg 2 Posting Whiz

Hello,

I am testing the instagram api. And trying to figure out way to get the token.

It shows in this video: https://www.youtube.com/watch?v=fGMk8daxF08

By click the client ID twice it will shows me the get token form. Yet, this is not in my case. I cannot click the client ID twice. It is unclickable.

https://www.instagram.com/developer/authentication/

I only on Step 1 and get an error message on Step 2 - invalid client ID

Any clue?

davy_yg 2 Posting Whiz

Hello,

I am trying to border-collapse on a specific table.

#profitlosstbl table {

    width: 200px;
    border-collapse: collapse;
}   

#profitlosstbl td {

    border-collapse: collapse;
    width: 100%;
    padding: 10px;
    font-size: 12px;
    border: 1px solid black;
}

the border-collapse: collapse;

It only works if I use

table {
    border-collapse: collapse;
}

but I cannot do this since it will mess up the other tables.

What should I do?

davy_yg 2 Posting Whiz

bar_chart.html

<html>
<head>

<script type="text/javascript" src="fusioncharts/js/fusioncharts.js"></script>
<script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.fint.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

</head>
<body>

<script>
FusionCharts.ready(function () {
var revenueChart = new FusionCharts({
    type: 'doughnut2d',
    renderAt: 'chart-container',
    width: '450',
    height: '450',
    dataFormat: 'json',
    dataSource: {
        "chart": {
            "caption": "",
            "subCaption": "",
            "numberPrefix": "$",
            "paletteColors": "#5b9bd5,#ed7d31,#f2c500,#f45b00,#8e0000",
            "bgColor": "#ffffff",
            "showBorder": "0",
            "use3DLighting": "0",
            "showShadow": "0",
            "enableSmartLabels": "0",
            "startingAngle": "310",
            "showLabels": "0",
            "showPercentValues": "1",
            "showLegend": "1",
            "legendShadow": "0",
            "legendBorderAlpha": "0",
            "defaultCenterLabel": "Assets",
            "centerLabel": "Revenue from $label: $value",
            "centerLabelBold": "1",
            "showTooltip": "0",
            "decimals": "0",
            "captionFontSize": "14",
            "subcaptionFontSize": "14",
            "subcaptionFontBold": "0"
        },
        "data": [
            {
                "label": "",
                "value": "73%"
            },
            {
                "label": "",
                "value": "27%"
            }                
        ]
    }
}).render();
});
</script>
</head>

<body>
<div id="chart-container">FusionCharts will render here</div>
</body>

<div ng-app="" ng-init="names=[
{name:'My Bank',accounts:'40 accounts',IDR:'800,000,000.00' },
{name:'External Bank',accounts:'4 accounts', IDR: '300,000,000.00'}
]">

<table border="1">

<tr ng-repeat="x in names"> 
<td>{{ x.name }}</td>
<td>{{ x.accounts }}</td>
<td>{{ x.IDR }}</td>
</tr>
<tr>
    <td>Total Assets</td>
    <td></td>
    <td>{{ 3 * 2 }}</td>
</tr>   
</table>

</body>
</html>

Check my code above. how to take the table data from a seperate json file and for the fusion chart, how to seperate the json file?

Next, how to find the total assets from the x.IDR all being added ?

Thanks.

davy_yg 2 Posting Whiz

I wonder how to create a table in angular where the data is taken from Json or xml (must be seperated file)?

davy_yg 2 Posting Whiz

This time, I am trying to customize color in bar chart.

https://www.fusioncharts.com/dev/chart-guide/chart-configurations/data-plot

bar_chart.html

<html>
<head>

<script type="text/javascript" src="fusioncharts/js/fusioncharts.js"></script>
<script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.fint.js"></script>

<script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.fint.js"></script>

</head>
<body>

<script type="text/javascript">
    FusionCharts.ready(function() {
        var revenueChart = new FusionCharts({
            "type": "doughnut2d",
            "renderAt": "chartContainer",
            "width": "500",
            "height": "300",
            "dataFormat": "json",
            "dataSource": {
                "chart": {
                    "caption": "Account Overview",
                    "subCaption": "As of 20 February 2014",
                    "xAxisName": "Month",
                    "yAxisName": "Revenues (In USD)",
                    "theme": "fint",

                },
                "data": [{
                        "label": "Jan",
                        "value": "27%"

                    },
                    {
                        "label": "Feb",
                        "value": "73%"

                    }                        
                ]
            }

        });
        revenueChart.render();
    })
</script>
</head>

<body>
<div id="chartContainer">FusionCharts XT will load here!</div>
</body>

</body>
</html>

I wonder why if I put "color": "#008ee4" under "value": "73%" and "value": "27%" it gives me a blank screen instead of changing the color.

What's missing? I have been trying to follow the tutorial.

davy_yg 2 Posting Whiz

Hello,

I have been experimenting with Fusion Chart.

I have been following this tutorial: https://www.fusioncharts.com/dev/chart-guide/getting-started/using-xml-as-data-format

and trying to take the chart data from xml yet it does not works.

bar_chart_xml.html

<html>
<head>

<!--<script src="angularjs-plugin/wrappers/angularjs/angular-fusioncharts.min.js"></script>
<script src="angular.js"></script>
-->
<script type="text/javascript" src="fusioncharts/js/fusioncharts.js"></script>
<script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.fint.js"></script>

<script type="text/javascript" src="fusioncharts/js/themes/fusioncharts.theme.fint.js"></script>
<script type="text/javascript">
    FusionCharts.ready(  function  () { 
        var  csatGauge =   new  FusionCharts({
            "type" :  "angulargauge",
            "renderAt" :  "chart-container",
            "width" :  "400",
            "height" :  "250",
            "dataFormat" :  "json",
            "dataSource" :  {
                "chart" :  {
                    "caption" :  "Customer Satisfaction Score",
                    "subcaption" :  "Last week",
                    "lowerLimit" :  "0",
                    "upperLimit" :  "100",
                    "theme" :  "fint"
                },
                "colorRange" :  {
                    "color" :  [{
                            "minValue" :  "0",
                            "maxValue" :  "50",
                            "code" :  "#e44a00"
                        },
                        {
                            "minValue" :  "50",
                            "maxValue" :  "75",
                            "code" :  "#f8bd19"
                        },
                        {
                            "minValue" :  "75",
                            "maxValue" :  "100",
                            "code" :  "#6baa01"
                        }
                    ]
                },
                "dials" :  {
                    "dial" :  [{
                        "value" :  "67"
                    }]
                }
            }
        });

        csatGauge.render();
    });
</script>
</head>
<body>

<script type="text/javascript">
FusionCharts.ready(  function  () { 
    var  myChart =   new  FusionCharts({
        "type" :  "column2d",
        "renderAt" :  "chartContainer",
        "width" :  "500",
        "height" :  "300",
        "dataFormat" :  "xml",
        "dataSource" :  "<chart caption='Harry\'s SuperMart' subcaption='Monthly revenue for last year' xaxisname='Month' yaxisname='Amount' numberprefix='$' palettecolors='#008ee4' bgalpha='0' borderalpha='20' canvasborderalpha='0' useplotgradientcolor='0' plotborderalpha='10' placevaluesinside='1' rotatevalues='1' valuefontcolor='#ffffff' captionpadding='20' showaxislines='1' axislinealpha='25' divlinealpha='10'><set label='Jan' value='420000' /><set label='Feb' value='810000' /><set label='Mar' value='720000' /><set label='Apr' value='550000' /><set label='May' value='910000' /><set label='Jun' value='510000' /><set label='Jul' value='680000' /><set label='Aug' value='620000' /><set label='Sep' value='610000' /><set label='Oct' value='490000' /><set label='Nov' value='900000' /><set label='Dec' value='730000' /></chart>"
    });

    myChart.render();
});
</script>

</head>

<body> …
davy_yg 2 Posting Whiz

Hello,

I am following this tutorial:

https://valor-software.com/ng2-charts/

I try to set up the barchart. I copy exactly from the demo script:

new.html

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="node_modules/chart.js/src/chart.js"></script>
<script src="bar.js"></script>
</head>

<body>

<div>
  <div style="display: block">
    <canvas baseChart
            [datasets]="barChartData"
            [labels]="barChartLabels"
            [options]="barChartOptions"
            [legend]="barChartLegend"
            [chartType]="barChartType"
            (chartHover)="chartHovered($event)"
            (chartClick)="chartClicked($event)"></canvas>
  </div>
  <button (click)="randomize()">Update</button>
</div>

</body>
</html>

bar.js

import { Component } from '@angular/core';

@Component({
  selector: 'bar-chart-demo',
  templateUrl: './bar-chart-demo.html'
})
export class BarChartDemoComponent {
  public barChartOptions:any = {
    scaleShowVerticalLines: false,
    responsive: true
  };
  public barChartLabels:string[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
  public barChartType:string = 'bar';
  public barChartLegend:boolean = true;

  public barChartData:any[] = [
    {data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'},
    {data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'}
  ];

  // events
  public chartClicked(e:any):void {
    console.log(e);
  }

  public chartHovered(e:any):void {
    console.log(e);
  }

  public randomize():void {
    // Only Change 3 values
    let data = [
      Math.round(Math.random() * 100),
      59,
      80,
      (Math.random() * 100),
      56,
      (Math.random() * 100),
      40];
    let clone = JSON.parse(JSON.stringify(this.barChartData));
    clone[0].data = data;
    this.barChartData = clone;
    /**
     * (My guess), for Angular to recognize the change in the dataset
     * it has to change the dataset variable directly,
     * so one way around it, is to clone the data, change it and then
     * assign it;
     */
  }
}

I wonder why I still see a blank page with an update button?

What's missing? Do I need to modify the Markup or the TypeScript to make it works?

davy_yg 2 Posting Whiz

What the API file could be look like? Any example ? (an API file that's readable to produce a table consist of name and country.

Since I have a create a table using angular (the data in the table is provided), I only see the result. So I wonder what's the best way to input the data? If not through API is there some other methods to do it?

davy_yg 2 Posting Whiz

Hello,

I am trying to follow the following tutorials:

https://www.w3schools.com/angular/angular_tables.asp

 <div ng-app="myApp" ng-controller="customersCtrl">

<table>
  <tr ng-repeat="x in names">
    <td>{{ x.Name }}</td>
    <td>{{ x.Country }}</td>
  </tr>
</table>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
    $http.get("customers.php")
    .then(function (response) {$scope.names = response.data.records;});
});
</script> 

It produces a customer table. I wonder what is in customers.php to produces table like that? Since they do not show it in the tutorial.

davy_yg 2 Posting Whiz

Hello,

I am trying to create a bar chart with angular. I am following the following guidance:

https://www.fusioncharts.com/angularjs-charts/

I wonder why it does not works. I only see a blank screen when running bar_chart.html

bar_chart.html

<html>
<head>

<script src="barchart_data.js"></script>
<script src="angular-fusioncharts.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>

</head>
<body>

<div ng-app="myApp">...</div>

<div ng-controller="MyController">

<div fusioncharts 
    width="600" 
    height="400"
    type="column2d"
    datasource="{{myDataSource}}">
</div>

</div>

<script>
    angular.module("myApp", ["ng-fusioncharts"])
</script>

</body>
</html>

barchart_data.js

app.controller('MyController', function ($scope) {

$scope.myDataSource = {
    chart: {
        caption: "Harry's SuperMart",
        subCaption: "Top 5 stores in last month by revenue",
        numberPrefix: "$",
        theme: "ocean"
    },
    data:[{
        label: "Bakersfield Central",
        value: "880000"
    },
    {
        label: "Garden Groove harbour",
        value: "730000"
    },
    {
        label: "Los Angeles Topanga",
        value: "590000"
    },
    {
        label: "Compton-Rancho Dom",
        value: "520000"
    },
    {
        label: "Daly City Serramonte",
        value: "330000"
    }]
};

I already copy

to the same folder as bar_chart.html file.

davy_yg 2 Posting Whiz

I change the method to post and this time I get this error message:

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

I don't understand why part of the error shows:

GET Data

no_ktp "12345678"

foto_profile "KTP Davy.jpeg"

foto_ktp "photo.jpg"

syarat_penjual "true"

POST Data empty

I already set it "post".

davy_yg 2 Posting Whiz

I get this message:

The foto ktp must be an image.
The foto ktp must be a file of type: jpg, jpeg, png.
The foto profile must be an image.
The foto profile must be a file of type: jpg, jpeg, png.

I wonder why it does not pass the validation test?

I already uploaded a jpg & jpeg file and they are images. I uploaded 180 KB jpeg & 30 KB jpg files.

SellerController.php

public function add(Request $request)
    {

    $this->validate($request, [
      'no_ktp' => 'required|numeric',
      'foto_ktp' => 'required|image|mimes:jpg,jpeg,png|max:10000',
      'foto_profile' => 'required|image|mimes:jpg,jpeg,png|max:10000'
    ]);

    $original_name_ktp = $request->file('foto_ktp')->getClientOriginalName();
    $original_name_profile = $request->file('foto_profile')->getClientOriginalName();

    $request->file('foto_ktp')->storeAs(null, $original_name_ktp, 'foto_ktp');      
    $request->file('foto_profile')->storeAs(null, $original_name_profile, 'foto_profile');

    session()->flash('flash', 'Thank you, your registration completed');

    return redirect('/seller');

}

seller.blade.php

@include('layouts.errors')
@include('layouts.flash')
@include('layouts.errors_html')

<form action="{{ url('/daftarseller') }}" method="get" enctype="multipart/form-data">

<div id="box">
<hr>
<div id="langkah">LANGKAH 1</div>
<hr><br>

Masukkan No. KTP <input class="effect" name="no_ktp" type="textbox" placeholder="No. KTP" size="20"><br>
<br><br>
</div>  

<div id="box2">
<hr>    
<div id="langkah">LANGKAH 2</div>
<hr><br>

Foto diri beserta KTP Anda.<br>
Nomor KTP dan Wajah Anda harus terlihat jelas<br>
dalam foto.<br><br>

<div id="upload">
<br>

<div class="col-sm-6 col-xs-6">

<img src="images/reg/upload_foto.jpg" width="150">
<input type="file" class="foto_upload" name="foto_profile" accept="image/png,image/jpeg" required></div>

<div class="col-sm-6 col-xs-6">

<img src="images/reg/upload_ktp.jpg" width="150">
<input type="file" class="ktp_upload" name="foto_ktp" accept="image/png,image/jpeg" required></div>

<div class="col-sm-6 col-xs-6">Tambahkan Foto Anda</div>
<div class="col-sm-6 col-xs-6">Tambahkan Foto KTP Anda</div>

</div>

</div>

<br><br><br><br>

<div id="box3"><br>
<input type="checkbox" name="vehicle" value="Bike"> Saya setuju dengan <a href="https://shopee.co.id/docs/3000" target="_blank">Syarat & Ketentuan</a> program Penjual Terpilih Shopee.<br>
</div>

<br><br>
<div id="box4"><br>
<img src="images/reg/btn_kirim.jpg" width="300">
<input type="submit" value="Submit">
</div>

</form>
davy_yg 2 Posting Whiz

Any clue how to use an image for browse button?

I try :

<input type="file" name="userfile">
<input type="image" src="images/reg/upload_foto.jpg" value="Upload" name="Upload">

and still does not works. Can you turn an image into a browse file button?

davy_yg 2 Posting Whiz

Ever heard Saas or Less? (for frontend developer)

What is it for?

I read the article and still do not understand the purpose.

davy_yg 2 Posting Whiz

I still getting this error:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function person::__construct(), 0 passed in C:\xampp\htdocs\TEST\program_3_OOP_PHP.php on line 7 and exactly 1 expected in C:\xampp\htdocs\TEST\class_lib.php:10 Stack trace: #0 C:\xampp\htdocs\TEST\program_3_OOP_PHP.php(7): person->__construct() #1 {main} thrown in C:\xampp\htdocs\TEST\class_lib.php on line 10

class_lib.php

<?php

class person {

var $name;

function __construct($person_name){
    echo "Initialize class";
}

function set_name($new_name){
    $this->name($new_name);
}

function get_name($new_name){
    return $this->name($new_name);  
}

function __destruct(){
    echo "end class";
}
}

?>

program3.php

<?php include("class_lib.php"); ?>

<?php

$stefan = new person();
$jimmy = new person();

$stefan->set_name('stefan');
$jimmy->set_name('jimmy');

echo "Stefan Full Name : ".$stefan->get_name();
echo "Jimmy Full Name : ".$jimmy->get_name();

?>
davy_yg 2 Posting Whiz

What is PHP Enginee?

If Xampp is the web server, then is the php enginee apart of the web server?

http://www.php.net/downloads.php

Can you upgrade the php enginee - to support a higher version of php without uninstalling the xampp?

Thanks for advice.

davy_yg 2 Posting Whiz

Hello,

I try to create a simple OOP PHP that shows an error:

class_lib.php

<?php

class person {

var $name;

function __constructor($person_name){
    echo "Initialize class";
}

function set_name($new_name){
    $this->name($new_name);
}

function get_name($new_name){
    return $this->name($new_name);  
}

function __destructor(){
    echo "end class";
}
}

?>

program3.php

<?php include("class_lib.php"); ?> <?php

$stefan = new person();
$jimmy = new person();

$stefan->set_name();
$jimmy->set_name();

echo "Stefan Full Name : ".$stefan->get_name();
echo "Jimmy Full Name : ".$jimmy->get_name();

?>

Fatal error: Uncaught ArgumentCountError: Too few arguments to function person::set_name(), 0 passed in C:\xampp\htdocs\TEST\program_3_OOP_PHP.php on line 10 and exactly 1 expected in C:\xampp\htdocs\TEST\class_lib.php:14 Stack trace: #0 C:\xampp\htdocs\TEST\program_3_OOP_PHP.php(10): person->set_name() #1 {main} thrown in C:\xampp\htdocs\TEST\class_lib.php on line 14

line 14: function set_name($new_name){

I am following this tutorial: https://belajarphp.net/belajar-konsep-oop-php/

Thanks in advance.
Can anyone help me fix the error?

davy_yg 2 Posting Whiz

program2.php

<html>
<header>
</header>

<body>

<?php 

function Multiply($x, $y)
    {
    echo $x * $y;
    }

echo 'Multiply : '.Multiply(2,3).'<br><br>';

?>  

</body>

</html>

Why the result of the above program is :

6Multiply :

instead of

Multiply : 6

Any clue?

davy_yg 2 Posting Whiz

program1.php

<html> <header> <script>

function myFunction(p1, p2) {
    return p1 * p2;
}
document.getElementById("demo").innerHTML = myFunction(4, 3);   
</script> </header> <body> <div id="demo"></div> </body> </html>

I don't understand why the above code does not show any value?

and why this one does?

program2.php

<html> <body> <div id="demo"></div> <script>
    function myFunction(p1, p2) {
return p1 * p2;
}
document.getElementById("demo").innerHTML = myFunction(4, 3);
</script> </body> </html>

Why I cannot stated the js first then calling it? Why calling it first then stated the js?

davy_yg 2 Posting Whiz

Hello,

I am tryiing to create a polling. How to create the database for it?

This is polling database:

id 
q   
1   
2   
3   
4   
5   
6   
7   
8 

q= question
1-8= option 1 - 8

After certain period of time, I should be able to create a pie chart from the poll. What else do I need to create a good poll?

davy_yg 2 Posting Whiz

So it's not an alternative?

For instance instead of using ' (mark), you can use %27 for sql injection test?

Which is normally

Username = [" or ""=" ]
Password = [" or ""=" ]

davy_yg 2 Posting Whiz

Hello,

I am in the middle of learning about IT Security.

I wonder why sometimes people uses ASCII value for SQL injection attack? Do you know the reason why?

Why not using normal ' mark.

davy_yg 2 Posting Whiz

Hello,

I would like to style my table. I have two different table that I would like to style differently. How to do so?

This is what I try but it does not work:

table, td {
    padding: 5px;
}

 .order table, td{
    width: 5px;
}
</style>

<table class="order" border="1">
  <tr>
    <th>Nama Produk</th>
    <th>Harga</th>  
    <th>Jumlah Pembelian</th>  
    <th>Tipe Produk</th>  
    <th>Total</th>          
  </tr>
  <tr>
    <th><input type="text" name="fname"></th>
    <td><input type="text" name="fname"></td>
    <td><input type="text" name="fname"></td>
    <td><input type="text" name="fname"></td>
    <td><input type="text" name="fname"></td>
  </tr>

</table>

One table order I would like to set the width : 5px.

Please help. Thanks in advance.

davy_yg 2 Posting Whiz

My background is PHP and I use Laravel. I heard that you cannot create AI with Laravel that's why I have to use Python.

Can you integrate Python with Laravel?

For example creating a chat assistant (chatbots)

davy_yg 2 Posting Whiz

Hello,

Anyone knows anything about phython?

Someone mention to me if you need anything about AI Phython would be the perfect language to program it. Is that true?

Thanks in advance.

davy_yg 2 Posting Whiz

Can anyone help me explain what is Machine Learning?

I have been googling for the subject and still do not understand what it is. Please help.

1) How could a Machine learn about information? By finding an equation of a pattern? or by having the user inputing a new information about the subject that the machine do not understand?

2) Please gives me a concrete example of Machine Learning.

Thanks in advance.