Stefce 146 Posting Pro

Write unique text and have helpfull information on your site for users.. if you do this two steps right, results will come faster than you expect you may rank 1st - 3rd at google in 1 week

Stefce 146 Posting Pro

Sorry my mistake the variable $imageID is not taken from database its $_GET Method from URL in another function:

function img($path) {
    $folder = "images/$path";
    $i = 0;
    if (is_dir($folder)) {
        if ($handle = opendir($folder)) {
            while (($file = readdir($handle)) != FALSE) {
                if ($file === "." || $file === ".." || $file === "index.html") { continue; }

                ?>
                    <div class="col-md-4 img-portfolio">
                        <a href="pictures.php?imageID=<?= base64_encode($file); ?>">
                            <img class="img-responsive img-hover" src="<?= $folder ?>/<?= $file ?>" style="width: 350px;
                            height: 350px;" alt="">
                        </a>
                    </div>
                <?php

            }
            closedir($handle);
        }
    }
}

and than passed in pictures.php file as
<?php $imageID = $_GET["imageID"]; ?>

Stefce 146 Posting Pro

How do i get the name of the image without the extension at the end ex. (.jpg) i got this code

functions.php

function get_image($id="1") {
?>
    <img class="img-responsive img-portfolio img-hover" name="picture" src="images/gallery/<?= urldecode(base64_decode($id)); ?>" alt="">
<?php
}

pictures.php

<center>
    <form action="" method="POST">
        <div class="col-lg-12">
            <?php
                get_image($imageID); // $imageID is read from database
            ?>
        </div>
    </form>
</center>
Stefce 146 Posting Pro

When user opens my app i want to take his location and sort them in a list by time they joined the game and display them on maps.

Stefce 146 Posting Pro

How do i get every user that installs my app but without asking the user to register anywhere also sorting by every time it joins (opens) the app. Any help will be appreciated.

Stefce 146 Posting Pro

Okay so i have created my design and i would like to be printed 10 shirts of my design BUT its funny they want to charge me $24.99 per t-shirt so thats freaking $250 for 10 t-shirts!!! okay, i found a code for discount and the final price is $213.60. So how in the world someone will by a simple t-shirt which will be definitely more than $25?

Stefce 146 Posting Pro

@Dani what this site is about can you please tell me more? Actually maybe this exactly what i want. So am just making a design and they sell it? how much will be my profit is it possible to know ?

Stefce 146 Posting Pro

Okay thanks for the info but how do i transport the product to my customer ? so for example 20 customers buy my product how do i send it to them i dont get it or should i bring somewhere my products?

Stefce 146 Posting Pro

Hello am very new to selling online. I come up with an idea to sell something online like t-shirt or socks :P or whatever.
I googled "how to sell online" and company called shopify popped, i reviewed it and i think its pretty cool tool for e-commenrce business. Please is here someone who can explain me how can i sell my products online and is this shopify a good choice. Thank you very much :)

Stefce 146 Posting Pro

Here i found a link that explains the encryption breakdown. https://www.tunnelbear.com/blog/stronger-encryption/

I run my own VPN

  • What language is written in?
  • How much are you sure its safe for you?
  • Is it available for public use? (i want to test it)
Stefce 146 Posting Pro

Hey actually you gave me info on how to choose a VPN better, i didnt though that with the credit cards (good one). Am using free TunnelBear account since they dont have LOGS and they are fast enought for me too :)

EDIT and because its free you get only 500MB data each month, also you can tweet about the service and you get +1GB free so thats 1500MB per month.
Also i have a question how do you make that two hops (or more) and what VPN service are you using ?

Stefce 146 Posting Pro

Thank you cereal but why the second SQL INSERT doesnt work ? That should insert into database also but can't ? o_0

Stefce 146 Posting Pro

Here is the full script

if(isset($_POST['bet']) && isset($_POST['gain']) && isset($_POST['odds']) && isset($_POST['date'])) {
    $bet = htmlentities($_POST['bet']);
    $gain = htmlentities($_POST['gain']);
    $odds = htmlentities($_POST['odds']);
    $date = htmlentities($_POST['date']);

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

    $randomTicketID = mt_rand(000000000,999999999);
    $sql = "INSERT INTO kladilnica (Username, Bet, Win, reg_date, Odds, isActive, ticket_id, isShared, is_winned, Location) VALUES ('".$user."', ".$bet.", ".$gain.", '".$date."', ".$odds.", 1, $randomTicketID, 0, 0, '".$userLocation."')";
    $result = $conn->query($sql);
    $TicketID = $conn->insert_id;
    trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);

    $matches1 = $_POST['match1'];
    $matches2 = $_POST['match2'];
    $tips = $_POST['tip'];
    $countMatches = count($matches1);

    for($i=0; $i < $countMatches; $i++) {
        $match1 = mysqli_real_escape_string($conn, $matches1[$i]);
        $match2 = mysqli_real_escape_string($conn, $matches2[$i]);
        $tip    = $conn->real_escape_string($tips[$i]);

        if ($match1 != "" && $match2 != "" && $tip != "") {
            $match1 = $match1;
            $match2 = $match2;

            $sql2 = "INSERT INTO matches (MatchTitle, Tip, TicketID) VALUES ('".$match1." - ".$match2."', '".$tip."', ".$TicketID.")";
            $result2 = $conn->query($sql2);
        }
    }
}
Stefce 146 Posting Pro

