TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-02-2005, 02:06 AM   #21 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

wait,
this line
<input type="text" FirstName="FirstName">
should be
<input type="text" name="FirstName">
see the difference, same with everyline. name is kind of reserved word and it is to be used as it is. the value inside quotes and after = is the actual value


Database:

NO,
to select database you have to do this
PHP Code:
 $con = @mysql_connect("localhost""dbuser""dbpassword");
    if(
$con)
    {
        if(@
mysql_select_db('database_name'))
        {
            
$query "insert into dbname.dbtable (FirstName, LastName, Email, Phone, Address, City, State, Zip, Username, Password, LastLogin)".
                 
"values('$FirstName', '$LastName', '$Email', '$Phone', '$Address', '$City', '$State', '$Zip', '$Username', '$Password', '$LastLogin')";
            
$result mysql_query($query);
            if (
$result)
            {
                echo <<<EOT
                Thank You
                Your signup is appreciated.
EOT;

            }
            else
            {
                echo 
mysql_error();
            }
        }
        else
        {
            echo 
mysql_error();
        }
            
        
mysql_close($con);
    }
    else
    {
        echo 
'Could not connect to database<br>';
    } 
again check there SHOULD BE NOTHING AFTER EOT;(not even space)
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-02-2005, 02:52 AM   #22 (permalink)
The Wanderer
 
Join Date: Jun 2005
Posts: 13
Thanks: 0
RogueDogg is on a distinguished road
Unhappy

Ok so I kinda get the <input type="text" FirstName="FirstName">
should be
<input type="text" name="FirstName">

Does that mean <input type="text" name="LastName"> is ok? at what point do you NOT use name?


----- ERROR START -----
Parse error: parse error, unexpected $ in /XXXX/XXXXXXXX/public_html/signup/signup.php on line 42
----- ERROR END ------

Line 42 is the last line in the script ( ?> ) GRRRR back to square one it looks like, hehe

Here's my current code:
PHP Code:
<?php
error_reporting
(E_ALL); 
    
$FirstName = (isset($_GET["FirstName"]))?mysql_escape_string($_GET["FirstName"]):'';//use this function on all the input before storing it in database 
    
$LastName = (isset($_GET["LastName"]))?mysql_escape_string($_GET["LastName"]):''
    
$Email = (isset($_GET["Email"]))?mysql_escape_string($_GET["Email"]):''
    
$Phone = (isset($_GET["Phone"]))?mysql_escape_string($_GET["Phone"]):''
    
$Address = (isset($_GET["Address"]))?mysql_escape_string($_GET["Address"]):''
    
$City = (isset($_GET["City"]))?mysql_escape_string($_GET["City"]):''
    
$State = (isset($_GET["State"]))?mysql_escape_string($_GET["State"]):''
    
$Zip = (isset($_GET["Zip"]))?mysql_escape_string($_GET["Zip"]):''
    
$Username = (isset($_GET["Username"]))?mysql_escape_string($_GET["Username"]):''
    
$Password = (isset($_GET["Password"]))?mysql_escape_string($_GET["Password"]):''
    
$LastLogin date("Y-m-d"); 
    print 
"FirstName is $FirstName<br>\n"
    print 
