Stefce 146 Posting Pro

Here is the error it gives me

Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 27
db problem.
Warning: main(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 31

Fatal error: Wrong SQL: SELECT `Uplata`, `Dobivka`, `Date`, `sharedTime`, `match1`, `match2`, `match3`, `match4`, `match5`, `match6`, `match7`, `match8`, `match9`, `match10`, `match11`, `match12`, `match13`, `match14`, `match15`, `match16`,`Odds`, `tip1`, `tip2`, `tip3`, `tip4`, `tip5`, `tip6`, `tip7`, `tip8`, `tip9`, `tip10`, `tip11`, `tip12`, `tip13`, `tip14`, `tip15`, `tip16`, `isActive`, `ticket_id`, `isShared`, `Username`, `Liked`, `is_wined` FROM `kladilnica` WHERE Username='s' Error: in C:\xampp\htdocs\bootstrap\tickets_info.php on line 31

And here is the code:

$user = getUserData('users', 'UserUsername');
$ticket = getUserData('kladilnica', 'ticket_id');
$sql = "
    SELECT
        `Uplata`, `Dobivka`, `Date`, `sharedTime`, `match1`, `match2`,
        `match3`, `match4`, `match5`, `match6`, `match7`, `match8`, `match9`,
        `match10`, `match11`, `match12`, `match13`, `match14`, `match15`,
        `match16`,`Odds`, `tip1`, `tip2`, `tip3`, `tip4`, `tip5`, `tip6`,
        `tip7`, `tip8`, `tip9`, `tip10`, `tip11`, `tip12`, `tip13`, `tip14`,
        `tip15`, `tip16`, `isActive`, `ticket_id`, `isShared`, `Username`,
        `Liked`, `is_wined`
    FROM
        `kladilnica`
    WHERE
        Username='{$user}'
    ";

    $result = $conn->query($sql);

    if(!$result) {
        echo "db problem.";
        trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
    } else {
        if($result->num_rows == 0){
            echo "/";
        } else if($result->num_rows >= 1) {
            while($row = $result->fetch_assoc()) {
                $is_wined = $row["is_wined"];
                $uplata = $row["Uplata"];
                $dobivka = $row["Dobivka"];

                $uplata_total = $uplata_total + $uplata;

                if($is_wined == 1){
                    $dobivka_total = $dobivka_total + $dobivka;
                }

            }
            ?>

I have executed successfully in phpMyAdmin

Stefce 146 Posting Pro

Thank you cereal! Finally realized that i was using wrong $DBServer info :S

Stefce 146 Posting Pro

I putted the script files into their File Manager in public_html also there was 2 files one default.php and the other i dont remember, i have deleted them and placed my files there. Maybe its because of them ? Also i had on the same server other files and it was working good.. so now when im uploading this new files that error appear. So i need to pay for my account to use 000webhost ?

Stefce 146 Posting Pro

Yes i have access to phpMyAdmin and i can connect via FileZilla

Stefce 146 Posting Pro

Sorry i didnt get you can you explain me more how should i do that ? sorry i dont have to much knowledge in PHP

Stefce 146 Posting Pro

I have host on 000webhost when i will try to connect it gives me this error i cannot figure out whats the problem ?
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/1130): Host '31.170.161.176' is not allowed to connect to this MySQL server in /home/a2548020/public_html/includes/connection.php on line 6

here is my connection script

<?php
    $DBServer = ''; //my info
    $DBUser   = ''; //my info
    $DBPass   = ''; //my info
    $DBName   = ''; //my info
    $conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
    //$conn = mysqli_connect($DBServer, $DBUser, $DBPass, $DBName);

    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }
?>
Stefce 146 Posting Pro

I have this code but it tells me that cant find that ID when im getting the item ID

function link_encrypt($link) {
    $hash_format = "$2y$10$";
    $salt_lenght = 22;

    $salt = generate_salt($salt_lenght);
    $format_and_salt = $hash_format . $salt_lenght;
    $hash = crypt($link, "e5h8g7ghe58g7e5hg8e57he58h7j10jxd");
    return $hash;
}

function generate_salt($lenght) {
    $unique_random_string = md5(uniqid(mt_rand(), true));
    $base64_string = base64_encode($unique_random_string);
    $modified_base64_string = str_replace('+', '.', $base64_string);
    $salt = substr($modified_base64_string, 0, $lenght);
    return $salt;
}

function link_check($link, $existing_hash) {
    $hash = crypt($link, $existing_hash);
    if($hash === $existing_hash) {
        return true;
    } else {
        return false;
    }
}


articles.php
$get_article_id = link_encrypt($_GET['articleID']);
Stefce 146 Posting Pro

So should i buy an SSL certificate to do this or should i make it with code ? also there isn't php way of doing this ?

Stefce 146 Posting Pro

I have two questions does its possible to encrypt get parameter same like the passwords are? If NO whats the best method to do it i have simple parameter articleID=1, i want to encrypt the number which user is not able to see it or hack it so should look something like this articleID=jt8asd9HG43u52Jh1jk94X

Stefce 146 Posting Pro

Actually this is exactly what i want! But i dont get it how can i implement the sound into the button so it will sound same like in the engine...

Stefce 146 Posting Pro

Hello everyone, im thinking how to make car engine sound on button click... my idea is when i click the button to be the same as you click on the gas pedal the engine starts to make sound (i know its not possible that with keyboard key) BUT i think its possible to make a timer for that or something like that, so when you press it the sound starts and when you release it the sound goes down slowly (i think you get me what i mean :D). and also for gear shift changing while you holding gas pedal button you can change gears and all sounds to be nicely played... i think this is great idea for experimenting and learning.. also is this possible to make it for website with php or javascript ?

Stefce 146 Posting Pro

Does this can happen if my website psycho is wrong ?

Stefce 146 Posting Pro

Fatal error: [] operator not supported for strings in C:\xampp\htdocs\bootstrap\functions.php on line 219 ($sender_tickets[] = $ticket_id;)

BTW again doesnt find the other users

Stefce 146 Posting Pro

Im making search button and i want when user is searched to give all tickets received by that user i have this code but its just showing the last record of that db table and if i try to search other users gives me No ticket received from that user. but this is false, i have tickets from that user.

functions.php

function show_tickets($sender_tickets="") {
        global $conn;
        $user = getUserData('users', 'UserUsername');
        $sql = "SELECT senderName, receiverName, `Date`, ticketID, match1, match2, match3, match4, match5, match6, match7, match8, match9, match10, match11, match12, match13, match14, match15, match16, tip1, tip2, tip3, tip4, tip5, tip6, tip7, tip8, tip9, tip10, tip11, tip12, tip13, tip14, tip15, tip16, Bet, Gain, Odd, seen FROM ticket WHERE receiverName='".$user."'";
        $result = $conn->query($sql);

        if(!$result) {
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
        } else {
            if($result->num_rows == 0) {
                echo "You have not received any ticket";
            } else if($result->num_rows >= 1) {
                while($row = $result->fetch_assoc()) {
                    $ticket_id = $row['ticketID'];

                    $sender_tickets = array($ticket_id);

                }
                foreach($sender_tickets as $key => $value) {
                    echo "&nbsp" . $value . "&nbsp";
                    return $sender_tickets;
                }
            }
        }
    }

messages.php Search Button

if(isset($_POST['searchBtn'])){
            $search_btn = $_POST['searchBtn'];
            $user = getUserData('users', 'UserUsername');

            $sql = "SELECT senderName FROM ticket WHERE receiverName='{$user}'";
            $result = $conn->query($sql);

            if(!$result) {
                trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
            } else {
                if($result->num_rows == 0) {
                    echo "You have not received any ticket";
                } else if($result->num_rows >= 1) {
                    while($row = $result->fetch_assoc()) {
                        $senderName = $row['senderName'];

                    }

                    if(strtolower($search_btn) == …
Stefce 146 Posting Pro

I'm really confuzed about this problem i have the same code on all files and is working fine but just it does problem on home.php. The problem is that the dropdown menu doesn't showing here is the code please take a look and tell me what wrong am doing ?

navigation.php

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="sidebar.css">

    <script type="text/javascript">
        function htmlbodyHeightUpdate() {
            var height3 = $( window ).height()
            var height1 = $('.nav').height()+50
            height2 = $('.main').height()
            if(height2 > height3){
                $('html').height(Math.max(height1,height3,height2)+10);
                $('body').height(Math.max(height1,height3,height2)+10);
            }
            else
            {
                $('html').height(Math.max(height1,height3,height2));
                $('body').height(Math.max(height1,height3,height2));
            }

        }

        $(document).ready(function () {
            htmlbodyHeightUpdate()
            $( window ).resize(function() {
                htmlbodyHeightUpdate()
            });
            $( window ).scroll(function() {
                height2 = $('.main').height()
                htmlbodyHeightUpdate()
            });
        });

        function myFunction() {
            document.getElementById("matcheslist").innerHTML = "<input class='form-control' id='m1' type='text' placeholder='MATCH'>".length + 1;
        }
    </script>
</head>
<!-- NAVIGATION -->
<nav class="navbar navbar-inverse sidebar" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-sidebar-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#" style="font-size: 20px;">Upstrey</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-sidebar-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="home.php">HOME<span style="font-size:18px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-home"></span></a></li>
                <li ><a href="news.php">NEWS (coming soon)<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-list-alt"></span></a></li>
                <li ><a href="#">TENNIS<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-envelope"></span></a></li>
                <li><a href="#">BASKETBALL<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-home"></span></a></li>
                <li ><a href="#">HOCKEY<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-user"></span></a></li>
                <li ><a href="#">BASEBALL<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-envelope"></span></a></li>
                <li ><a href="#">AM. FOOTBALL<span style="font-size:16px;" class="pull-right hidden-xs showopacity glyphicon glyphicon-envelope"></span></a></li>
                <li …
Stefce 146 Posting Pro

Hello im building messages page, i want to make it when the sender of the ticket is pressed to show the ticket from that sender so i have two files messages.php and m.php in messages.php are the the buttons for the senders and in m.php are the tables for the tickets. I tried with getting the ticketID from messages.php and is working but on reload the ticket doesn't show because of the reload, any help of how to do this ?

Stefce 146 Posting Pro

Thank you very much :)

here is the final result

function check_messages() {
        global $conn;
        $user = getUserData('users', 'UserUsername');
        $sql = "SELECT seen FROM ticket WHERE receiverName='{$user}'";
        $result = $conn->query($sql);

        $count = 0;

        if(!$result){
            echo "Problem!";
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
        } else {
            if($result->num_rows > 0) {
                //(int)$count++;
                //$num_length = strlen((int)$count);
                while($row = $result->fetch_assoc()){
                    $seen = $row["seen"];

                    if($seen == '0'){
                        $count++;
                    }
                }
                echo $count;
            }
        }
        //$conn->close();
    }
Stefce 146 Posting Pro

oh okay but how should i output the number 3 itself.

Stefce 146 Posting Pro

Hello i want to make notification when new message is received, i have a row seen with values 0 and 1 if is 0 then its unread else is seen i got this code but when it displays the output shows the number of rows but for example i have 3 uread messages it displays 111 and not just 3 i tried with strlen to get the value but i cant please any help ?

function check_messages() {
        global $conn;
        $user = getUserData('users', 'UserUsername');
        $sql = "SELECT seen FROM ticket WHERE receiverName='{$user}'";
        $result = $conn->query($sql);

        $count = 0;

        if(!$result){
            echo "Problem!";
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
        } else {
            if($result->num_rows > 0) {
                $count++;
                $num_length = strlen((int)$count);
                while($row = $result->fetch_assoc()){
                    $seen = $row["seen"];

                    if($seen == '0'){
                        echo $num_length;
                    }
                }
            }
        }
        $conn->close();
    }
Stefce 146 Posting Pro

but actualy none of them works, i tried with queryUI too but again no results

Stefce 146 Posting Pro

I must ask this, but someone ?

Stefce 146 Posting Pro

BTW i created new file and pasted the same code from the website and again doesn't work...

asd.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example of Twitter Typeahead</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script  type="text/javascript" src="js/typeahead.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('input.typeahead').typeahead({
        name: 'accounts',
        local: ['Audi', 'BMW', 'Bugatti', 'Ferrari', 'Ford', 'Lamborghini', 'Mercedes Benz', 'Porsche', 'Rolls-Royce', 'Volkswagen']
    });
});  
</script>
<style type="text/css">
.bs-example{
    font-family: sans-serif;
    position: relative;
    margin: 100px;
}
.typeahead, .tt-query, .tt-hint {
    border: 2px solid #CCCCCC;
    border-radius: 8px;
    font-size: 24px;
    height: 30px;
    line-height: 30px;
    outline: medium none;
    padding: 8px 12px;
    width: 396px;
}
.typeahead {
    background-color: #FFFFFF;
}
.typeahead:focus {
    border: 2px solid #0097CF;
}
.tt-query {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
}
.tt-hint {
    color: #999999;
}
.tt-dropdown-menu {
    background-color: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    margin-top: 12px;
    padding: 8px 0;
    width: 422px;
}
.tt-suggestion {
    font-size: 24px;
    line-height: 24px;
    padding: 3px 20px;
}
.tt-suggestion.tt-is-under-cursor {
    background-color: #0097CF;
    color: #FFFFFF;
}
.tt-suggestion p {
    margin: 0;
}
</style>
</head>
<body>
    <div class="bs-example">
        <h2>Type your favorite car name</h2>
        <input type="text" class="typeahead tt-query" autocomplete="off" spellcheck="false">
    </div>
