Posts by ThomasNiven

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

very cool :)

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hi folks, I am wondering how you all create your loaders. Personally I have only created one so far using a gif I created in photoshop.

Comment on what you prefer to use.

Oh and this is interesting and I’m wondering how this is done. I would appreciate if someone could tell me. The link is below.

Awesome loader

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hello good people, I am looking for some help. I wish to move an image within a div tag slowly when I scroll down the page. I will be doing this with multiple images. It is a little hard to explain so I will give you an example.

Example here

As you can see the red clouds start off further below but when scrolling they move up. This is what I wish to accomplish. Can someone point me in the right direction?

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hi folks I am tying find out how exactly a scrolling effect such as the one from Boy-Coy, Found here. I would love to be able to accomplish something like this myself and was wondering if anyone knows how it is done and where I might be able to find help on this topic.

Is this a CSS feature, JS feautre or both? Where can I learn how to do this?

I should add that the website is using different layers scrolling at different speeds. Looks really cool.

Thanks in advance :)

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hi folks, I am hoping someone can help me out. I am trying to get a div tag to start of at 0% size and slowly get bigger to 100%. When the div reaches 100% in size I would like it to disappear unless they div is clicked on before it reaches 100%. If a div is clicked on then I would also like it to disappear.

Hope this makes sense. Thanks in advance for help.

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hi I am hoping someone can help with a problem I am having with my transitions. I am looking to go to a particular page when I click a link but at the moment I can only go back and forth from page 1 to page 2.

View a demo here

I am currently using ElementTransitions.js from dan-silver

I would like a navigation bar across the top of my page with various links. I dont want to create a one page site but all pages will be on the same page, I tried using id’s within my links – like so -> #page1 but it didnt work. can anyone help me out or give me a better solution.

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hi folks I have recently found an accordion I really like. I am trying to learn by trying to achieve the same outcome. Can someone point me in the right direction, or perhaps provide some snippets or block codes that will help me achieve the same outcome.

Website with accordion here…

Thanks in advance.

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

