Jump to content

CMS and Personal Website feedback


Anders Moen

Recommended Posts

I know the meta isn't the best, but it doesn't work to use header in body, does it? I thought that had to be over <html>?If so, I don't know how to check if a user is logged in or not. I can add the login script here, and then you can check it out and help me, maybe?

<?phpif ($_SESSION['online']) {echo "Welcome " . $_SESSION['username'] . "<br /><br /><br /><a href=\"1.php\">Add news <b>with</b> image</a><br /><br /><a href=\"other.php\">Add news <b>without</b> image</a>";}else if (isset($_POST['username']) && isset($_POST['password'])) {$db=mysql_connect("localhost", "username", "password");mysql_select_db("db_name", $db);   $username = htmlentities($_POST['username']);   $password = htmlentities($_POST['password']);     $username = mysql_real_escape_string($username);   $password = mysql_real_escape_string($password);   $query = mysql_query("SELECT username, password FROM members WHERE username = '$username' AND password = '$password'");     if(mysql_num_rows($query) == 1) {   $_SESSION['online'] = true;   $_SESSION['username'] = $username;   echo "Welcome $username!<br /><br /><br /><a href=\"1.php\">Add news <b>with</b> image</a><br /><br /><a href=\"other.php\">Add news <b>without</b> image</a>";mysql_close($db);   }}else {?><h1>Login</h1><form action="" method="post"><p>Username<br /><input type="text" name="username" /></p><p>Password<br /><input type="password" name="password" /></p><p> <br /><input type="submit" name="submit" value="Login" /></p></form><?php}?>

Notice this: I have two places where it says hello and then the username...or something like that. That's because the first time you come to a site (when you're logged in), it says the message that's longest down, and the one that's on the top, shows the second time, and the third and yeah, you get the point...

Link to comment
Share on other sites

  • Replies 189
  • Created
  • Last Reply

Top Posters In This Topic

It's best to have all of the PHP processing on the top, and use variables to figure out what to output later. So in the page, the first thing should be the <?php tag, not the <html> tag. Do all the PHP processing first, and then figure out what to do with the page.Start with session_start to make sure the session will work. You can use a variable to keep track of whether or not the user is logged in (like the session variable you have), and another one to keep track of any error or status messages. So you check in the session if they are already logged in, or if not check to see if they submitted the login form. You're already doing that. Once all of that is finished, you can do a header redirect if you want, and it will work because you haven't sent any output yet. After all that is done, then you write your HTML or include a template or whatever you need to do for the output. The point is to separate the PHP processing from the HTML output, so you can process all you need to and then decide what you want to do with the page.

<?phpsession_start();$logged_in = false;$msg = "";if ($_SESSION['online'])  $logged_in = true;else if (isset($_POST['username'])){  $db=mysql_connect("localhost", "username", "password");  mysql_select_db("db_name", $db);  $username = htmlentities($_POST['username']);  $password = htmlentities($_POST['password']);  $username = mysql_real_escape_string($username);  $password = mysql_real_escape_string($password);  $query = mysql_query("SELECT username, password FROM members WHERE username = '$username' AND password = '$password'");  if(mysql_num_rows($query) == 1)  {	$_SESSION['online'] = true;	$_SESSION['username'] = $username;	$logged_in = true;  }  else	$msg .= "The username and password did not match.<br /><br />";  mysql_free_result($query);  mysql_close($db);}/*at this point you can do a header redirect if necessary because you have not sent any outputheader("Location: login.php");exit();*/?><html>  <head>	...  </head>  <body>	<?php echo $msg; ?><?php if ($logged_in) { ?>	Welcome <?php echo $_SESSION['username']; ?>	<br /><br /><br />	<a href="1.php">Add news <b>with</b> image</a><br /><br />	<a href="other.php">Add news <b>without</b> image</a><?php } else { ?>	<h1>Login</h1>	<form action="" method="post">	<p>Username<br /><input type="text" name="username" /></p>	<p>Password<br /><input type="password" name="password" /></p>	<p> <br /><input type="submit" name="submit" value="Login" /></p>	</form><?php } ?>  </body></html>

Link to comment
Share on other sites

It's doing the same thing. Enter a title, a description, I was just using "?" for the name, and leave the email blank and hit submit. It goes back to an empty form and then uses a meta refresh to redirect to the other page.Also, it looks like you were using a meta refresh to check if they were logged in and redirect otherwise. A meta refresh can be disabled, it would be better to send a location header.
I found out why you were redirected that far. I had forgotten to change one redirect, hehe... Now it should work fine again, I guess.Edit: anyone got any ideas for a name for the CMS system? Like Wordpress and Cutenews and stuff? I want to like have "Powered by some name" like many forums and other CMS systems.D%*¤! I haven't put on comments yet! I'll try to do it now :)
Link to comment
Share on other sites

Cutepress:), thats a good name! Why not think of it on your own? just a question!How about editing? That would be nicer, oh yeah. I haven't checked in a while but do you still need to have the author when logged in? Maybe you should remove that field?

Link to comment
Share on other sites

  • 2 weeks later...

Hello!I need some ideas for my new design for my site. After two months, all I got was this =/Oh yeah...the site is a personal one, and is gonna have a portfolio and stuff, just so you know.Max width should be 1024 with body margin and padding on 0px.Anybody got any ideas? I've looked at tons of personal sites, and sites with sites like W3CSites and stuffHope I get something from you guys :)

Link to comment
Share on other sites

If it's your portfolio, I would design it with something I like. For example, I like spacey designs. So one of my designs included planets and was hot! Whatever suits you. If find the hardest thing is designing a site for yourself. Try maybe doing a couple templates.

Link to comment
Share on other sites

I agree!Its kind of like talking about yourself. There is nothing harder to do than that. My personal website was redone over and over and over again until I decided to remove it from the web cause I never liked it!Sorry doesnt help much!Hope you have an easier time doing it!

Link to comment
Share on other sites

So like...maybe put in a nice picture of a guitar and stuff, then, since I play guitar and love music? Hehe...Thanks for templatemonster.com, but I've been there too, and I've tried to draw some stuff myself but since I'm really, really bad drawing it never gets any good lol...well, I'm browsing through Web Creme right now, looking for some ideas but I don't find anything I like.Well, a short note:I like the colors black, red and orange a lot, and I love music. Should I try to use those colors with some images of guitars/drumsets and more, or?

Link to comment
Share on other sites

No one can really tell you what you "should" do with the layout of your personal site. What you should do is make a layout that appeals to you. If using certain colors and images will make something that appeals to you, then that's what you should do.

Link to comment
Share on other sites

Yes, I know, but other people gotta like it too.Let's see...I build a portfolio, and no one but me likes the site. What will happen? Nobody wanna hire me to make their sites.But I'll try to find some images of some guitars and stuff, and mixing things together and then I'll pass out the link so you can see what you think of it. It might not be done in maybe 1 or 2 days, because I suddenly got 2 jobs at one night, and then maybe one more in some days, hehe.

Link to comment
Share on other sites

I just started building up something, and here it is, but remember: this is just something I made fast and it's a long way from done if I'm even gonna use it.Well, what you think so far?Edit: sorry for dobleposting, and the site is valid XHTML and CSS, at least the last time I checked.

Link to comment
Share on other sites