</body>
</html>                                      
Stefce 146 Posting Pro

Yes its included

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script  type="text/javascript" src="../js/typeahead.min.js"></script>

The path to files is C:\xampp\htdocs\bootstrap\js\typeahead.min.js

Stefce 146 Posting Pro

Anyone ?

Stefce 146 Posting Pro

Hello guys i want to make inputbox which will autocomplete the started word so you know what i mean like google, facebook who have autocomplete but i have a little problem i have searched and found some plugins and tutorials but actually none of them work i dont know why, maybe its because my old code i would like someone take a look at my code and tell me if is there some bad code which stops the autocomplete.

<script type="text/javascript">
        $(document).ready(function(){
            $('input.typeahead').typeahead({
                name: 'accounts',
                local: ['Audi', 'BMW', 'Bugatti', 'Ferrari', 'Ford', 'Lamborghini', 'Mercedes Benz', 'Porsche', 'Rolls-Royce', 'Volkswagen']
            });
        });  
    </script>
    <style type="text/css">
        .bs-example{
            font-family: sans-serif;
            position: relative;
            margin: 100px;
        }
        .typeahead, .tt-query, .tt-hint {
            border: 2px solid #CCCCCC;
            border-radius: 8px;
            font-size: 24px;
            height: 30px;
            line-height: 30px;
            outline: medium none;
            padding: 8px 12px;
            width: 396px;
        }
        .typeahead {
            background-color: #FFFFFF;
        }
        .typeahead:focus {
            border: 2px solid #0097CF;
        }
        .tt-query {
            box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
        }
        .tt-hint {
            color: #999999;
        }
        .tt-dropdown-menu {
            background-color: #FFFFFF;
            border: 1px solid rgba(0, 0, 0, 0.2);
            border-radius: 8px;
            box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
            margin-top: 12px;
            padding: 8px 0;
            width: 422px;
        }
        .tt-suggestion {
            font-size: 24px;
            line-height: 24px;
            padding: 3px 20px;
        }
        .tt-suggestion.tt-is-under-cursor {
            background-color: #0097CF;
            color: #FFFFFF;
        }
        .tt-suggestion p {
            margin: 0;
        }
    </style>





