Anyone who is not busy and can help

Started by melaa, November 10, 2004, 10:05:14 AM

Previous topic - Next topic

melaa

Hello All...not sure if I'm putting this in the correct spot but feel free to move it if its not.

Let me start with a little story.  About 2 years ago I was at my Mom's house and her family was over and I was showing my Aunt the website that I had made.  Anyway, I have been tinkering with HTML for a long long time now, and also took at bunch of courses in school to program in basically outdated languages now.  About a year ago I discovered CSS and PhP/Mysql....after installing yabbse and setting up a family message board (since my fam is all over the country now) I started to add/convert my web site (muppee.com - which is down atm because no-ip hasn't updated on my server and i got a new ip address last night - another long story about how i can burn through network equipment) to use css among other new cool things you can code with for the web. 

To get on with my story, my Aunt asked if I could maybe make your a website for her Real estate ventures.  She said she had one through the company but allot of her colleges had their own personal one and that seemed to help them get more sales.  So I agreed to make her one for her military relocation services. (militaryrelo.net - also down because no-ip hasn't updated).  Continuing now, she moved to a new firm where they offered her this deal since they liked the site so much, if she could get people to register on her site to show they went to her first, even if they did not relocate through her, she would still receive some sort of compensation for them.  SO she asked if this was possible, and at the time I had a lot of free time on my hands and told her I would look in to it.  So researching more about PhP/Mysql and getting a few books I decided to help her.  there wasn't really any rush on the project and she knew that I was learning as I went.  I read the tutorials on this board (which btw kick ass and were very helpful).

I'm kind of at a stand still, I got the database created, and started in on the code part, but I can't seem to get anything to work.  Then I ran in to a major set back, my harddrive crashed and I lost everything that I hadn't sent up to my web server.  So I'm kind of back at square one, which wouldn't be a problem, except I'm not on a deadline to get this working by Monday. 

Basically its very simple.  there are 7 or 8 pages that have to sit behind a login.  To log in/register with the website the end-user needs to provide Name, Email, Phone and Address.  Then a password so they can get back in to the site. 

So my question is if anyone has time and wants to help with this, can you please PM me send an email to [email protected]

The only downside I see to things right now is that i have to terminal services in to my server and hit the update no-ip button so that the page is viewable again..but alas i can't remember my new Ip address.

Thanks in advance for anyone who is willing to dig me out of this whole that I have created in trying to leap before I learned to walk. =)

-melaa

Kender

http://chucknorris2012.com  Avoid a roundhouse kick to the head!  Sign the petition

Douglas

You might want to indicate if you're looking for free help or paid help.  Once you do that, I'll move this into the Help Wanted forum with the right flag in the subject.
Doug Hazard
* Full Stack (Web) Developer for The Catholic Diocese of Richmond
(20+ Diocesan sites, 130+ Church sites & 24 School sites)
* Sports Photographer and Media Personality
* CFB Historian
* Tech Admin for one 1M+ post, one 2M+ post and one 10M+ post sites (last two are powered by multiple servers)
* WordPress Developer (Junkie / Guru / Maven / whatever)

melaa

#3
Cool thanks free would be nice, altho i understand that is prolly not going to happen....i got alot done, kinda sort of over the last day.  My script to input the data in to the database almost works.   :D  by almost I mean, if I leave the form blank and submitt it displays what i want, but if I fill it in i get some fusterating errors hehe  :D

Christian A. Herrnboeck

Quote from: melaa on November 11, 2004, 03:29:28 PM
Cool thanks free would be nice, altho i understand that is prolly not going to happen....i got alot done, kinda sort of over the last day.  My script to input the data in to the database almost works.   :D by almost I mean, if I leave the form blank and submitt it displays what i want, but if I fill it in i get some fusterating errors hehe :D
Post the script here, and We'll have a look at it ;-)

The Theory of Open-Source: "We help you to do it; we don't do it for you, because what would that teach you?"

Christian :D


Farmers:Producing food for the world!

melaa

#5
Quote from: fm-2 on November 11, 2004, 10:18:48 PM
Post the script here, and We'll have a look at it ;-)

The Theory of Open-Source: "We help you to do it; we don't do it for you, because what would that teach you?"

Christian :D

Your the best <3
okies this is what I have...fixed that problem with the error message but now it looks like no data that I enter goes in to the database.  Website is militaryrelo.net incase you want to see it there.

register.php that is suppose to input the data..i didn't include the print statements here since i don't think they matter...just the important stuff...

$username="";
$password="";
$database="Military";