racquet --> rocket

Stefce 146 Posting Pro

Why am getting error when i think it should work fine

Error

Fatal error: Wrong SQL: INSERT INTO kladilnica (Username, Bet, Win, reg_date, Odds, isActive, ticket_id, isShared, is_winned, Location) VALUES ('Stefan', 100, 3500, '2017-02-06', 66, 1, 351358728, 0, 0, '') Error: in C:\xampp\htdocs\bootstrap\navigation.php on line 257

Code

$sql = "INSERT INTO kladilnica (Username, Bet, Win, reg_date, Odds, isActive, ticket_id, isShared, is_winned, Location) VALUES ('".$user."', ".$bet.", ".$gain.", '".$date."', ".$odds.", 1, $randomTicketID, 0, 0, '".$userLocation."')";
$result = $conn->query($sql);
$TicketID = $conn->insert_id;
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
Stefce 146 Posting Pro

I've also been getting a lot of sex spam. I wonder if someone got my email address off a database somewhere ^_^

Hey here you can check it out i have been leaked 3 times O_O
https://hacked-emails.com/

EDIT: also this one too https://haveibeenpwned.com/

cereal commented: yeah, I know about those services ;) +14
Stefce 146 Posting Pro

white --> rabbit

Stefce 146 Posting Pro

Ops here we go with something just poped up in my head :D
Since google "hates" forums but loves grammar why not make a grammar corrector in the ask question input field? Something like Grammarly but private that will belong to daniweb. Also i have a question why the input field in the question doesn't autocorrect the word?

Stefce 146 Posting Pro

Thumbs Up for the new search! I would like to suggest a faster email system. Faster i get the email faster i open the site. Few days ago when i asked the question Open mobile camera through web browser i got an email that i got reply to my question after 6 days. This has not happened before, usualy it takes about 4 - 6 hours. So far this is my first suggestion, i would like to come up with something great and i think i will...

Stefce 146 Posting Pro

Me -> Stefan, nice to meet you :P

Stefce 146 Posting Pro

daniweb -> Dani :)

Stefce 146 Posting Pro

Is it good idea/possible to encrypt everything in your database (Emails, User Input, Passwords :), everything.. )?
Is there something which will shut down the current PHP script OR website entirely ?

EDIT: This is not sponsored queston i have not donated any money, why is Sponsored badge at my question ?

Stefce 146 Posting Pro

Hello everyone i heard about this new but not new technology, which pays you to rent your free HDD space for cloud purposes. I like to ask is there anyone which can give me some more info about this? Am planing to invest about $150 - $200 for Raspberry Pi 3 and 2HDD's with 2TB and let them run. I have readed this article which gives you a education how much will cost/earn you <link removed>. And here is the website which offer this <link removed>
What do you think, does this investment is good or money waste ?

Stefce 146 Posting Pro

@JamesCherrill thank you actualy i have a few more, also for daniweb community :D

@rproffitt This code is great and works when i visit the link on my phone too, but i copy and paste it on my server and doesn't work?

Stefce 146 Posting Pro

Can this be made into plugin or something to be used globaly? Because i think it will be game changer on user registrating and it will reduce fake user registration on websites. Even for better security you will ask the user to blink twice to make sure its real human :P

JamesCherrill commented: That's a good idea +15
Stefce 146 Posting Pro

Are they making authorising system ? Because i though to make the same damn thing.. :P
So for example user want to register on my site, he fill up the form and pressing the register button, the phone camera opens automaticly and im asking to take a selfie to make sure its she/he..

Stefce 146 Posting Pro

Hello, is there any way of accessing mobile camera through my website? I want to open mobile camera through my website and take a picture and upload to server. Something similar to viber, when you install the app in your desktop they ask you to scan the QR code to access it, and imediately the camera opens on your phone. Any help will be appreciated.

Stefce 146 Posting Pro

Oh my god... why the server doesn't recognise capital letters ??? the header file actually was named Header and the server was not able to read ?? Hell i waste whole day :-(

rproffitt commented: Thanks for sharing what it was. +11
Stefce 146 Posting Pro