<!-- ADD TICKET BOX -->
    <div class="modal fade" id="addTicket">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Add Ticket</h4>
                </div>
                <div class="modal-body">
                    <div class="container-fluid">
                        <div class="form-group">
                            <div class="col-xs-3">
                                <p><input …
Stefce 146 Posting Pro

Hello i want to make like button so i need to INSERT, SELECT and check does already exists the record i have this code:
likes.php

<?php
    require 'connect.php';
    require 'core.php';
    require_once 'functions.php';

    $user = getUserData('users', 'UserUsername');

    if(isset($_GET['type'], $_GET['id'])){


        $type   = $_GET['type'];
        $id     = (int)$_GET['id'];

        switch($type) {
            case 'ticket':
                $sql = "
                INSERT INTO likes (Username, ticketID)
                SELECT {$user}, {$id} 
                FROM kladilnica 
                WHERE EXISTS (
                    SELECT ID
                    FROM kladilnica 
                    WHERE ticket_id = {$id} 
                    OR Username = {$user}) 
                AND NOT EXISTS (
                    SELECT ID 
                    FROM likes 
                    WHERE Username = {$user} 
                    AND ticketID = {$id}) 
                LIMIT 1
                ";
                $result = $conn->query($sql);
                if(!$result) {
                    echo "can't connect!";
                    trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
                } else {
                    echo "connected";
                }
            break;
        }
    }

    header('Location: shared.php');