"Email is $Email<br>\n"

    
$con = @mysql_connect("localhost""cashflow_dbuser""dbpwd"); 
    if(
$con
    {
        if(@
mysql_select_db('cashflow_members')) 
        { 
            
$query "insert into cashflow_members.client (FirstName, LastName, Email, Phone, Address, City, State, Zip, Username, Password, LastLogin)"
             
"values('$FirstName', '$LastName', '$Email', '$Phone', '$Address', '$City', '$State', '$Zip', '$Username', '$Password', '$LastLogin')"
        
$result mysql_query($query); 
        if (
$result
        { 
            echo <<<EOT
Thank You
Your signup is appreciated.
EOT;

        else 
        { 
            echo 
mysql_error(); 
        } 
        
mysql_close($con); 
    } 
    else 
    { 
        echo 
'Could not connect to database<br>'
    } 
?>
RogueDogg is offline  
Reply With Quote
Old 06-02-2005, 02:54 AM   #23 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

ALL THE TIME, you HAVE to use name.
value can be anything. by value i mean everything after =

all fields in a form must have a name.
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-02-2005, 03:06 AM   #24 (permalink)
The Wanderer
 
Join Date: Jun 2005
Posts: 13
Thanks: 0
RogueDogg is on a distinguished road
Default

Quote:
Originally Posted by jaswinder_rana
ALL THE TIME, you HAVE to use name.
value can be anything. by value i mean everything after =

all fields in a form must have a name.
Gotcha...fixed that. See the error I'm still getting ( previous post ) :confused:
RogueDogg is offline  
Reply With Quote
Old 06-02-2005, 03:09 AM   #25 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

again did you check this part
[qutoe]
echo <<<EOT
Thank You
Your signup is appreciated.
EOT;

}
[/quote]
there should be nothing after EOT;

NOTE: after getting an answer, if you have more question then just ask it.
DO NOT modify your old post(to add new stuff), as it is difficult to notice sometimes, becuase user thinks (like me), he alrady read that part.

it was by accident that i was checkinf "WHO is active" and i saw you modifying the post. so next time jsut post your new question
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-02-2005, 03:13 AM   #26 (permalink)
The Wanderer
 
Join Date: Jun 2005
Posts: 13
Thanks: 0
RogueDogg is on a distinguished road
Default

Yeah I believe the way I have the code now is what your wanting me to have. Yeah I understand about the posting of new questions, some peeps don't like threads lasting 100 posts so they want you to modify your lastpost so I figured I'd try my luck, but I totally understand where your coming from. I will keep that in mind :)

I don't know why it makes it look like that } is after the EOT; cause it's on the next line down. hmmmmm
RogueDogg is offline  
Reply With Quote
Old 06-02-2005, 03:08 PM   #27 (permalink)
The Wanderer
 
Join Date: Jun 2005
Location: London
Posts: 7
Thanks: 0
SoftCloud is on a distinguished road
Default

WTF is EOT ???
SoftCloud is offline  
Reply With Quote
Old 06-02-2005, 03:16 PM   #28 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

EOT is NOTHING. you can use SoftCloud instead of EOT

all it does is
PHP Code:
echo <<<SoftCloud
Will print everything here.
No matter how long or length.
Don't have to worry about escaping quotes ' "
SoftCloud; 
To find it on internet, its called HEREDOC

First rule :: starting and ending name(whatever) should be SAME
Second:: Nothing should be after <<<SoftCloud (not even space)
Third:: which i myself was not aware of, nothing should be after ending SoftCloud; (not even space)

hope that helps
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-02-2005, 06:12 PM   #29 (permalink)
The Wanderer
 
Join Date: Jun 2005
Posts: 13
Thanks: 0
RogueDogg is on a distinguished road
Default

Ok I'll look at the source again to make sure....thx again for EVERYONE'S help

Should it be "print" instead of "echo"? I'm pretty sure they're both the same function right?
RogueDogg is offline  
Reply With Quote
Old 06-02-2005, 06:16 PM   #30 (permalink)
The Acquainted
 
Join Date: May 2005
Posts: 106
Thanks: 0
jaswinder_rana is on a distinguished road
Default

about what to use, i suggest you take a look here http://www.faqts.com/knowledge_base/...l/aid/1/fid/40
__________________
---------------------------
Errors = Improved Programming.
Portfolio
Send a message via MSN to jaswinder_rana
jaswinder_rana is offline  
Reply With Quote
Old 06-02-2005, 11:44 PM   #31 (permalink)
The Wanderer
 
Join Date: Jun 2005
Posts: 13
Thanks: 0
RogueDogg is on a distinguished road
Default

Thanks for the link, lots of good but confusing information there. I am at such a stand still right now....argh...I guess I'll just keep plugging away at it. I've been messing with this code all day trying tons of different things and no luck yet. :(
RogueDogg is offline  
Reply With Quote
Old 06-03-2005, 06:26 AM   #32 (permalink)
The Wanderer
 
Join Date: Jun 2005
Location: London
Posts: 7
Thanks: 0
SoftCloud is on a distinguished road
Default

Quote:
Originally Posted by jaswinder_rana
EOT is NOTHING. you can use SoftCloud instead of EOT

all it does is
PHP Code:
echo <<<SoftCloud
Will print everything here.
No matter how long or length.
Don't have to worry about escaping quotes ' "
SoftCloud; 
To find it on internet, its called HEREDOC

First rule :: starting and ending name(whatever) should be SAME
Second:: Nothing should be after <<<SoftCloud (not even space)
Third:: which i myself was not aware of, nothing should be after ending SoftCloud; (not even space)

hope that helps
Ahhhh i get ya :)
SoftCloud is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:28 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design