Okay so any other solutions ?
Does this can be caused by robots.txt or .htaccess file?

Stefce 146 Posting Pro

Also on my localhost the website is working fine.

Stefce 146 Posting Pro

I really check every single file in the server and everything is as supossed to be (everything in place). What other helpful info should i give to you to help me a little more ?

Stefce 146 Posting Pro

what do you prefer to remove this issue ?

Stefce 146 Posting Pro

Its not hardcoded, how its displaying without the www. also i have the images in th server uploaded

Stefce 146 Posting Pro

Hello i got a wierd problem, when am opening my website on a PC the site loads well and its best of all websites (:D).. but when i try to open it on phone or tablet the front page of the website which is meant to show the featured pictures doesn't display.. i really have no IDEA from where this error comes from, any help will be apreciated so much !

Also this problem is showing when i visit it with www. on PC

The site is Stunneroftheday

Stefce 146 Posting Pro

Hello i want to make SEO friendly links but i dont know how can you please help me doing that? I have this code:

<?php
    $sql = array('ID', 'post_title', 'post_content', 'post_header_image', 'post_category', 'post_date');
    $outputSQL = selectSQL($sql, 'news');
    $count = count($outputSQL);
        for ($i=0; $i < $count; $i++) { /* Loop Throught All Posts */
            if ($i < 5) { /* Choose How Much Posts To Show */
        ?>
            <a href="blog/post.php?post_id=<?php echo $outputSQL[$i]['post_title']; ?>"> /* The URL Link To 'post.php' page */
                <h2 class="post-title" style="font-size: 30px; font-weight:bold;">
                    <?php echo $outputSQL[$i]['post_title']; ?> /* Post Title */
                </h2>
            </a>
            <h4 class="post-subtitle">
                <?php echo substr($outputSQL[$i]['post_content'], 0, 100); ?> /* Post Content */
            </h4>
            <p class="post-meta">Posted on <?php echo $outputSQL[$i]['post_date']; ?></p> /* Post Date */
            <hr>
        <?php
    }
}
?>

In this example the URL output is http://localhost/website_name/blog/post.php?post_id=Some%20Post%20Title.
I want to be like this http://localhost/website_name/blog/post/Some-Post-Title.

-Thank you :)

Stefce 146 Posting Pro

While im in these "hacker" days i have made my website vulnerable to sql injection and Cross Site Scripting, i want to know how a hacker can use theese vulnerables and hack my website, also how the hacker will know about these holes. BTW this question poped in my head while i was reading the PHPMailer hack

Stefce 146 Posting Pro

Hello im really curius about this, i want to know is it possible to intercept the code of execution in PHP but not on the server side. So if i have a script like this for example uploaded to mine server

<?php
    $i=0;
    while($i<100) {
       mail("xxxxxx@gmail.com", "SPAM", "It´s ME");
       $i++;
    }
    echo "DONE!";
?>

How can i intercept and stop it from its execution and also if possible change the code. But lets suppose i do not have access to the server. It is possilbe to do this ?

Oh and yea Happy New Year and wish you all the best in the new one DANIWEB

Stefce 146 Posting Pro

Thank you very much cereal !

Stefce 146 Posting Pro

How do i return an array with the file names from folder? I have this till now but doesn't work.

function showFiles($path) {
    $folder = "gallery/$path";
    $i = 0;
    if (is_dir($folder)) {
        if ($handle = opendir($folder)) {
            while (($file = readdir($handle)) != FALSE) {
                if ($file === "." || $file === ".." || $file === "index.html") { continue; }
                if (!in_array($file, array('.', '..')) && !is_dir($folder.$file))
                    $arrayName = array($file);
                    foreach ($arrayName as $fileArr) {
                    $files[] = $fileArr;
                    print_r($files);
                }
            }
            return $files;
            closedir($handle);
        }
    }
}

Any help will be appreciated :)

Stefce 146 Posting Pro

I have finnaly make it here is what i was searching.

function selectSQL(&$item, $table) {
    global $conn;

    $fields = implode(',', $item);

    $sql = "SELECT $fields FROM `$table`";
    $result = $conn->query($sql);

    if ($result === false) {
        trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $link->error, E_USER_ERROR);
    } else if ($result->num_rows > 0) {
        $fieldValue = array();
        while($row = $result->fetch_assoc()) {
            $itemsArray = array();
            foreach($item as $field) {
                $itemsArray[$field] = $row[$field];
            }
            $fieldValue[] = $itemsArray;
        }
        return $fieldValue;
    }
}

$selectFields = array("ID", "Username", "Email");
$output = selectSQL($selectFields, "upstrey");
$arrlength = count($output);
for ($i=0; $i < $arrlength; $i++) {
    echo "ID: " . $output[$i]["ID"] . "<br>";
    echo "Username: " . $output[$i]["Username"] . "<br>";
    echo "Email: " . $output[$i]["Email"] . "<br>";
}
Stefce 146 Posting Pro