?>

but its gives me error

Fatal error: Wrong SQL: INSERT INTO likes (Username, ticketID) SELECT StefanRafa, 156677 FROM kladilnica WHERE EXISTS ( SELECT ID FROM kladilnica WHERE ticket_id = 156677 OR Username = StefanRafa) AND NOT EXISTS ( SELECT ID FROM likes WHERE Username = StefanRafa AND ticketID = 156677) LIMIT 1 Error: Unknown column 'StefanRafa' in 'field list' in C:\xampp\htdocs\bootstrap\likes.php on line 35
What is the problem here i dont understand ?

Stefce 146 Posting Pro

I found a solution

<?php
function remove_day($date) {
        return substr($date, 0, strrpos($date, "-"));
    }
$user = getUserData('users', 'UserUsername');
                    $sql = "SELECT `ticket_id`, `Uplata`, `Dobivka`, `Date` FROM `kladilnica` WHERE `Username`='$user'";
                    $result = $conn->query($sql);
                    $count = 0;
                    $uplata_total = 0;

                    if($result === false) {
                        echo "<b>Could not connect to database.</b>";
                        trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
                    } else {
                        if($result->num_rows == 0) {
                            echo "<b>You do not have any tickets.</b>";
                        } else if($result->num_rows >= 1) {
                            $date = date('F Y');
                            $months = [];
                            while($row = $result->fetch_assoc()) {
                                $months[remove_day($row["Date"])][] = $row;
                            }
                            //var_dump($months);

                            foreach($months as $month => $rows) {
                                $count = 0;
                            ?>
                    <div class="col-md-5 col-md-pull">
                        <div class="panel panel-default" id="wrapper">
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th colspan='5'><center><?= $month ?></center></th>
                                    </tr>
                                    <tr style="background-color: lavender;">
                                        <th>
                                            <td><b>Ticket ID</b></td>
                                            <td><b>Bet</b></td>
                                            <td><b>Gain</b></td>
                                            <td><b>Date</b></td>
                                        </th>
                                    </tr>
                                </thead>
                            <?php
                            foreach($rows as $row) {
                                $count++;
                                $ticket_date = htmlentities($row["Date"]);
                                $ticket_id = htmlentities($row["ticket_id"]);
                                $uplata = htmlentities($row["Uplata"]);
                                $dobivka = htmlentities($row["Dobivka"]);

                                $uplata_total = $uplata_total + $row["Uplata"];

                                ?>
                                <tbody>
                                    <tr>
                                        <td><?= $count ?></td>
                                        <td><?= $ticket_id ?></td>
                                        <td><?= $uplata ?></td>
                                        <td><?= $dobivka ?></td>
                                        <td><?= $ticket_date ?></td>
                                    </tr>
                                <?php
                            }
                            ?>
                                    <tr style="background-color: lightgreen;">
                                        <th colspan='4'>Total Bet: <?= $uplata_total ?></th>
                                        <th colspan='4'>Total Win: <?= $dobivka ?></th>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                                <?php
                            }
                        }
                    }
                    $conn->close();
                ?>
