Jump to content

How do I proceed further from here???


aamberker

Recommended Posts

Hi Friends, Well, with the help of "Jhecht" and "justsomeguy" I have geared-up the following URLs - * http://www.mirroremage.com/gb.html* http://www.mirroremage.com/backend.php* http://www.mirroremage.com/PHP.phpFor your kind information, I have the login details of my FTP. I am not sure but I guess the code in "backend.php" file has got messed up... whewwww!!!!...Just wondering how to proceed further and make this - http://www.mirroremage.com/gb.html in proper and and working condition...Please help.Look forward to hearing from you.Thanks.

Link to comment
Share on other sites

yeah, he did.
yeah, he did. Heyyy Buddy, where were you for so may days??? I sent you couple of PM to which you did not reply at all ... :) ... So what exactly I need to do in this CODE - $name = (isset($_POST['name'])) ? $_POST['name'] : false; $contents = (isset($_POST['comments']) ? $_POST['comments'] : false; //This checks if those 2 fields are set, if not, return false into $name; if(!$name || !$contents){ //Simple if, if the inversion of $contents or $name is true(ie, it would have to be false), die out an error die("You must submit all fields. Please, go back and fill in any fields that you may have left empty."); } $name = (get_magic_quotes_gpc()) ? $name : mysql_real_escape_string($name); $contents = (get_magic_quotes_gpc())?$contents:mysql_real_escape_string($contents); $user_ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : $HTTP_SERVER_VARS['REMOTE_ADDR']; $msa = mysql_connect('localhost','user','pass') or die("Could not connect to mysql".mysql_error()); @mysql_select_db('db',$msa) or die("Could not select Database".mysql_error()); $sql = "INSERT INTO guestbook(entry_id,entry_ip,entry_name,entry_comment) VALUES(NULL,'$user_ip','$name','$contents')"; $ans=mysql_query($sql,$msa) or die(mysql_error()." on line ".__LINE__." in file ".__FILE__); //If the script reaches here, we can assume that the query didn't mess up or die out. Redirect to wherever you want. change yourPage.html to whatever you need usleep(500); //I've noticed that unless you use usleep if you use header(location) it forces the _POST or _GET data on the relocated page; header('HEY Jhecht, WHAT DO I NEED T PLACE HERE'); //End script ---
Link to comment
Share on other sites

The location header, in your case should look like this:

header("location: gb.html");

And, umm, when you use mysql_connect(), you should replace "host", "user", and "pass" with your actual mySQL details.Don't forget to place those <?php ?> tags! :)

Link to comment
Share on other sites

The location header, in your case should look like this:
header("location: gb.html");

And, umm, when you use mysql_connect(), you should replace "host", "user", and "pass" with your actual mySQL details.Don't forget to place those <?php ?> tags! :)

Hi Synook :)Hey... Thank you so much for your response... Well, YOU MEAN LIKE THIS??? Is that okay???<?$name = (isset($_POST['name'])) ? $_POST['name'] : false; $contents = (isset($_POST['comments']) ? $_POST['comments'] : false; //This checks if those 2 fields are set, if not, return false into $name; if(!$name || !$contents){ //Simple if, if the inversion of $contents or $name is true(ie, it would have to be false), die out an error die("You must submit all fields. Please, go back and fill in any fields that you may have left empty."); } $name = (get_magic_quotes_gpc()) ? $name : mysql_real_escape_string($name); $contents = (get_magic_quotes_gpc())?$contents:mysql_real_escape_string($contents); $user_ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : $HTTP_SERVER_VARS['REMOTE_ADDR']; $msa = mysql_connect('localhost','user','pass') or die("Could not connect to mysql".mysql_error()); @mysql_select_db('db',$msa) or die("Could not select Database".mysql_error()); $sql = "INSERT INTO guestbook(entry_id,entry_ip,entry_name,entry_comment) VALUES(NULL,'$user_ip','$name','$contents')"; $ans=mysql_query($sql,$msa) or die(mysql_error()." on line ".__LINE__." in file ".__FILE__); //If the script reaches here, we can assume that the query didn't mess up or die out. Redirect to wherever you want. change yourPage.html to whatever you need usleep(500); //I've noticed that unless you use usleep if you use header(location) it forces the _POST or _GET data on the relocated page; header("location: gb.html"); //End script ---?>****************************************************************************And, umm, when you use mysql_connect(), you should replace "host", "user", and "pass" with your actual mySQL details.I didn't get that :blink: .... whewwww!!!... Please explain again :)
Link to comment
Share on other sites

It's better to use <?php instead of <?, not all servers support the short tags.Also, that code is formatted terribly. Wouldn't it be so much easier to understand if you formatted it so that a human could read it? It's just a jumble of code right now.

<?php$name = (isset($_POST['name'])) ? $_POST['name'] : false; $contents = (isset($_POST['comments']) ? $_POST['comments'] : false; //This checks if those 2 fields are set, if not, return false into $name; if(!$name || !$contents){   //Simple if, if the inversion of $contents or $name is true(ie, it would have to be false), die out an error   die("You must submit all fields. Please, go back and fill in any fields that you may have left empty."); } $name = (get_magic_quotes_gpc()) ? $name : mysql_real_escape_string($name);$contents = (get_magic_quotes_gpc()) ? $contents : mysql_real_escape_string($contents);$user_ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : $HTTP_SERVER_VARS['REMOTE_ADDR'];$msa = mysql_connect('localhost','user','pass') or die("Could not connect to mysql".mysql_error());@mysql_select_db('db',$msa) or die("Could not select Database".mysql_error());$sql = "INSERT INTO guestbook(entry_id,entry_ip,entry_name,entry_comment) VALUES(NULL,'$user_ip','$name','$contents')";$ans=mysql_query($sql,$msa) or die(mysql_error()." on line ".__LINE__." in file ".__FILE__);//If the script reaches here, we can assume that the query didn't mess up or die out. //Redirect to wherever you want. header("location: gb.html");?>

Link to comment
Share on other sites

It's better to use <?php instead of <?, not all servers support the short tags.Also, that code is formatted terribly. Wouldn't it be so much easier to understand if you formatted it so that a human could read it? It's just a jumble of code right now.
<?php$name = (isset($_POST['name'])) ? $_POST['name'] : false; $contents = (isset($_POST['comments']) ? $_POST['comments'] : false; //This checks if those 2 fields are set, if not, return false into $name; if(!$name || !$contents){   //Simple if, if the inversion of $contents or $name is true(ie, it would have to be false), die out an error   die("You must submit all fields. Please, go back and fill in any fields that you may have left empty."); } $name = (get_magic_quotes_gpc()) ? $name : mysql_real_escape_string($name);$contents = (get_magic_quotes_gpc()) ? $contents : mysql_real_escape_string($contents);$user_ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : $HTTP_SERVER_VARS['REMOTE_ADDR'];$msa = mysql_connect('localhost','user','pass') or die("Could not connect to mysql".mysql_error());@mysql_select_db('db',$msa) or die("Could not select Database".mysql_error());$sql = "INSERT INTO guestbook(entry_id,entry_ip,entry_name,entry_comment) VALUES(NULL,'$user_ip','$name','$contents')";$ans=mysql_query($sql,$msa) or die(mysql_error()." on line ".__LINE__." in file ".__FILE__);//If the script reaches here, we can assume that the query didn't mess up or die out. //Redirect to wherever you want. header("location: gb.html");?>

********************************************************************Hey justsomeguy :)Thank you so much for your response... Oh Yeah!!!... I agree that the code was formatted terribly and it was just a jumble. Now I have placed the proper format in my backend.php file and uploaded to my server. But you see, I am a newbie in all these thingys and hence no idea about how to format it so that a human could read it. Thanks a ton for organizing my code :)Well, please pull the following URLs -http://www.mirroremage.com/gb.htmlhttp://www.mirroremage.com/backend.phpYou see, when a visitor hits the Submit button after typing their "Name" and "Comments", I would like to have those 2 information underneath "oooOoooOoooOoooOoooOoooOoooOoooOoooOoooOoooO":) Now what next??? :blink:
Link to comment
Share on other sites

It will be easier to have 1 file that both shows the form and processes it, that way you can write whatever you want under the form once they submit it. Check the PHP tips thread in the PHP forum for some information about how to process forms.

Link to comment
Share on other sites

It will be easier to have 1 file that both shows the form and processes it, that way you can write whatever you want under the form once they submit it. Check the PHP tips thread in the PHP forum for some information about how to process forms.
Hi justsomeguyThank you for your response. BUT :) .... What does that mean? HELP ME DUDE :) ... hummmm... Just tell me what should be my next step??? :)
Link to comment
Share on other sites

