Friday, April 17, 2009

Last Week's Homework

I just want to go on record saying that I had done my homework correctly last week -- in as far as it turns out that the verbiage WAS writing to my text page. I just couldn't see any text on the page no matter how I changed/adapted/played-with my html and php -- because I never re-uploaded the text files!!! Sad to say, I wasted 6 hours going around in circles and didn't figure it out until I was in class on Saturday and downloaded my files from the server and saw all those usernames and passwords I had entered during all my troubleshooting! Anyway, unfortunately because of that roadblock, I didn't complete the password verification steps last week -- which I will attack next week. I wanted to concentrate this week on the new 'create a blog' assignment -- although once again I will admit that this (at least for me) is a massive and intricate project no matter how much cut-and-pasting I do.

Friday, April 10, 2009

Class 7 Homework (Assign 6?) IMAGE UPLOAD SITE

Well, I hate to say it but once again, this was a very difficult assignment for me. I thought I understood it -- particularly how to 'marry' the registration page with the process_register page and marry the login page with the process_login page -- however, I can't seem to get any information written to the users.txt files. I've tried looking through all my notes, through Amos' examples, through the book "PHP Visual Quickstart Guide" and watching the KillerPHP.com videos. My code seems logical, and it seems to align with everything I've read -- but I'm obviously missing 'something' (I just don't know what it is). Also, I can't seem to get the 'error' messages to appear/pop-up (i.e. Login Failed) on the page. I had to 'cheat' and recreate pages called register_fail.php and login_fail.php (which were replicas of their original pages, with an error message added). Since I can't get anything to write onto the users.txt page, I'm stuck with what to do with the login page (looping through passwords). I've been going round in circles since Sunday night, so I'm just about to give up. I'll try tonight to at least tackle the file upload page, but in the meantime, here are links to my register and login pages:

Register Page
Login Page
Register Fail Page (can't get to write to users.txt file)
Login Fail Page
Index Page (not functional yet)
Image Upload Page

Here's a sample of my code -- again not sure what I'm doing wrong:

PROCESS REGISTRATION PAGE:

/*
$username = trim ($_REQUEST['username']);
$password = trim ($_REQUEST['password']);

$handle = fopen ("users.txt", "a");

$register_info = "Username is {$username}, Password is {password} /n";

if ($handle) {
if ((!empty ($username)) && (!empty ($password))) {
fwrite($handle, $register_info);
header ("Location: login.php");
}

else {
echo "Please enter username and password.";
header ("Location: register_fail.php"); //re-direct to re-register page
}

}

fclose($handle); //close the file

*/

Friday, April 3, 2009

REVISED Homework #5 (HOMEWORK 6?)

Okay!

I was finally able to clean up my mouseout and mouseover homework.

For the html code, I created a parent div around both the image and the info div (which actually made perfect sense to me -- finally!). However, that still didn't fix the problem - which was extremely frustrating. After much careful and sometimes 'foggy' thought, I realized that I needed to re-think my PHP code to ensure that it was 'married' correctly to my new html code. That said, (and I'm hoping I'm using the correct verbiage here)I changed the ID of my mouseover/mouseout functions to align with the ID of my newly-formed parent divs -- which seemed to do the trick.

Fortunately I was able to get this homework functioning. Unfortunately, I'm still somewhat foggy on the overall logic/concepts. But I will, of course, continue to study and forge ahead...

Here is the link to my revised homework:

http://onepotcooking.com/annmariegatti/class6/cd_store.php

Monday, March 23, 2009

Class 5 Assignment: Store Website

Here is my project so far. I was able to use the hide and show, but there seem to be some kinks in it which I don't know how to address. It looks fine when it first loads, but if you mouseover or mouseout quickly, some images don't return.


http://onepotcooking.com/annmariegatti/class5/cd_store.html

Friday, March 13, 2009

Request

I am hoping that we can spend more time on JavaScript as I know it's a critical building block for our future work. I am trying my best to understand it, but it's conceptually confusing for me at this point and I do want to get a much better grip on it.

Homework 4 Register Now Part 2

Okay, I finally got it -- BUT I have to admit that this was a trial-and-error 'shot in the dark' process for me -- and I'm sure that I wrote way too much code. My unsuccessful attempts included playing with W3S's example for onkeypress events (which I just didn't understand at all), plus mimicking W3S's onkeyup event (which didn't work) and finally mimicking W3S's onclick event (again which didn't work). I reviewed notes from class about Changing Classes but that was unsuccessful too. I finally ended up using the html code from W3S's onclick event AND the js code from W3S's onkeyup event. I'm sure this can't be right...

I suspect at this point that my js code in the html doc is what's driving everything right now -- as nothing seems to relate to my external js script??? My biggest concern right now is that I still fundamentally do not understand how html and js drive AND relate to each other (I think I'm getting confused with how the variables in the external js script 'match' with the information in the html doc) -- for example, I understand what 'x' means in my external js sheet (the id), however when I tried to call the function within my html code by typing in onkeyup="copyTextInput (id);" /> or onkeyup="copyTextInput ('username_field_2') ;" /> or onkeyup="copyTextInput ('username_field_1');" /> the script just didn't work (and I'm not sure why because this made more sense to me then what I ended up doing). Also, in my external js script -- I don't get where the 'y' comes in as I'm certainly not referring to a 'y' anywhere in the html code...


here's a sample of my html code:

input id="username_field_1" class="field_box" type="text" name="username" onkeyup="document.getElementById('username_field_2').value=
document.getElementById('username_field_1').value;"


and here's a sample of my external sheet js code:

function copyTextInput(x) {
var y = document.getElementById(x).value;
document.getElementById(x).value = y.toCopyTextInput();
}
Here's the link to my webpage:

http://onepotcooking.com/annmariegatti/class4/register_now_rev.html

Homework 4 Register Now

Well I'm having a really hard time with JavaScript. Every so often I think I have a glimmer of insight and then it dissolves. I tried going thru the W3S tutorials and the Webmonkey tutorials that Jack posted -- I even bought JavaScript: The Missing Manual by David McFarland -- and I 'sort of' get some of the examples, but overall I just am not understanding the logic (i.e. and what needs to go into the html vs the js page -- and more importantly how they drive each other). That said, I am just posting this assignment without the JavaScript for now because the last version I did with JavaScript just gave me one big green page with absolutely nothing on it (luckily I saved my first html file!). Anyway, I'll keep trying tonight, and post again if I'm at least marginally successful.

http://onepotcooking.com/annmariegatti/class4/register_now.html