Jump to content

php help [login and registrations] onto website


The Saint

Recommended Posts

Alright, Here's the problem I have that I've asked 10 people on Websites,Myspace,Instant Messengers, & Ect. The were just too advanced and confused me ALOT.

 

So I was wondering if someone could help me with my problem and simplify it too a certain level where I Don't get mixed up.

 

Alrighty, So here it is. I have made a website that is currently being worked on OFF LINE. I have Only downloaded WAMP5 SERVER. I followed a tutorial that can be found <a href="

I made a PHP Registration Successfully. I tested it out, the information WAS saved to my database and i could see it in the table. Great. The Way i viewed the registration page is I type in LOCALHOST and then i clicked SaintsProject [Name of Website] Under YOUR PROJECTS. Once the page loaded in h1 font displayed Index of /Saintsprojects then i saw register.php. Clicked it and it loaded and it works. Now i went into my WWW Files. Then Into Saints Project. I saw "register.php". Right-Clicked it, then Clicked Edit. I Copied the source. Went into my website, Edited the login.html pasted the source of register.php into it. I preview it and this is what i found...

 

<img src="http://photobucket.com/albums/i223/ballaj023/image.jpg">

 

 

Someone please explain to me what errors i made and this is the preview of register.php from the wamp server documents....

 

<img src="http://i73.photobucket.com/albums/i223/ballaj023/untitled.jpg">

 

 

This one works^ Why arent they identical?

 

 

Link to comment
Share on other sites

You can right-click on the file and go to 'Rename' and just change the extension to .php

 

Also, the case may be that you've pasted this code in there incorrectly. Looks to me like it's reading it as text. Be sure you have <?php ?> enclosing it plus make sure all your double and single quotes are in line. Otherwise it will just look like a mess.

 

Link to comment
Share on other sites

<font face=verdana>

<?php

 

$c =  mysql_connect(localhost,root,"") or die(mysql_error());

$d =  mysql_select_db(user,$c);

 

function protect($value){

$value = mysql_real_escape_string($value);

$value = stripslashes($value);

$value = strip_tags($value);

 

}

 

$action = $_GET['act'];

protect($action);

 

 

if(!$action){

echo  "<table border=0 celpadding=3 cellspacing=3>

    <form name=register method=post action=\"register.php?act=register\">\n

    <tr><td>Username:</td><td><input type=text name=username maxlength=32>\n</td></tr>\n

    <tr><td>Password:</td><td><input type=password name=password maxlength=15>\n</td></tr>\n

    <tr><td>Confirm Pass:</td><td><input type=password name=passconf maxlength=15>\n</td></tr>\n

    <tr><td>E-Mail:</td><td><input type=text name=email>\n</td></tr>\n

    <tr><td>Confirm E-Mail:</td><td><input type=text name=econf>\n</td></tr>\n

    <tr><td>Birthday (Day):</td><td><select name=day>/n";

 

        for($i=1;$i<32;$i++){

        echo "<option value=\"$i\">$i</option>\n";

        }

echo "</select></td></tr>\n

    <tr><td>Birthday (Month):</td><td><select name=month>\n";

        for($i=1;$i<13;$i++){

        echo "<option value=\"$i\">$i</option>\n";

        }

echo "</select></td></tr>\n

    <tr><td>Birthday (Year):</td><td><select name=year>\n";

        for($i=1994;$i>1900;$i--){

        echo "<option value=\"$i\">$i</option>\n";

        }

echo "</select></td></tr>\n

    <tr><td>Real Name:</td><td><input type=text name=name maxlength=32>\n

    <tr><td colspan=2 align=right><input type=submit value=\"Register\">\n";

}

 

 