Stefce 146 Posting Pro

But Date is when the ticket is created not the table, do i need to create new value in the database to check the table_date or create a new db table for ex. history and insert there the all values something like this:

$sql = "SELECT `ticket_id`, `Uplata`, `Dobivka`, `Date` FROM `kladilnica` WHERE `Username`='".$user."' 
                    INSERT INTO `history` VALUES ('".$user."', ticket_ID, Uplata, Dobivka, `Date`, table_date_create)";
Stefce 146 Posting Pro

No, i guess i need one method just when month will start 02.01.2016 for example automaticly to create new table and insert there the new items and calculate them like in the example above.

Stefce 146 Posting Pro

SOLVED: in the sql need OR not AND :D

Stefce 146 Posting Pro

How can i check if username and email exists i have this code but its only checking the email not the username...

$sql = "SELECT `Email`, `UserUsername` FROM `users` WHERE `UserUsername`='".$user."' AND `Email`='".$email."'";
$result = $conn->query($sql);

if($result->num_rows >= 1) {
    echo "Email or Username already exist, try something else.";
} else {
 // ....
}
Stefce 146 Posting Pro

Someone who can help ?

Stefce 146 Posting Pro

How can i get the end of the month or the beggining of the month to create a new table for records ? i have this code but it gets the current month...