And, umm, when you use mysql_connect(), you should replace "host", "user", and "pass" with your actual mySQL details.I didn't get that :) .... whewwww!!!... Please explain again :)
When you call mysql_connect(); the server attempts to create a connection to your mySQL server. So if your SQL server hostname was "localhost", your username was "AmitAmbe" and your password was "mySQLpassWord" then your mysql_connect would look like
$msa = mysql_connect("localhost", "AmitAmbe", "mySQLpassWord");

What JustSomeGuy is saying is that it is easier to dispense with backend.php and just have gb.html (or gb.php as it would now be called). Start copying and pasting :) and change the forms action.

Link to comment
Share on other sites

When you call mysql_connect(); the server attempts to create a connection to your mySQL server. So if your SQL server hostname was "localhost", your username was "AmitAmbe" and your password was "mySQLpassWord" then your mysql_connect would look like
$msa = mysql_connect("localhost", "AmitAmbe", "mySQLpassWord");

What JustSomeGuy is saying is that it is easier to dispense with backend.php and just have gb.html (or gb.php as it would now be called). Start copying and pasting :) and change the forms action.

*****************************************************************Heyyy Synook :blink:Thanks a ton for your response!!!... Well,When you call mysql_connect(); the server attempts to create a connection to your mySQL server. So if your SQL server hostname was "localhost", your username was "AmitAmbe" and your password was "mySQLpassWord" then your mysql_connect would look like$msa = mysql_connect("localhost", "AmitAmbe", "mySQLpassWord");Yupieee Yup!!!!... Alrightyyy!!!!... I got that BUTTT.... WHERE DO I NEED TO INCORPORATE THE FOLLOWING CODE :lol::$msa = mysql_connect("localhost", "AmitAmbe", "mySQLpassWord");hummmm... Let me guess something... Will that be in my backend.php code??? :) ORR??? :)What JustSomeGuy is saying is that it is easier to dispense with backend.php and just have gb.html (or gb.php as it would now be called). Start copying and pasting and change the forms action.OHH!!!... I think I got that :) Thank you so much :blink: ... BUT AS OF NOW, I WOULD LIKE TO HAVE AS "gb.html" AND "backend.php" SINCE I AM FEELING COMFORTABLE WITH IT... Well, so where should I place this ???? :) $msa = mysql_connect("localhost", "AmitAmbe", "mySQLpassWord");It seems to be "Jhecht" doesn't want to help me :(
Link to comment
Share on other sites

