Skip to content

Commit

Permalink
Dev (#6)
Browse files Browse the repository at this point in the history
* improvements

* modify gitignore
  • Loading branch information
manh21 authored Oct 14, 2020
1 parent 0fc6fdb commit 8637ddc
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 137 deletions.
32 changes: 32 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# Auto detect text files and perform LF normalization
* text=auto

*.zip
### vscode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

.github

### CodeIgniter ###
*/config/development
*/logs/log-*.php
!*/logs/index.html
*/cache/*
!*/cache/index.html
!*/cache/.htaccess

user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*

#codeigniter 3
application/logs/*
!application/logs/index.html
!application/logs/.htaccess
/vendor/

### CodeIgniter Patch ###
72 changes: 2 additions & 70 deletions application/config/database.php
Original file line number Diff line number Diff line change
@@ -1,75 +1,7 @@
<?php
// defined('BASEPATH') or exit('No direct script access allowed');

/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/

$active_group = 'default';
$query_builder = TRUE;

Expand All @@ -78,7 +10,7 @@
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'eVoting',
'database' => 'evoting',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
Expand Down
8 changes: 4 additions & 4 deletions application/controllers/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct()
parent::__construct();
$this->load->database();
$this->load->library('ion_auth', 'form_validation', 'session');
$this->load->helper('url', 'language');
$this->load->helper('url', 'language', 'my_helper');
$this->load->model('Home_model');
}

Expand All @@ -39,7 +39,7 @@ public function index()
}

$data['title'] = 'E-Voting';
$data['action'] = site_url('user/Userauth/login');
$data['action'] = site_url('user/userauth/login');

$this->load->view('front/main', $data);
}
Expand All @@ -48,7 +48,7 @@ public function vote()
{
// Security check if the user is authorize
if (!cek_login_bol()) {
redirect('user/Userauth', 'refresh');
redirect('user/userauth', 'refresh');
}

// Get All Kandidat
Expand Down Expand Up @@ -79,7 +79,7 @@ public function doVote($idkandidat)
{
// Security check if the user is authorize
if (!cek_login_bol()) {
redirect('user/Userauth', 'refresh');
redirect('user/userauth', 'refresh');
}

// menetapkan idpemilih
Expand Down
10 changes: 5 additions & 5 deletions application/controllers/user/userAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function index()
'class' => 'form-control',
'placeholder' => 'Password',
];
$data['action'] = site_url('user/Userauth/login');
$data['action'] = site_url('user/userauth/login');
$this->load->view('front/login', $data);
}
}
Expand All @@ -55,7 +55,7 @@ public function login()
'message',
'<div class="alert alert-danger alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' . validation_errors() . '</div>'
);
redirect('user/Userauth', 'refresh');
redirect('user/userauth', 'refresh');
} else {

// Define var dari login.php
Expand Down Expand Up @@ -108,7 +108,7 @@ public function login()
);

// Directed to login page
redirect('user/Userauth', 'refresh');
redirect('user/userauth', 'refresh');
}
} else {

Expand All @@ -121,7 +121,7 @@ public function login()
);

// Directed to login page
redirect('user/Userauth', 'refresh');
redirect('user/userauth', 'refresh');
}
}
}
Expand All @@ -144,4 +144,4 @@ public function logout()
}
}

/* End of file Userauth.php */
/* End of file UserAuth.php */
109 changes: 52 additions & 57 deletions application/helpers/my_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,63 +170,58 @@ function terbilang($nilai)
*
*/

function convertNumber($number)
{
list($integer, $fraction) = explode(".", (string) $number);

$output = "";

if ($integer{
0} == "-") {
$output = "negative ";
$integer = ltrim($integer, "-");
} else if ($integer{
0} == "+") {
$output = "positive ";
$integer = ltrim($integer, "+");
}

if ($integer{
0} == "0") {
$output .= "zero";
} else {
$integer = str_pad($integer, 36, "0", STR_PAD_LEFT);
$group = rtrim(chunk_split($integer, 3, " "), " ");
$groups = explode(" ", $group);

$groups2 = array();
foreach ($groups as $g) {
$groups2[] = convertThreeDigit($g{
0}, $g{
1}, $g{
2});
}

for ($z = 0; $z < count($groups2); $z++) {
if ($groups2[$z] != "") {
$output .= $groups2[$z] . convertGroup(11 - $z) . ($z < 11
&& !array_search('', array_slice($groups2, $z + 1, -1))
&& $groups2[11] != ''
&& $groups[11]{
0} == '0'
? " and "
: ", ");
}
}

$output = rtrim($output, ", ");
}

if ($fraction > 0) {
$output .= " point";
for ($i = 0; $i < strlen($fraction); $i++) {
$output .= " " . convertDigit($fraction{
$i});
}
}

return $output;
}
// DEPECTED IN PHP 7.4

// function convertNumber($number)
// {
// list($integer, $fraction) = explode(".", (string) $number);

// $output = "";

// if ($integer{0} == "-") {
// $output = "negative ";
// $integer = ltrim($integer, "-");
// } else if ($integer{0} == "+") {
// $output = "positive ";
// $integer = ltrim($integer, "+");
// }

// if ($integer{
// 0} == "0") {
// $output .= "zero";
// } else {
// $integer = str_pad($integer, 36, "0", STR_PAD_LEFT);
// $group = rtrim(chunk_split($integer, 3, " "), " ");
// $groups = explode(" ", $group);

// $groups2 = array();
// foreach ($groups as $g) {
// $groups2[] = convertThreeDigit($g{0}, $g{1}, $g{2});
// }

// for ($z = 0; $z < count($groups2); $z++) {
// if ($groups2[$z] != "") {
// $output .= $groups2[$z] . convertGroup(11 - $z) . ($z < 11
// && !array_search('', array_slice($groups2, $z + 1, -1))
// && $groups2[11] != ''
// && $groups[11]{0} == '0'
// ? " and "
// : ", ");
// }
// }

// $output = rtrim($output, ", ");
// }

// if ($fraction > 0) {
// $output .= " point";
// for ($i = 0; $i < strlen($fraction); $i++) {
// $output .= " " . convertDigit($fraction{$i});
// }
// }

// return $output;
// }

function convertGroup($index)
{
Expand Down
2 changes: 1 addition & 1 deletion application/models/userAuth_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public function akses($username, $password)
}
}

/* End of file userAuth_model.php */
/* End of file Userauth_model.php */
5 changes: 5 additions & 0 deletions application/views/back/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu" data-widget="tree">
<li>
<a href="<?php echo base_url()?>" target="_blank">
<i class="fa fa-globe"></i> <span>Show Website</span>
</a>
</li>
<li class="header">MAIN NAVIGATION</li>
<li>
<a href="<?php echo base_url('admin') ?>">
Expand Down
Binary file added eVoting.zip
Binary file not shown.
File renamed without changes.

0 comments on commit 8637ddc

Please sign in to comment.