<?php
$user = getUserData('users', 'UserUsername');
$sql = "SELECT `ticket_id`, `Uplata`, `Dobivka`, `Date` FROM `kladilnica` WHERE `Username`='$user'";
$result = $conn->query($sql);
$count = 0;
$uplata_total = 0;

if($result === false) {
    echo "<b>Could not connect to database.</b>";
    trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
} else {
    if($result->num_rows == 0) {
        echo "<b>You do not have any tickets.</b>";
    } else if($result->num_rows >= 1) {
        $date = date('F Y');
        ?>
<div class="col-md-5 col-md-pull">
    <div class="panel panel-default" id="wrapper">
        <table class="table table-hover">
            <thead>
                <tr>
                    <th colspan='5'><center><?= $date ?></center></th>
                </tr>
                <tr style="background-color: lavender;">
                    <th>
                        <td><b>Ticket ID</b></td>
                        <td><b>Bet</b></td>
                        <td><b>Gain</b></td>
                        <td><b>Date</b></td>
                    </th>
                </tr>
            </thead>
        <?php
        while($row = $result->fetch_assoc()) {
            $count++;
            $ticket_date = htmlentities($row["Date"]);
            $ticket_id = htmlentities($row["ticket_id"]);
            $uplata = htmlentities($row["Uplata"]);
            $dobivka = htmlentities($row["Dobivka"]);

            $uplata_total = $uplata_total + $row["Uplata"];

            ?>
            <tbody>
                <tr>
                    <td><?= $count ?></td>
                    <td><?= $ticket_id ?></td>
                    <td><?= $uplata ?></td>
                    <td><?= $dobivka ?></td>
                    <td><?= $ticket_date ?></td>
                </tr>
            <?php
        }
        ?>
                <tr style="background-color: lightgreen;">
                    <th colspan='4'>Total Bet: <?= $uplata_total ?></th>
                    <th colspan='4'>Total Win: <?= $dobivka ?></th>
                </tr>
            </tbody>
        </table>
    </div>
</div>
            <?php
    }
}
$conn->close();
?>
Stefce 146 Posting Pro

Oh man I can believe :-) but thank you very much :-)

Stefce 146 Posting Pro

Why i get these errors when i open the page but when i try to upload it works fine ?

<?php
    function upload_images() {
        $target_dir = "uploads/";
        $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
        $uploadOk = 1;
        $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
        // Check if image file is a actual image or fake image
        if(isset($_POST["submit"])) {
            $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
            if($check !== false) {
                echo "File is an image - " . $check["mime"] . ".";
                $uploadOk = 1;
            } else {
                echo "File is not an image.";
                $uploadOk = 0;
            }
        }
        // Check if file already exists
        if (file_exists($target_file)) {
            echo "Sorry, file already exists.";
            $uploadOk = 0;
        }
        // Check file size
        if ($_FILES["fileToUpload"]["size"] > 500000) {
            echo "Sorry, your file is too large.";
            $uploadOk = 0;
        }
        // Allow certain file formats
        if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
            && $imageFileType != "gif" && $imageFileType != "mp4" && $imageFileType != "wmv" 
            && $imageFileType != "mp3") {
            echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
            $uploadOk = 0;
        }
        // Check if $uploadOk is set to 0 by an error
        if ($uploadOk == 0) {
            echo "Sorry, your file was not uploaded.";
            // if everything is ok, try to upload file
        } else {
            if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
                echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
            } else {
                echo "Sorry, there was an error uploading your file.";
            }
        }
    }