Just tell me what should be my next step???
Your next step needs to be to read the tutorials and learn how to do this for yourself, that's what we are trying to do. We're trying to teach you how to do this, not do it for you, that's not what this forum is here for. All the information you need to answer all of the questions that you have asked can be found in the PHP tutorial on the w3schools site and some extra information in the PHP tips thread of this forum. You need to read through that until you understand it and then you will be able to answer your own questions. You might be "comfortable" with having an HTML page and a PHP page, but you won't be able to do what you want with those pages.
Link to comment
Share on other sites

Well, so where should I place this ????
I'm sure "AmitAmbe" and "mySQLpassWord" aren't your real SQL login details but anyway... replace the
$msa = mysql_connect('localhost','user','pass') or die("Could not connect to mysql".mysql_error());

bit with your own user information.

Link to comment
Share on other sites

Your next step needs to be to read the tutorials and learn how to do this for yourself, that's what we are trying to do. We're trying to teach you how to do this, not do it for you, that's not what this forum is here for. All the information you need to answer all of the questions that you have asked can be found in the PHP tutorial on the w3schools site and some extra information in the PHP tips thread of this forum. You need to read through that until you understand it and then you will be able to answer your own questions. You might be "comfortable" with having an HTML page and a PHP page, but you won't be able to do what you want with those pages.
Heyy justsomeguy... It's tooooo difficult to understand buddy :) ... And hence I don't prefer to read them :) .. Oh Yeah!!!.. I understand that ALL YOU WONDERFUL FRIENDS ARE trying to teach me how to do this AND INDEED I AM LEARINING as per your feedbackS... :)
Link to comment
Share on other sites

