Personal Portfolio (PHP) (HTML) (CSS) (Database-Driven) (Mysqli)

Status
Not open for further replies.

LeChris

https://habbo.codes/
Sep 30, 2013
2,786
1,395
Recently, I started creating my personal portfolio, and I have actually got a lot done! My experience with PHP is not actually the best, and I can still be classified as a newbie. I am hoping to get the most out of PHP, and mysqli with this website and also make it a lot easier to code themes, and add to my website!
Snippets
PHP:
<?php
include ('application/configuration/config.website.php');
$mysqli = new mysqli("$host", "$user", "$pass", "$name");
$page= $_GET['page'];
$query = "SELECT * FROM light_pages WHERE name = '$page' ";
$query2 = "SELECT * FROM light_themes WHERE name = '$website_theme' ";
$result2 = $mysqli->query($query2);
$t = $result2->fetch_array(MYSQLI_ASSOC);
$result2 = $mysqli->query($query);
$result = $mysqli->query($query);
$c = $result->fetch_array(MYSQLI_ASSOC);
echo '<!DOCTYPE html>';
echo '<head>';
echo '<title>';
echo $website_name;
echo ' | ';
echo $c["name"];
echo '</title>';
echo '<style>';
echo $t["css"];
echo '</style>';
echo '</head>';
echo $c["content"];
$mysqli->close();
?>
Screenshots
ykLPVND.png

HgkJ1kl.png

HplvwQV.png

t2srSSY.png

Live Demo
***********************
(Will make it /blog without ?page= as index directly later on)
 
Last edited by a moderator:

Ecko

23:37 [autobots] -!- eckostylez [[email protected]]
Nov 25, 2012
1,398
962
1. Learn to indent.
2. Don't echo HTML unless you have to. If you do, do it properly:
PHP:
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
            <html xmlns=\"http://www.w3.org/1999/xhtml\">
            <html lang=\"en\">
                <head>
                <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
                <title>" . $website_name . " | " . $c['name'] . "</title>
                <style>" . $t['css'] . "</style>
                </head>";

echo $c["content"];
$mysqli->close();
3. Don't store CSS in the database. CSS resources are cached by the web browser .You are removing that function and then creating additional overhead in your database.
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
Instead of storing the actual CSS in the database, why not store the link to the actual css in your database and then link that via PHP.
Tbh, this looks like a lot of effort to achieve not much.
 

Quackster

a devbest user says what
Aug 22, 2010
1,765
1,245
You should check if GET page exists, if it doesn't, default it to 404 or index.

PHP:
if (!isset($_GET['page'])) {

    $_GET['page'] = "404";

}
 

Mega

Posting Freak
Mar 23, 2013
858
155
Hey, these are my opinions. If you are using PHP to practice or creating functions, thats good but if you just want people to not see your CSS & HTML codes and ripped it off, I think this is a bad idea because people can still see your codes although it is safe on the database. I'd rather just make a file which contains my CSS. I'm sorry if I'm wrong, please do tell me.
Screenshots
gzfb4c0j
 

Quackster

a devbest user says what
Aug 22, 2010
1,765
1,245
Hey, these are my opinions. If you are using PHP to practice or creating functions, thats good but if you just want people to not see your CSS & HTML codes and ripped it off, I think this is a bad idea because people can still see your codes although it is safe on the database. I'd rather just make a file which contains my CSS. I'm sorry if I'm wrong, please do tell me.
Screenshots
gzfb4c0j
I don't think he cares about that. I believe it's just another way for him to store his template data.
 

LeChris

https://habbo.codes/
Sep 30, 2013
2,786
1,395
Thanks @eckostylez ! @Quackster I took 5 hours attempting that basic function so thanks! @Mega Im doing this so I can do my website faster through my admin panel than surfing through cPanel and to learn PHP.
 

Nehalem

Aug 31, 2013
293
47
Uh, hai. These are my opinions.

I don't like the way you're writing your code. It's really messy, and you haven't even taken time to construct it properly. And I don't know much about the template, and I can't even rate it, It's just a white box on a black bg.

You should improve the design (don't use too dark colors) and eventually remake and/or try to construct the PHP codes. Good luck with this, I'm hoping you'll finish it :3
 
Last edited:

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
You should path that SQL exploit ^^

@ SELECT * FROM light_pages WHERE name = $page
 

Nehalem

Aug 31, 2013
293
47
Lol thanks, how my theme?
hanRhYa.png

Finished Navi
Here are some tips:
  • Change the font, use Tahoma/Verdana instead
  • Change the borders (maybe the border-radius) they're terrible atm.
  • Change the background to something more softer, and I'll recommend you to also add an image to the header
Besides that, It looks kinda nice. Good work.
 

LeChris

https://habbo.codes/
Sep 30, 2013
2,786
1,395
Development paused. Resuming on Friday...anyways minor change log. I have deleted all my files and my database as I am wanting to redo the entire system to be a whole lot cleaner and professional. Friday I should have the template system done as I am wanting to incorporate this into a CMS.
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
You say a template system but from what you've previously posted it appears you only know basic HTML/PHP - will you be creating this yourself? Just curious as it'd be a shame for you to use something.
 

LeChris

https://habbo.codes/
Sep 30, 2013
2,786
1,395
You say a template system but from what you've previously posted it appears you only know basic HTML/PHP - will you be creating this yourself? Just curious as it'd be a shame for you to use something.
I will be looking int Rev's and making a basic edit of it to learn more f how to code them and use them vfluently. Than I make a custom one
 
Status
Not open for further replies.

Users who are viewing this thread

Top