if($action == "register"){

$username = $_POST['username'];

$password = $_POST['password'];

$passconf = $_POST['passconf'];

$email = $_POST['email'];

$econf = $_POST['econf'];

$day = $_POST['day'];

$month = $_POST['month'];

$year = $_POST['year'];

$name = $_POST['name'];

protect($username);

protect($password);

protect($passconf);

protect($email);

protect($econf);

protect($day);

protect($month);

protect($year);

protect($name);

 

              if(isset($username) && isset($password) && isset($passconf) && isset($email) && isset($econf) && isset($day) && isset($month) &&

 

isset($year) && isset($name)){

 

if(strlen($username) < 4 || strlen($username) > 32){

            echo "Sorry, your username is either too short or too long!\n";

            }else {

                if(strlen($password) <4 || strlen($password) > 15){

                echo "Sorry, your password is either too short or too long!\n";

                }else {

                    if(strlen($email) < 3 || strlen($email) > 125){

                    echo "Sorry, you're email is either too short or too long!\n";

                    }else {

                        if(strlen($name) < 1 || strlen($name) > 32){

                        echo "Sorry your name is too long! Please shorten it!\n";

                        }else {

                            if(!is_numeric($day) || !is_numeric($month) || !is_numeric($year)){

                            echo "Sorry your birthday you entered was false!\n";

                            }else {

                                if($day < 1 || $day > 31){

                                echo "Sorry, your birthday is invalid!\n";

                                }else {

                                    if($month < 1 || $month > 12){

                                    echo "Sorry, your birth month is invalid!\n";

                                    }else {

                                        if($year < 1901 || $year > 1994){

                                        echo "Sorry, your birthyear is invalid!\n";

                                        }else {

                                            $array = array('.');

                                            $math = $year/4;

                                            if((in_array($math,$array)) && $day > "28" && $month == "2"){

                                            echo "Sorry, your birthday is invalid!\n";

                                            }else {

                                                if($password != $passconf){

                                                echo "Sorry the passwords you entered, do not match!\n";

                                                }else {

                                                    if($email != $econf){

                                                    echo "Sorry, the emails you entered do not match!\n";

                                                    }else {

                                                        $checkemail = "/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";

                                                        if(!preg_match($checkemail,$email)){

                                                        echo "Sorry, the email you entered appears to be invalid!";

                                                        }else {

                                                            $sql = "SELECT * FROM `users` WHERE `username` ='$username'";

                                                            $res = mysql_query($sql) or die(mysql_error());

                                                            if(mysql_num_rows($res) > 0){

                                                            echo "Sorry, Our records show this username already exists!";

                                                            }else {

                                                                $sql = "SELECT * FROM `users` WHERE `email` ='$email'";

                                                                $res = mysql_query($sql) or die(mysql_error());

                                                                if(mysql_num_rows($res) > 0){

                                                                echo "Sorry, Our records show this email is already in use! ";

                                                                }else {

                                                                    $sql = "SELECT * FROM `users` WHERE `ip` ='$_SERVER[REMOTE_ADDR]'";

                                                                    $res = mysql_query($sql) or die(mysql_error());

                                                                    if(mysql_num_rows($res) > 0){

                                                                    echo "Sorry, Our records show this IP has already signed up an account!";

                                                                    }else {

                                                                        $password = md5($password);

                                                                        $bday = "$month/$day/$year";

                                                                        $date = date("F j, Y @ g:i:s a");

                                                                        $ip = $_SERVER['REMOTE_ADDR'];

                                                                        $sql = "INSERT INTO `users` (`username` , `password` , `email` , `ip` , `name` , `bday` , `date`

 

)VALUES ('$username', '$password', '$email', '$ip', '$name', '$bday', '$date');";

                                                                        $res = mysql_query($sql) or die(mysql_error());

                                                                        echo "Thanks for joining Saints Project.com! You may login now!\n";

                                                                        }

                                                                }

                                                            }

                                                        }

                                                    }

                                                }

                                            }

                                        }

                                    }

                                }

                            }

                        }

                    }

                }

            }

        }

       

}

?>

 

Link to comment
Share on other sites

lol

btw i look at the pic you post the location is document and setting the php should be run on your local host if its where the php is located

hmm

does it make sense

 

so your saying i should just put my web temp on the localhost/blah/register.php?

Link to comment
Share on other sites

What we're saying is that for your server software you've installed to parse the PHP pages or the HTML pages properly it would typically require that you place them into a specific location like I pointed out. In other words, just because you've installed this server software, wampserver, doesn't mean that the pages will run properly from any location on your computer. The pages must be placed within the wampserver directory on your hard drive. Now, i'm not that familiar with that program since I don't use it. But using the basic laws of reason they all work primarily the same since it's the same server software as the others but packaged a bit different. So, read the instructions on where to place your files in order for them to parse properly. What you're showing us with all that text instead of hidden code usually means you're trying to view it 'outside' the realm of your server software. Make sense?

Link to comment
Share on other sites

What we're saying is that for your server software you've installed to parse the PHP pages or the HTML pages properly it would typically require that you place them into a specific location like I pointed out. In other words, just because you've installed this server software, wampserver, doesn't mean that the pages will run properly from any location on your computer. The pages must be placed within the wampserver directory on your hard drive. Now, i'm not that familiar with that program since I don't use it. But using the basic laws of reason they all work primarily the same since it's the same server software as the others but packaged a bit different. So, read the instructions on where to place your files in order for them to parse properly. What you're showing us with all that text instead of hidden code usually means you're trying to view it 'outside' the realm of your server software. Make sense?

 

okay i understand so when i am ready do i extract the "whole" wamp2 file onto my website

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.