No, Jhecht has just started school. I dont have much free time as of right now.
Ohh!!!... hummmm... Okay!!!.. Thank you for letting me know that Jhecht has started school and don't have much free time now... No Worries!!!!... There are other people who are trying to reach me about how to finalize my "gb.html" page :) ... IF POSSIBLE AND IF YOU CAN... DO HELP ME!!!... Thanks :)
Link to comment
Share on other sites

I'm sure "AmitAmbe" and "mySQLpassWord" aren't your real SQL login details but anyway... replace the
$msa = mysql_connect('localhost','user','pass') or die("Could not connect to mysql".mysql_error());

bit with your own user information.

Hey Synook :) ... I think I got it... hummmm... The code is in my backend.php :) ... Okayy!!!!... Will do the changes tonight... Thank you buddy... :)
Link to comment
Share on other sites

Hey Synook :) ... I think I got it... hummmm... The code is in my backend.php :) ... Okayy!!!!... Will do the changes tonight... Thank you buddy... :)
Hi All,ONE BAD NEWS!!!... :blink: …. My server doesn’t support Mysql :blink: ... whewww!!!... In other words, my service provider has not given Mysql localhost, user ID and password :) ... BUT IT DOES SUPPORT “PHP  Is there any other way to proceed further???Please help...Look forward to hearing from you...
Link to comment
Share on other sites

you are going to need to chmod your directory to 777(or 0777 depending on how you do it) in order to make sure that you have access to a file. Create a file named "data.[choose any extension, it doesnt matter]" and then you should look up some tutorials about flat file database systems.

Link to comment
Share on other sites

My server doesn't support Mysql :)
Uh oh. Best plan of course: get a different host. Second-best plan: bug your server admins until they install mySQL.
Link to comment
Share on other sites

you are going to need to chmod your directory to 777(or 0777 depending on how you do it) in order to make sure that you have access to a file. Create a file named "data.[choose any extension, it doesnt matter]" and then you should look up some tutorials about flat file database systems.
Heyyy Jhecht :)So nice to hearing from you... Thanks for your response... But what exactly does that mean??? :) I didn't get you... whewwww.... Hey... Does it makes sense to make as gb.php instead of gb.html??? If yup... How do I make convert the following HTML code into PHP??? :) *********************************************<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><form id="form1" name="form1" method="post" action="backend.php"> <table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="92">Name:</td> <td width="408"><input name="name" type="text" id="name" /></td> </tr> <tr> <td valign="top">Comments:</td> <td><textarea name="comments" rows="5" id="comments"></textarea></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit" />   |   <input name="reset" type="reset" id="reset" value="Reset" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td>oooOoooOoooOoooOoooOoooOoooOoooOoooOoooOoooO</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table></form></body></html>*********************************************
Link to comment
Share on other sites

Uh oh. Best plan of course: get a different host. Second-best plan: bug your server admins until they install mySQL.
Hey Synook,You see, I cannot get a different host now since it's with my cousin brother and hence I need not have to pay anything for my hosting plan :) .. But yeah!!!.. I need to pay for my Domain since it's with differeng company... Heyyy... I cannot bug my server admin since it's a "Win Server" :) ... :) ... Does it makes sense to make as gb.php instead of gb.html??? If yup... How do I convert my HTML code into PHP??? :blink:
Link to comment
Share on other sites

You don't need to convert anything currently in gb.html into PHP to make it gb.php, you just change your extension. What you need to do is copy the backend.php code into gb.php where you want the text to appear, and modify it so that is does what you want it to do. I have a challenge for you :) try to do it all by yourself.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...