Thank you guys, but i have another problem now i want to return array of the fields so i can use them, this code it gives me wierd results

function selectSQL(&$item, $table) {
    global $conn;
    foreach ($item as $field) {
        $sql = "SELECT `$field` FROM `$table`";
        $result = $conn->query($sql);

        if ($result === false) {
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
        } else if ($result->num_rows > 0) {
            $arrayName = array();
            while($row = $result->fetch_assoc()) {
                $arrayName[] = array($row["$field"]);
                echo var_dump($arrayName);
            }
        }
    }
}

Array ( [0] => Array ( [0] => Stefan ) ) 1 Array ( [0] => Array ( [0] => stefan@gmail.com ) ) 1

Stefce 146 Posting Pro

Actually it works changing to echo but im curious how would i do it with arrays ?

I was trying like this but as you said its breaking after first retrived value;

function selectSQL(&$item, $table) {
    global $conn;
    foreach ($item as $field) {
        $sql = "SELECT `$field` FROM `$table`";
        $result = $conn->query($sql);

        if ($result === false) {
            trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
        } else if ($result->num_rows > 0) {
            while($row = $result->fetch_assoc()) {
                $arrayName = array($row["$field"]);
            }
        }
    }
    return $arrayName;
}
Stefce 146 Posting Pro

Even if i put out of the loop i get only the first result

function selectSQL(&$item, $table) {
    global $conn;
    foreach ($item as $field) {
        $sql = "SELECT `$field` FROM `$table`";
        $result = $conn->query($sql);
    }
    if ($result === false) {
        trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
    } else if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            $var = $row["$field"];
        }
    }
    return $var;
}
Stefce 146 Posting Pro

Im really confuzed someone please help ?

Stefce 146 Posting Pro

Im trying to make a simple function to select from different tables and fields in Database

This code only retrives the first value which is Username=Stefan

Stefce 146 Posting Pro

That's correct

Stefce 146 Posting Pro

Why i cannot pass array to function parametter with two items? here is the function, but i get just the first parameter Username

function selectSQL(Array $item, $table) {
    global $conn;
    foreach ($item as $field) {
        $sql = "SELECT `$field` FROM `$table`";
        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            while($row = $result->fetch_assoc()) {
                return $row["$field"];
            }
        }
    }
}

calling it like this:

$selectFields = Array("Username", "Email");
echo selectSQL($selectFields, "upstrey");
Stefce 146 Posting Pro

Hello i started learning php laravel framework today and as far as i learned i can say its great framework. My problem is declaring the links to other files. Here is the route for file register.blade.php

web.php

Route::group(['prefix' => 'auth'], function() {
    Route::get('register', [
        'as' => 'get_register',
        'uses' => 'Auth\AuthController@getRegister'
    ]);
    Route::post('register', [
        'as' => 'post_register',
        'uses' => 'Auth\AuthController@postRegister'
    ]);
});

and im linking it like this in navigation.blade.php

<li><a href="{{ URL::route('get_register')}}">Register</a></li>

When i try to access this page i get an error saying
Sorry, the page you are looking for could not be found.
NotFoundHttpException in RouteCollection.php line 161:

The path is: http://localhost/testapp/public/auth/register

Im really confuzed i have created the register.blade.php file and it cannot display why is that ?

Stefce 146 Posting Pro

I want to make pagination for videos since i have much videos and i cannot load all in the same page, i have a function which displays all videos in the directory and than i limited it only to show first 6.

How do i make the pagination so when im on page 2 to show the next 6 videos ?
here is the full function

function video($path) {
    $folder = "videos/$path";
    $i = 0;
    if (is_dir($folder)) {
        if ($handle = opendir($folder)) {
            while (($file = readdir($handle)) != FALSE) {
                if ($file === "." || $file === ".." || $file === "index.html") { continue; }
                if (!in_array($file, array('.', '..')) && !is_dir($folder.$file))
                    $i++;
                    if($i <= 6) {
                        ?>
                        <div onclick=""style="-webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; ">
                        <a href="view_video.php?videoID=<?= base64_encode(base64_encode($file)); ?>">
                        <video width="500" no-controls preload="auto">
                        <source src="<?= $folder ?>/<?= $file ?>" type="video/mp4">
                        <source src="<?= $folder ?>/<?= $file ?>" type="video/ogg">
                        Your browser does not support HTML5 video.
                        </video>
                        </a>
                        </div>
                        <?php
                    }
                }
                closedir($handle);
        }
    }
}
Stefce 146 Posting Pro

You joined 16mins. ago, created this first post on the forum and you are requesting a whole program to be made by us ? i mean ....