[DEV] Link saver & Publisher

Results 1 to 1 of 1
  1. #1
    Apprentice SystemSequence is offline
    MemberRank
    Feb 2016 Join Date
    5Posts

    config [DEV] Link saver & Publisher

    Hello,
    I am here today to show off my project that is my learning site for PHP and MySQL(Maybe some JS later on?). I've been working on this for 2 weeks, and started to learn PHP and MySQL 1.5 months ago and saw this as the best way to learn.​

    So, what it is? Well, it's not the best idea. But this is a way to save any links on the web and access it very easy by giving it a title and sort it in orders. What I mean with that is the first link you upload will be the last one after adding some more, and the newer one will always be on top.

    Well, this is good. But there's alot of sites like this, so what I wanted to do is create a user system so I can search for users or friends and see their profile and links and heart them wich I think is a good idea.

    So back to your account, when you upload the link your link so go on the "Flow" of the site, and the wall is place where ALL links that is being published will go. Just like a facebook wall but for links.

    So what steps has been done?

    • Create an account and login (100%)
    • Post links to your profile and flow(85%)
    • See registered users (100%)
    • Admin panel (10%) - It works good, but more admin power to come!

    What to come?

    • Heart/Favourite other users links
    • Follow other users
    • Search for users
    • Publish or not publish to the public Flow
    • Profile editing(Profile picture, bio, sex, country, etc)

    This will be a good mix of keeping stuff at one place for those who uses links alot and a way to keep in touch with other people.
    Notice that this is NOT the final design, it's just a template for me to keep stuff clean.

    Code snippets(Not the best, Im not so familiar with this yet)

    PHP Code:
    if(isset($_POST['btn-update'])) {
        
    $updateMyPost mysqli_real_escape_string($con$_POST['updateMyPost']);
        
    $user_id mysqli_real_escape_string($con$_POST['user_id']);
        
    $prefix mysqli_real_escape_string($con$_POST['prefix']);

        if(
    mysqli_query($con"INSERT INTO posts(link, user_id, prefix) VALUES('$updateMyPost', '$user_id', '$prefix')")) {

        } else {
            echo 
    'fail!';
        }

    PHP Code:
    if(isset($_SESSION['user'])) {

    $sql = "SELECT * FROM posts WHERE user_id=".$_SESSION['user'];
    $result = $con->query($sql);

    if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            ?> <span style="float:right"> Your ID: <?php echo $row['user_id']; ?></span> <?php
            ?>
     <span style="float:left"><a href="<?php echo $row['link']; ?>" target="_blank"><?php echo $row['prefix']; ?></span></p></a><br><br> <?php
        
    }
            } else {
           
    ?> <center> <?php echo "Update your first link!"?> </center> <?php
            
    }
        }
    }

    - Best regards.
    Last edited by SystemSequence; 29-03-16 at 09:57 PM.




Advertisement