$first=$_POST['first'];
$last=$_POST['last'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$address1=$_POST['address1'];
$address2=$_POST['address2'];
$password=$_POST['password'];

mysql_connect("localhost",$username,$password);
mysql_select_db($database) or die("Unable to select database");

$query = "INSERT INTO members VALUES ('',$first,$last,$phone,$email,$address1,$address2,$password)";
mysql_query($query);

mysql_close();


and this is the script to view whats in the database..which works but shows there is nothing in there...


$username="";
$password="";
$database="Military";

mysql_connect("localhost",$username,$password);
mysql_select_db($database) or die("Unable to select database");
$query="SELECT * FROM members";
$result=mysql_query($query);
$num=mysql_numrows($result);

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

$i=0;
while ($i < $num) {

$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$phone=mysql_result($result,$i,"phone");
$email=mysql_result($result,$i,"email");
$address1=mysql_result($result,$i,"address1");
$address2=mysql_result($result,$i,"address2");

echo "<b>Name: $last, $first</b><br>Phone: $phone<br>Email: $email<br>Address: $address1<br>Address: $Address2<br><hr><br>";

$i++;
}

melaa

#6
OMG wait i'm so dum...two var's with the same name...no wonder why i have all these problems...need to lay off the...ummm hmmm...nvm  :P


edit: oh hmm still doesn't send data to database...unless my view script is screwy

[Unknown]

For the first, I suggest....


$username = '';
$password = '';
$database = 'Military';

$first=$_POST['first'];
$last=$_POST['last'];
$phone=$_POST['phone'];
$email=$_POST['email'];
$address1=$_POST['address1'];
$address2=$_POST['address2'];
$password=$_POST['password'];

mysql_connect('localhost', $username, $password) or die('Unable to connect to database.');
mysql_select_db($database) or die('Unable to select database.');

mysql_query("
   INSERT INTO members
   VALUES ('', '$first', '$last', '$phone', '$email', '$address1', '$address2', '$password')");

mysql_close();


But, of course, you'll want to make sure, in this case, that magic_quotes_gpc is on.

-[Unknown]

melaa

WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT

[unkown] you the man!!!!

melaa

Ok so question...
btw sorry if its a newb question, but i want to learn  ;)

If i'm searching my database

mysql_query("
        SELECT email FROM Members                     
        WHERE email='$email'");


and I have already defined $email...do I have to set it up so that it looks at each row and compares until it finds $email or will it search that whole entry in the table until it find it?  And if I have to search for it...is the best way to count all the rows, then set up "if loop" to look at the row and compare?  I think its the later i just want to make sure.

Thanks
Melaa

Christian A. Herrnboeck

actually, if there is only one row in the database with that email address, only that one entry is returned. MySQL's engine takes care of the searching for you :-) To make it easier to handle the result, take a look at mysql_fetch_array

Christian


Farmers:Producing food for the world!

melaa

ok so i'm lost (hehe big surprise there)...what am i doing wrong

This is my login.php

$username='';
$password='';
$database='Military';

$uemail=$_POST['email'];
$upword=$_POST['pword'];

mysql_connect("localhost", $username, $password) or die ("Unable to select server");
mysql_select_db($database) or die ("Unable to select database");

$query = "SELECT * FROM Members";
$result=mysql_query($query) or die("Unable to run query");
$num=mysql_num_rows($result);

mysql_close();

function global_session($var){
      if(!array_key_exists($var,$_SESSION))
           $_SESSION[$var]='';
           $GLOBALS[$var]=&$_SESSION[$var];
        }

$i=0;
while ($i < $num) {
$un = mysql_result($result, $i, "email");
$pw = mysql_result($result, $i, "pword");
if ($uemail==$un) {
   if ($upword==$pw) {
      session_start();
      global_session($un);
      global_session($pw);
      header('Location: /welcome.php');
} else {
      header('Location: /retry.html');}
}
$i++;
}


And it works, takes you to all the right places depending on what info you put in for your username and password.  The problem is when you put in the correct username and password...it takes you to welcome.php but I just get a blank page.

this is my welcome.php

start_session();
GLOBAL $un, $pw;

function checkLogin(){
   if(isset($_SESSION['un']) && isset($_SESSION['pw'])){
      if(confirmUser($_SESSION['un'], $_SESSION['pw']) != 0){
         unset($_SESSION['un']);
         unset($_SESSION['pw']);
         return false;
      }
      return true;
   } else {
      return false;
}

$loggedin = checklogin ();
if (!$loggedin) {
Print <<<HERE
bunch o stuff
HERE;
} else {
      header ('Location: /members.html');
}



all comments welcome...feel free to tell me to hang it up now if i'm way off  :P
thanks
-mel

Advertisement: