ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Ian's Website Progress Thread.



Ian

  Focus TDCi
Over the past month or so, on and off, I've been building a website for my photographs. It's coming along fairly well and I'm nearly at the point where I suppose you could say 'stage 1' is complete. Stage 1 being a functioning website that serves its purpose, but has plenty of room for improvement.

However I've got a few minor issues:


  • 1. Centering the main div holder
This is really bugging me as I don't know why it's doing it. At the moment I have:

Code:
.center {
  left: 50%;
  margin-left: -450px;
  width: 900px;
}
However when the page is less than 900px, instead of scrolling off the right hand-side the .center disappears equally off both the left and right side of the page, with no way of retrieving the left side. Therefore anyone viewing on a screen less than 900px wide can't see half the content.

I've tried changing to:

Code:
.center {
  margin: 0px auto;
  width: 900px;
}

or 

.center {
  margin-left: auto;
  margin-right: auto;
  width: 900px;
}
However it doesn't center and sits instead against the left hand edge.


Any thoughts how to resolve that?


  • 2. Password protecting individual pages
I've added password protection to individual pages that requires users to log on using a username and password, which works fine. However, once they are logged in they are able to see each others galleries. I.e. once you're in, you're into everything.

Any ideas how I'd make alterations to that? I can provide the php files if needed.



I'll post the link up once these issues are sorted out, I'd prefer to get everything straight first. :)

Thanks,
Ian
 

Ian

  Focus TDCi
Have you tried

position:absolute;

Hey Chris, sorry forgot to mention - I've just taken what I thought were relevant snippets from the code. The full code for the .center div is:

Code:
.center {
 background: #ddd;
 left: 50%;
 margin-bottom: 10px;
 margin-left: -450px;
 padding: 0px;
 position: absolute;
 top: 0px;
 width: 900px;
 z-index: 1;
}
There are more divs within this div positioned relative to it as well.
 
  Trophy #267
re the php, when u login you should activate the session with some kind of level access code. this obviously needs to be checked at each subsequent page (referring back tot he logon if not successful).
what check method are u using as the id of the user would correspond to an xml file / sql statement looking up gallery info
 

Ian

  Focus TDCi
anyway of showing me what you mean?

PM'd mate

re the php, when u login you should activate the session with some kind of level access code. this obviously needs to be checked at each subsequent page (referring back tot he logon if not successful).
what check method are u using as the id of the user would correspond to an xml file / sql statement looking up gallery info

This is added to the top of page that I want to lock:

Code:
<?php include("/home/####/public_html/php/password_protect.php"); ?>
This links to a php file which contains username and password combinations which I add like this:

Code:
  'admin' => 'adminpassword',

There's plenty more code in there too obviously. I don't really know php, so I don't really know where to start with this one. Would it help if I sent you the file?
 
  Trophy #267
that should work ok but im not too sure how secure having the pw accessable in plain text in a referred file unless it was only accessable from the source php page, not the net. whenever i have used logon its in conjuction with a sql table where the md5 or similar of any pw is stored, so when a user enters the pw, the hash is generated, comapred to the hash stored and only when matched does the session auth pass and redirect to a normal page.
php is very simple, i had never used untill 6 months ago and have since managed to setup some fairly complex stuff with only a sql backend and basic html knowledge
 
  Trophy #267
all my php pages begin with this
<?
session_start();

require_once('db.php');
include('functions.php');

checklogin('1 2');

where
db.php is the logon info for the sql table
functions.php contains all the boring php functions i have todo various things
checklogin is a function which passes 'levels' allowed acess to each page. is you are authed (with various levels) then you pass onto the rest of code, if you dont you get redirected to logon.php

it was just from a template i saw somewhere which a friend recommended and talked me thru using. ive since used it on several sites
 

Ian

  Focus TDCi
Adamio said:
Dunno how much you've done in your css sheet, but www.csscreator.com is a very handy starting point. You might even be able to make a blank layout on there and use some of the code.

I'll have a look at that, but I've basically finished most of my layout tbh!

Wolf359 said:
that should work ok but im not too sure how secure having the pw accessable in plain text in a referred file unless it was only accessable from the source php page, not the net. whenever i have used logon its in conjuction with a sql table where the md5 or similar of any pw is stored, so when a user enters the pw, the hash is generated, comapred to the hash stored and only when matched does the session auth pass and redirect to a normal page.

I have absolutely no clue when it comes to sql. I need to teach myself it at some point to automate my galley, rather than copying code manually, but at the moment I haven't the foggiest. The password protection is only a basic measure, but if I can improve it that'd be good.



Also..


  • 3. File paths
Is it ok to shorten:

....com/example/index.php

to

....com/example

When sending out links in emails/on forums etc?

Or should I just leave it as ....com/example.php
 
  Trophy #267
that depends on your webserver. in apache you can set what the index file is (ie what it looks for if you just put mydomain.com in without the /pager.php or whatever extension. default is obvs index.html but can be anything including more that 1 file
in your example no tho, as /example/index.php means its in the 'example' subdirectory whoch wouldnt work ...com/example probably would with the above setup
 

Ian

  Focus TDCi
Yeah that's what I was wondering, if I could have loads of index.php's at various sublevels so that if anyone typed in a sublevel with no file after it then it would go to the sublevel index.php page. Guess not though!
 
  Trophy #267
yes thats correct, lots of sites use that to showcase different albums, ie ...com/wedding ...com/portrait ...com/cars etc and makes it look tidier without the page link imho
 


Top