?>

Notice: Undefined index: fileToUpload in C:xampphtdocsUpstreyincludesfunctions.php on line 5 Sorry, file …

Stefce 146 Posting Pro

If your action is bad, your parent gives you a punishment. If your action is good, your parent gives you a reward.

Thats because we are humans we have a perspective what is good and what is bad for us, how the computer will know what is punishment for him and how much it will care about it, for example the robot doesn't have feelings you can't hurt him but you can punish human no matter how physical or mental (mental i mean for example you can't go outside..) maybe this sound stupid but its really exciting to talk about :D

Stefce 146 Posting Pro

Hello everybody im thinking about how AI works and actualy im really confuzed and scared at the same time, so me as low programmer i know how the computers work, first you write the program than you give him input and it gives you output based on what you insert in it. But how the AI works is really complex and hard to understand.. im asking my self like: how they started, what programming language they are using, how the hell the computer will know when and on what to focus when learning it self on something new for him and for humans too, its just really messed me up. Can anyone explain me if have some knowledge about this CRAZY stuff.

Stefce 146 Posting Pro

How can i change the colors of the panels with css every panel to have different color on hover, i have this code:

<div class="container">
            <div class="row">
                <div class="col-sm-4">
                <a href="#">
                    <div class="panel panel-default trending">
                        <div class="panel-body">
                            <center>
                                <img src="images/trending.png" alt="Trending">
                                <h2>Trending</h2>
                            </center>
                        </div>
                    </div>
                </a>
                </div>
                <div class="col-sm-4">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <img src="images/popular.png" alt="Popular">
                            <h2>Popular</h2>
                        </div>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <img src="images/new.png" alt="New">
                            <h2>New</h2>
                        </div>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <img src="images/home.png" alt="Home">
                            <h2>Home</h2>
                        </div>
                    </div>
                </div>
            </div>
        </div>

CSS

body { 
    padding-bottom: 70px;
    padding-top: 10px;
}
.panel {
    height: 300px;
}
.panel:hover {
    background-color: lightblue;
}
Stefce 146 Posting Pro

Also i forgot to ask does the admin wall password is better to be stored in database or variable in the script it self and how sure i will be that the password wont get cracked?

Stefce 146 Posting Pro

Hello guys i want to ask how can i update my website, i want to make website for random posts updates but im confuzed in creating it. My question is how can i add new posts, do i need to create html files everytime i write new post and update it to the server or is there other way to do it with PHP for example to make "admin panel site" www.mywebsite.com/admin (with password protection) and from there to do the rest. Or maybe there is other way of doing this ? If you didnt get me ask below i will try to explain again i have abad english.

Stefce 146 Posting Pro

Exactly what i need just with width: 100% :D

Stefce 146 Posting Pro

Here is an example, just add word global

$var = "Mercedes";
function checkcar() {
     global $var;

     if("Condition") {
        $var = "BMW";
     }
}
Stefce 146 Posting Pro

How can i stick the footer at the bottom of thumbnail i cannot find anything on google here is the code
HTML

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title"><b>Related Links</b></h3>
    </div>
    <div class="panel-body">
        <ul class="equal-height-thumbnail">
            <li>
                <figure><img src="http://www.htmllion.com/img/thumb.jpg" alt="Equal height of thumbnail"></figure>
                <div class="caption">
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget enim et augue mattis tempor nec eget felis. </p>
                </div>
                <div class="panel-footer">
                    <p><a href="#" class="btn btn-primary btn-block" role="button">Read</a></p>
                    <p><span class="glyphicon glyphicon-time"> 13:27</span></p>
                </div>
            </li>
            <li>
                <figure><img src="http://www.htmllion.com/img/thumb.jpg" alt="Equal height of thumbnail"></figure>
                <div class="caption">
                    <p>Lorem ipsum dolor sit amet, consectetur adi amet, consectetur adi amet, consectetur adi amet, consectetur adi amet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesque eget enim et augue mattis tempor nec eget felis. </p>
                </div>
                <div class="panel-footer">
                    <p><a href="#" class="btn btn-primary btn-block" role="button">Read</a></p>
                    <p><span class="glyphicon glyphicon-time"> 13:27</span></p>
                </div>
            </li>
            <li>
                <figure><img src="http://www.htmllion.com/img/thumb.jpg" alt="Equal height of thumbnail"></figure>
                <div class="caption">
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesmet, consectetur adipiscing elit. Pellentesque eget enim et augue mattis tempor nec eget felis. </p>
                </div>
                <div class="panel-footer">
                    <p><a href="#" class="btn btn-primary btn-block" role="button">Read</a></p>
                    <p><span class="glyphicon glyphicon-time"> 13:27</span></p>
                </div>
            </li>
        </ul>
    </div>
</div>

CSS

.equal-height-thumbnail {


display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;

  -webkit-flex-wrap: wrap;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;


  margin: 0;
  padding: 0;
  list-style: none;
}

.equal-height-thumbnail li {
  width: 30%;
  margin: 0 1% 20px;
  padding:0 0.5%;
  background: #FFF;
  box-shadow: 0 0 1px …
Stefce 146 Posting Pro

How can i do that im really new in CSS can you help me ?

Stefce 146 Posting Pro

anyone ?

Stefce 146 Posting Pro

Did you tried in NEWS ?

Stefce 146 Posting Pro

look at the menu its sticking to the bottom when the page is at the end and when you login, the menu in the homepage is not working properly also in the NEWS too but i use the same code.

This is the code for the sidebar and im just using request("navigation.php"); to show the navigation

    body,html{
        height: 100%;
    }

    /* remove outer padding */
    .main .row{
        padding: 0px;
        margin: 0px;
    }

    /*Remove rounded coners*/

    nav.sidebar.navbar {
        border-radius: 0px;
    }

    nav.sidebar, .main{
        -webkit-transition: margin 200ms ease-out;
        -moz-transition: margin 200ms ease-out;
        -o-transition: margin 200ms ease-out;
        transition: margin 200ms ease-out;
    }

    /* Add gap to nav and right windows.*/
    .main{
        padding: 10px 10px 0 10px;
    }

    /* .....NavBar: Icon only with coloring/layout.....*/

    /*small/medium side display*/
    @media (min-width: 768px) {

        /*Allow main to be next to Nav*/
        .main{
            position: absolute;
            width: calc(100% - 40px); /*keeps 100% minus nav size*/
            margin-left: 40px;
            float: right;
        }

        /*lets nav bar to be showed on mouseover*/
        nav.sidebar:target + .main{
            margin-left: 220px;
        }

        /*Center Brand*/
        nav.sidebar.navbar.sidebar>.container .navbar-brand, .navbar>.container-fluid .navbar-brand {
            margin-left: 0px;
        }
        /*Center Brand*/
        nav.sidebar .navbar-brand, nav.sidebar .navbar-header{
            text-align: center;
            width: 100%;
            margin-left: 0px;
        }

        /*Center Icons*/
        nav.sidebar a{
            padding-right: 13px;
        }

        /*adds border top to first nav box */
        nav.sidebar .navbar-nav > li:first-child{
            border-top: 1px #e5e5e5 solid;
        }

        /*adds border to bottom nav boxes*/
        nav.sidebar .navbar-nav > li{
            border-bottom: 1px #e5e5e5 solid;
        }

        /* Colors/style dropdown box*/
        nav.sidebar .navbar-nav .open .dropdown-menu {
            position: static;
            float: none;
            width: auto;
            margin-top: 0;
            background-color: transparent;
            border: 0;
            -webkit-box-shadow: …
Stefce 146 Posting Pro

Hello im using bootstrap and want to make the menu to be sticky i have uploaded the code so you can see it www.upster.webuda.com i want to be like in the login screen at the begining im using the same code for other files but it doesn't work properly someone know how to fix this ?

Login with these details:
Email: asd@gmail.com
Pass: asd

Stefce 146 Posting Pro

Problem is solved i removed the data-dismiss="modal" idk why that happened.

Stefce 146 Posting Pro

Yes i have online test site: Click Here login with these details:
Email: asd@gmail.com
Pass: asd
CLICK NEWS go down to "MORE" and find "Change Password" i dont know why the menu does not work on home page but its the same code...