a.) http://andersmoen.hotserv.dk/new_design/too bland and little separation of content blocks. You have gone through the effort to make columns, but never visually define them. Something as little as a vertical line helps to containerize your content but adding blocks adn some color would not hurt either. Maybe something like this:http://www.oswd.org/design/preview/id/3514b.) http://andersmoen.hotserv.dk/new/Happy Halloween! Your parent navigation looks like tab delimited text out of position. Some treatment should be added to set them apart from everything else. Again, in the white space, you'll need something to separate the content from the categories.Honestly, I really don't like either "design". They could be made useful, but I'm not impressed and would likely pass it over.P.S. with the navigation structure you have outlined, you've got a lot of content to write - how do you plan on keeping up with it while you market yourself, sell yourself, close deals, develop sites, launch sites, provide support, maintain client relations, yourself, sell yourself, close deals, develop sites, launch sites, provide support, maintain client relations, yourself, sell yourself, close deals, develop sites, launch sites, provide support, maintain client relations...

Link to comment
Share on other sites

Hehe, okay, thanks for the comments. I don't like them either, but the second one I made in like 10 minutes, and the first one is still under construction.I told you I need ideas for my site...lol cause I'm really bad designing :)I wish someone could just draw me something nice, and then I could code it, but I doubt anyone will do it for free and since I'm a webdeveloper and stuff I should be able to do this myself =/Could you post personal websites you like, so Icould get some more ideas? lol

Link to comment
Share on other sites

hmmm not sure but I'm picturing a container with margin up top and the guitar could start inside your container and end up outside (near top of browser). The navigation could probably go beside the guitar... I'm not sure of the other colours.

Link to comment
Share on other sites

1/2 the lesson that every developer needs to learn is that they are not a graphic designer. It seems you have come to grips with that reality - I know I have with mine. Which is why you are starting to learn the second half of that lesson - how do I become self-sufficient if I can't graphically design worth a crap. Over time, you will learn how to surf the web for free templates (as a few have already been provided) and then re-engineer it without its source code. You should be at the point where all you need is a visual beginning.So, I'm more or less saying you are really on your own. You will get replies to your specific question as you have here, but these folks are just taking stabs in the dark by referring you to designs to reference. Everyone of the ideas presented (already and in the future) are always going to originate from a perspective other than yours - any is really just a waste of that persons time. I just think you need to goto google.com and search/browse web templates until the proverbial light bulb goes off on top of your head. Simply put, every recommendation made here is not going to result in your final product, if it does, then it is not an accurate representation of your skills and abilities as a web developer and therefore your site will completely misrepresent you.

Oh, like that yeah! Thanks, I will just code something fast and see how it'll go, hehe...
Ok, I know I'm on my soap box again. But if you are going to be serious about this web development thing (and especially your "CMS" thing), then you need to GET serious. Coding something fast and hoping for the best is not serious. I know I am sounding harsh, and I do not mean to sounds like a big brother (ok maybe a little), but please, please put thought into this or this is only ever going to be a hobby that you aren't good at.
Link to comment
Share on other sites

I wish someone could just draw me something nice, and then I could code it, but I doubt anyone will do it for free and since I'm a webdeveloper and stuff I should be able to do this myself =/
adersmoen, I do graphics. I will make you an image that says andersmoen in the colors you like with maybe a guitar and drumset in the background. I do pretty good stuff - trust me. You want it or not? It might take me a while because I have college, a newborn, a freelance web design job currently, and working for a real web design company starting in a couple of days - but when I find the spare time, I'll make you that image. I could even make it highlight with a JavaScript rollover if you want - that way you could use it as a link to the home page or something. Just let me know and you got it. If you like my work, maybe I could design graphics for your personal website or maybe you could even outsource your graphics work to me for your web design jobs? I wouldn't be able to do that for free, but I would probably accept whatever you pay me - one web designer to another :) Maybe you could take some money you get from a client and use it to pay me for graphics?Down the road, I might not even mind making graphics for you navigation links and stuff if I have time...
Could you post personal websites you like, so Icould get some more ideas? lol
http://www.kenetix.net/ - In my opinion, this is the best website layout I have ever seen period - hands down.http://www.ultraweaver.com/ - This is good too. You should definitely at least check both of these out. They both have graphics tutorials by the way also.Hope that helps,LifeInBinary.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...