Monday, 7 November 2011

Photoshopping again

I discover I have developed a recent obsession with photoshopping what i did. Anyway, this was a very rough summary of the previous journal (which i hastily typed up, quite late at night, and therefore contained NO IMAGES)

Sunday, 6 November 2011

Passwords

So, after two nights, I have finally figured out how to do the password thing on javascript. (I did this yesterday night (3 hours), this morning (2 hours) and tonight (1 hour)- this totals up to an amazing 6 hours. Time sure flies when you are having fun)

To be honest, I think javascript is a lot easier than php since I've been using it for some time now (a couple of summer holidays were spent on web programming), however, php is probably better and more reliable since it is probably easier to change the password on PHP. I'll probably end up using php in the end but for now, I'll settle for javascript. If i dont manage to do the php version of this i can always use this instead.

Anyway, i encountered so many problems here. Many were solved using the ever reliable http://www.w3schools.com/

first, i visited
http://www.w3schools.com/js/js_popup.asp
to find out about popups and discovered something called a prompt which would prompt you to enter something. I assumed this could be a password and set up a series of if else if statements.

The main part goes like this
<script type="text/javascript">
function showcomments()
{
document.getElementById('comment_box').style.display='block';
}

</script>

<script type="text/javascript">
function showprompt()
{
var password=prompt("Please enter the password"," ");
if (password=="hello"){
showcomments();}
else if (password!="hello" && password!=null)
{
alert ('Sorry you are not authorised to comment');}</script>

One thing that really annoyed me at first was how cancel was treated as a null value. At first my if else statement said that if you typed the password (which was "hello") then the page would redirect to another page where you could comment. And then if you got it wrong (password!="hello") then the page would redirect you to another page where you would receive a message saying that you had no authorisation.

So many things were wrong about that whole system.
1) If you hit cancel, that counted as NOT equals to "hello" so you would redirect to another page saying you had no authorisation. But what if the user had accidentally hit the button and wanted to go out? By redirected to another page would be annoying.
2) What if someone realized that the url changed to say...localhost/commentonphoto.php everytime you succeeded and localhost/noauthorisation.php each time the password was wrong. Then they could just type the url in.
3) Also the redirecting was annoying for me since I tested it at least 50 times throughout these 2 nights

Solutions
1) I realized that...what if i did this?
if (password=="hello"){
showcomments();}
else if (password!="hello" && password!=null)
{
alert ('Sorry you are not authorised to comment');}
First of all, it would check if the password was right. Then, if it wasnt, it would check if the password did not equal to the password AND not equal to null. This last touch, not equal to null, made it impossible to redirect to another page when cancel was hit.

2) Okay, first of all for the comment box, if the user had the password, then the comment box would appear right? So how about combining html div tags with javascript and css to show and hide the comment box? That's what I thought, so i went and googled it and it just so turned out that it was possible.

That bit in the blue tells the computer to show the comment box. I think that block doesnt mean show, but block the css from affecting the display of the div. So I set the css to display: none first. I found out about the block and none here http://www.harrymaugans.com/2007/03/05/how-to-create-a-collapsible-div-with-javascript-and-css/

To fix the other page changing problem, i decided i would have an alert box pop up to say something the lack of authorisation.

Oh yeah one more thing. I forgot to mention i used a stock photo for the background
http://static4.grsites.com/archive/textures/paper/paper017.jpg
I do not intend to use stock photos in my final version. I have installed photoshop elements on my laptop now and i intend to use it create tiling textures.

Saturday, 5 November 2011

SUCCESS

http://webdesign.about.com/od/css3/f/blfaqbgsize.htm
I got slightly bored with researching the search engine so i went and started making the basic backbone of the website. It was really easy compared to the search engine stuff which I was really grateful for. I just needed a break from all of it.
This website's tutorial really helped in stretching the background. I've had several attempts before but this is the first time i've been so succesful

Thursday, 3 November 2011

Search Engines Continued

http://inpics.net/tutorials/mysql/started21.html
This website helped me find out what a primary key is. Apparently it's the column that cant contain any duplicates eg. id.











http://webdesign.about.com/od/administration/a/aa091399.htm
I also found this site useful since it gave me a list of ways to make a search engine.

However, I realized after some time that perhaps, PHP and MySQL wasnt the way to make a search engine. What if it was actually Javascript? So I did some research


 

This somehow failed since the browser would not allow searching. I would search and nothing about the page would change. Javascript has always seemed unstable. I guessed that my best bet was PHP and MySQL.



 I think the best tutorial there is out there is this one
http://www.devarticles.com/c/a/MySQL/Developing-A-Site-Search-Engine-With-PHP-And-MySQL/2/
I was using it, but i havent finished it yet

Lightbulb Moment

Finally, I have thought up a plan of action for the search engine.

1) Create pages with ids and a paragraphs worth of content
2) Browser will use MySQL to drag content into MySQL array in the content column
3) User searches
4)  MySQL and PHP searches through the content and echoes back the title, and part of the content with the key words bolded.

I must try this out now

Serach Engines

I decided to check the possibility of making a search engine. I really dont understand the concept behind a search engine that searches for keywords. So once again, I put together a poster explaining my findings. Here are the links shown on the poster
http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html

Friday, 28 October 2011

Checking possibility of CMS

I checked the possibility of making a CMS (content management system) and I made a poster to summarize my findings. I can say that I am 70% sure I can make the CMS with a lot of research