When I take out the code for inserting an image. it all works fine. While that code is in there, nothing works. Sometimes if I switch the code around only the payment details will insert but no image. NEED HELP, it’s annoying me lol

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Hi folks, I am looking for some help on a small project I am currently working on. The reason for this project is so that I can learn PHP. I am using PDO and i’m trying to insert images to a table while also inserting a business request into a separate table. The image does not insert into the DB an I think my logic is a little wrong as I am first checking to see if the fields are empty, then I check if the card number is < = 15 or >= 17, as a bank card number is 16 long. The next part I check is if the expiry date is <= 4 or >= 6, after this I check to see if the CVV (Security code) is <= 2 or >= 4. All of this data is obviously made up, just random. After I have checked all of those I then check to see if row[‘c’] >= 4 and the card number starts with 99. (row[‘c’] is checking if the premium listing slots are all taking (there can only be a maximum of 4 slots.) If they are all taking the listing type will be set to ‘1’ (a normal business listing). If not then we continue the script. The next part checks if the card number is set to 99. If it is then it will insert all of the data, including the image to the DB. This is my logic but I’m not sure I have done it all correctly within my page. This is my payment page (is quite long though)

<?php
session_start();
error_reporting(E_ALL);

include_once('connect.php');

// CHECK IF THE SESSION ID IS SET
if(isset($_SESSION['id'])) {
    $id = $_SESSION['id'];
}

// POST INPUT STRING TO VARIABLES
$cat = $_GET['cat'];
$list = $_GET['radio'];

$norm_li = 'unchecked';
$prem_li = 'unchecked';

if ($list == 1) {
    $value = '£10 for a normal business listing';
}
else if ($list == 2) {
    $value = '£50 for a premium business listing';
}

if (empty($cat)){
    echo '<p style="font-family: Arial; text-align: center;">Please enter a category</p>';
    echo '<p style="font-family: Arial; text-align: center;">Redirecting...</p>';
    header('refresh:3;url=dashboard.php');
}
else {

    // SELECT MATCH FROM THE DATABASE
    $querymatch = "SELECT * FROM category where cat_name=?";            
    $statementmatch = $con->prepare($querymatch);
    $statementmatch->execute(array(
        $cat
    ));

    if($statementmatch->rowCount() > 0) {

    $data = $statementmatch->fetch(PDO::FETCH_ASSOC);
    ?>

        <!Doctype html>

            <head>
            <title></title>
            <!-- Styles -->
            <link rel="stylesheet" href="assets/css/styles.css"/>

            <!-- Scripts -->
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!-- jQuery Core -->

            <script>
            $(document).onload(function(){

                $(window).resize(function(){
                    $('.className').css({position:'absolute', left: ($(window).width() 
                    - $('.className').outerWidth())/2,
                    top: ($(window).height() 
                    - $('.className').outerHeight())/2
                    });
                });

                // To initially run the function:
                $(window).resize();
            });
            </script>

            </head>
            <body style="background: rgba(0, 0, 0, 0.7);">
                <div class="payment">
                    <h3>What you have selected</h3>
                    <p name="pay_cat" style="width: 100%; display: block; text-align: center;"><?php echo 'You have selected your category as '.$cat; ?></p>
                    <p name="pay_list" style="width: 100%; display: block; text-align: center; line-height: 22px;">
                    <?php
                        // CHECK TO SEE IF THERE ARE 4 PREMIUM LISTINGS
                        $sql = "SELECT COUNT(*) AS c FROM payment WHERE listing_type = 2";
                        $stm = $con->prepare($sql);
                        $stm->execute();
                        $row = $stm->fetch(PDO::FETCH_ASSOC);

                        // IF THERE IS 4 PREMIUM LISTINGS (MAXIMUM)
                        if($list == 2 && $row['c'] >= 4) {
                            echo 'Our premium list is currently full. We have transfered <br />you to a normal business listing.';
                        }
                        // IF THERE IS A PREMIUM SPACE, CREATE A NEW VARIABLE
                        else {
                            echo 'You agree to pay '.$value;
                        }
                    ?></p>

                    <div class="method">
                        <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data"><br /><br />
                            <h3>Enter your bank details</h3>

                            <input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
                            <input name="fileup" type="file" />

                            <label>Card number</label>
                            <input type="text" name="cardNo" placeholder="Enter"><br />

                            <label>Expiry date</label>
                            <input type="text" name="expiry" placeholder="Enter"><br />

                            <label>CVV</label>
                            <input type="text" name="cvv" placeholder="Enter"><br />

                            <button class="btn" type="input" name="submit" value="pay_now">Pay Now</button>
                            <button class="btn grey" type="reset">Reset Form</button>

                            <div>

                                <?php

                                $uploadpath = 'uploads/';      // directory to store the uploaded files
                                $max_size = 2000;          // maximum file size, in KiloBytes
                                $alwidth = 900;            // maximum allowed width, in pixels
                                $alheight = 800;           // maximum allowed height, in pixels
                                $allowtype = array('bmp', 'gif', 'jpg', 'jpe', 'png');        // allowed extensions

                                if(isset($_FILES['fileup']) && strlen($_FILES['fileup']['name']) > 1) {
                                    $uploadpath = $uploadpath . basename( $_FILES['fileup']['name']);       // gets the file name
                                    $sepext = explode('.', strtolower($_FILES['fileup']['name']));
                                    $type = end($sepext);       // gets extension
                                    list($width, $height) = getimagesize($_FILES['fileup']['tmp_name']);     // gets image width and height
                                    $err = '';         // to store the errors

                                // IF THE SUBMIT BUTTON HAD BEEN CLICKED AND THE VALUE IS = TO PAY_NOW
                                    if(isset($_POST['submit']) && $_POST['submit'] == 'pay_now') {
                                        $cat_name = $_GET['cat'];
                                        $list_val = $_GET['radio'];

                                        $card = $_POST['cardNo'];
                                        $expiry = $_POST['expiry'];
                                        $cvv = $_POST['cvv'];

                                        // SETTING THE TIME ZONE FOR INPUTING THE DATE INTO THE DB
                                        date_default_timezone_set('Europe/London');
                                        $date = date("d-m-y");

                                        if(empty($card) || empty($expiry) || empty($cvv)) {
                                            echo '<div class="error">Please fill out all fields</div>';
                                        }
                                        else if(strlen($card) <= 15) {
                                            echo '<div class="error">Card number is to short</div>';
                                        }
                                        else if(strlen($card) >= 17) {
                                            echo '<div class="error">Card number is to long</div>';
                                        }
                                        else if(strlen($expiry) <=4) {
                                            echo '<div class="error">Expiry date is to short</div>';
                                        }
                                        else if(strlen($expiry) >=6) {
                                            echo '<div class="error">Expiry date is to long</div>';
                                        }
                                        else if(strlen($cvv) <=2) {
                                            echo '<div class="error">Security code is to short</div>';
                                        }
                                        else if(strlen($cvv) >=4) {
                                            echo '<div class="error">Security code is to long</div>';
                                        }
                                        // IF THERE IS 4 PREMIUM LISTINGS (MAXIMUM)
                                        else if ($row['c'] >= 4 && substr($card, 0, 2) == 99) {
                                            // INSERT INFO INTO THE DATABASE
                                            $query = "INSERT INTO payment SET pay_id='' , user_id='$id' , listing_type='1' , category=? , card_no=? , expiry=? , cvv=? , date='$date' , accepted='In Progress'";    
                                            $statement = $con->prepare($query);
                                            $statement->execute(array(
                                                $cat_name,
                                                $card,
                                                $expiry,
                                                $cvv
                                            ));

                                            // IT'S ALL GOOD
                                            echo '<div class="success">Payment Successful</div>';
                                            header('refresh:3;url=dashboard.php');
                                        }
                                        else if (substr($card, 0, 2) == 99) {

                                        // Checks if the file has allowed type, size, width and height (for images)
                                        if(!in_array($type, $allowtype)) $err .= '<div class="error">Invalid extention type</div>';
                                        if($_FILES['fileup']['size'] > $max_size*1000) $err .= '<div class="error">File is too large. Max size '. $max_size. ' KB.</div>';
                                        if(isset($width) && isset($height) && ($width >= $alwidth || $height >= $alheight)) $err .= '<div class="error">Max width x height is </div>'. $alwidth. ' x '. $alheight;

                                            // INSERT INFO INTO THE DATABASE
                                            $query = "INSERT INTO payment SET pay_id='' , user_id='$id' , listing_type=? , category=? , card_no=? , expiry=? , cvv=? , date='$date' , accepted='In Progress'";    
                                            $statement = $con->prepare($query);
                                            $statement->execute(array(
                                                $list_val,
                                                $cat_name,
                                                $card,
                                                $expiry,
                                                $cvv
                                            ));

                                            // If no errors, upload the image, else, output the errors
                                            if($err == '') {
                                                if(move_uploaded_file($_FILES['fileup']['tmp_name'], $uploadpath)) {

                                                    $path = $_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['REQUEST_URI']), '\\/').'/'.$uploadpath;
                                                    $name = $_FILES['fileup']['name'];
                                                    $type = end($sepext);

                                                    $sql = "INSERT INTO uploads SET user_id = '$id', img_name = '$name', img_type = '$type', img_path = '$path'";
                                                    $statement = $con->prepare($sql);
                                                    $statement->execute();

                                                    echo '<div class="success">Payment Successful</div>';
                                                    header('refresh:3;url=dashboard.php');

                                                //echo 'File: <b>'. basename( $_FILES['fileup']['name']). '</b> successfully uploaded:';
                                                //echo '<br />File type: <b>'. $_FILES['fileup']['type'] .'</b>';
                                                //echo '<br />Size: <b>'. number_format($_FILES['fileup']['size']/1024, 3, '.', '') .'</b> KB';
                                                //if(isset($width) && isset($height)) echo '<br />Image Width x Height: '. $width. ' x '. $height;
                                                //echo '<br /><br />Image address: <a href="http://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['REQUEST_URI']), '\\/').'/'.$uploadpath.'">Click to view '.$name.'</a>';
                                                }
                                                else {
                                                    echo '<div class="error">Unable to upload file</div>';
                                                    echo $err;
                                                }
                                            }
                                        }
                                        else {
                                            echo '<div class="error">Card does not start with 99</div>';
                                        }
                                    }
                                }
                                ?>
                            </div>
                        </form>
                    </div>
                </div>

                <div class="closer">
                    <a href="index.php"><img alt="Closer" src="assets/img/closer.png" /></a>
                </div>

<?php 
    }
    else {
        echo '<p style="font-family: Arial; text-align: center;">No such category in DB. Please enter another</p>';
        echo '<p style="font-family: Arial; text-align: center;">Redirecting...</p>';
        header('refresh:3;url=dashboard.php');
    }
}
?>

Here is an image of what it looks like in action:

error with payment: error page

successful payment: success page

any help is very much appreciated :)

73 posts
  • 2 Years of Membership
  • Collector Level 1
  • Copyright Ninja
  • Exclusive Author
+1 more
ThomasNiven
says

Can’t seem to find you. What do you need to help me? You need my tables in my DB?

by
by
by
by
by
by