Jump to content

pritam79

Members
  • Content Count

    92
  • Joined

  • Last visited

Everything posted by pritam79

  1. Hi there, In the PHP tutorials here, there is PHP-AJAX tutorial as well, about bringing in more fatures in a php page with AJAX. Those have XML as well as javascript usage in them. I haven’t gone through the javascript and XML tutorials separately here in w3schools. Is there need of having some knowledge of these ( XML and javascript) first to better understand the PHP-AJAX part of the PHP tutorial of w3schools? Thanks
  2. What is the usefulness of PHP-XML and PHP-Ajax part when using PHP. What extra feature do Ajax and XML bring in a PHP site that cannot be done with PHP scripts alone? thanks
  3. pritam79

    Mail Function

    Thanks... In the PHP tutorials here I found a description of how to make an ODBC connection with an Access database, retrieving records, retrieving fields and closing an ODBC connection. What has an ODBC connection got to do while using PHP+MySQL? If a site is built with PHP+MySQL is there any need of ODBC, since we are using just MySQL? thanks
  4. pritam79

    Mail Function

    Ok, so there is no other way of testing the mail function locally except as described by you. It can be done easily on a remote mail server I guess. Is a mail server different from a normal remote web server? If the mail() function is included in a website, will the mail facility provided for the users require a separate remote mail server apart from the usual web server hosting the remaining site? Thanks.
  5. pritam79

    Mail Function

    how do i get to know whether i have a mail server running on my computer? i m using the wamp server.
  6. pritam79

    Mail Function

    I have this script which allows users to send email. Here's the script for the mail function. <html><body><?phpif (isset($_REQUEST['email']))//if "email" is filled out, send email { //send email $email = $_REQUEST['email']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; mail( "someone@example.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; }else//if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; }?></body></html> But on submitting the form, I get this output- Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\PHP\email\simple-email.php on line 13Thank you for using our mail form Do I need to make any changes in my php.ini file? The “SMTP” and "smtp_port" setting in my php.iniFile are set to “localhost” and “25” respectively
  7. pritam79

    File Upload Error

    Thanks justsomeguy, its working now
  8. pritam79

    File Upload Error

    I am running the following scripts in wamp, but i am unable to upload the selected files. The file which i am uploading is a jpeg of size 1.56 kb.This is the html form <html><body><form action="upload_file.php" method="post"enctype="multipart/form-data"><label for="file">Filename:</label><input type="file" name="file" id="file" /><br /><input type="submit" name="submit" value="Submit" /></form></body></html> This is the upload script <?phpif ((($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")|| ($_FILES["file"]["type"] == "image/pjpeg"))&& ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } }else { echo "Invalid file"; }?> After selecting a jpeg image the output i am getting is- Upload: pic.jpgType: image/jpegSize: 1.5634765625 KbTemp file: C:\wamp\tmp\phpD05E.tmpWarning: move_uploaded_file(upload/pic.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\wamp\www\eg\upload_file.php on line 25Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\wamp\tmp\phpD05E.tmp' to 'upload/pic.jpg' in C:\wamp\www\eg\upload_file.php on line 25Stored in: upload/pic.jpg I am also unable to find the uploaded image in upload/pic.jpeg. do i need to create the upload folder in tmp folder?
  9. What about using apache+windows(wamp) to develop in php and not linux+apache at all?
  10. Which is the best server among IIS and Apache to run PHP scripts? What are the potential advantages/disadvantages of running PHP in IIS and Apache?
  11. pritam79

    Coding Standards

    OK, my code above definitely has some loopholes when compared with the kind of coding standards followed in real life web programming. But if a newbie wants to build a PHP site with the coding standard above, and uploads it on the web, will that be OK or before running it successfully on the web one has to reach the standard of coding used in open source projects, like phpBB, Wordpress etc? Thanks
  12. pritam79

    Coding Standards

    So if a novice programmer writes some similar code like the one above for a site and uploads it on the web will there be any problems with the site like security, maintenance, bugs etc.? Or will the site run properly just like any other on the web?
  13. pritam79

    Coding Standards

    OK, Could you give me an example of a 'user-registration' form or something similar that meets the web standards like scripts that are used by experienced programmers developing seriously for the web.
  14. pritam79

    Coding Standards

    Hi everyone,I would like to know if programming for the web using PHP needs some language standards to be maintained. Do I need to use high end PHP scripting or simple scripting to perform the same task. What should a inexperienced programmer opt for to develop for the web? <?phpinclude "header2.php";?><div id="content"><?php//include function files for this application require("PDMS_fns.php"); // start session which may be needed later // start it now because it must go before headers session_start(); check_valid_user(); global $valid_user; if(!filled_out($_POST)) { echo "<br><br><center>You have not filled out the form completely-<a href='add_contact_form.php'>retry</a></center>."; exit; } // do the validation for email if (!valid_email($_POST['c_email'])) { echo "<br><br><center>Not a valid email address</center>"; exit; } $conn = db_connect(); if(!$conn) { echo "<br><center>Could not connect to database server- retry</center>"; exit; } $result = mysql_query("SELECT * FROM contacts WHERE username='$valid_user'"); if(!$result) { echo "<br><center>Could not execute query</center>"; exit; } // if ok put in db $result = mysql_query("INSERT into contacts(C_ID, username, first_name, last_name, c_title, company, c_email, home_phone, work_phone, cell_phone, website, street, city, state, country, zip) values('', '$valid_user','$_POST[first_name]', '$_POST[last_name]', '$_POST[c_title]', '$_POST[company]', '$_POST[c_email]', '$_POST[home_phone]', '$_POST[work_phone]', '$_POST[cell_phone]', '$_POST[website]', '$_POST[street]', '$_POST[city]', '$_POST[state]', '$_POST[country]', '$_POST[zip]')"); if(!$result) { echo "<br><br><center>Could not add-try again</center>"; exit; } if($result) { ?> <html> <body> <table align="center" style="height: 366px"> <tr> <td style="width: 491px; text-align: center; " rowspan="7"> </td> <td style="width: 732px; text-align: left; height: 54px;"><b>First name</b> : <?php echo "$_POST[first_name]";?> </td> <td style="width: 734px; text-align: left; height: 54px;"><b>Cell phone</b> : <?php echo "$_POST[cell_phone]"; ?></td> </tr> <tr> <td style="width: 732px; text-align: left; height: 54px;"><b>Last name</b> : <?php echo "$_POST[last_name]"; ?></td> <td style="width: 734px; text-align: left; height: 54px;"><b>Website</b> : <?php echo "$_POST[website]"; ?></td> </tr> <tr> <td style="width: 732px; text-align: left; height: 54px;"><b>Title</b> : <?php echo "$_POST[c_title]"; ?></td> <td style="width: 734px; text-align: left; height: 54px;"><b>Street</b> : <?php echo "$_POST[street]"; ?></td> </tr> <tr> <td style="width: 732px; text-align: left; height: 54px;"><b>Company</b> : <?php echo "$_POST[company]"; ?></td> <td style="width: 734px; text-align: left; height: 54px;"><b>City</b> : <?php echo "$_POST[city]"; ?></td> </tr> <tr> <td style="width: 732px; text-align: left; height: 54px;"><b>E-mail</b> : <?php echo "$_POST[c_email]"; ?></td> <td style="width: 734px; text-align: left; height: 54px;"><b>State</b> : <?php echo "$_POST[state]"; ?></td> </tr> <tr> <td style="width: 732px; text-align: left; height: 55px;"><b>Home phone</b> : <?php echo "$_POST[home_phone]"; ?></td> <td style="width: 734px; text-align: left; height: 55px;"><b>Country</b> : <?php echo "$_POST[country]"; ?></td> </tr> <tr> <td style="width: 732px; text-align: left; height: 55px;"><b>Work phone</b> : <?php echo "$_POST[work_phone]"; ?></td> <td style="width: 734px; text-align: left; height: 55px;"><b>Zip</b> : <?php echo "$_POST[zip]"; ?></td></tr> </table> </body> </html> <?php } else { // otherwise, provide link back, tell them to try again echo "<p><br><br><center>Addition failed- <a href='add_contact_form.php'>Retry</a></center></p>"; exit(); }?></div> Most of the sites coded in php use high end coding, i would like to know if the sites developed using simple scripting like the above code would work on the web or there is lot to be done with this simple coding. Are there any loopholes with the code.Please suggest something and the steps to be taken to use high end php coding. What is the proper learning resource one should use in order to learn and use php for the web? What are the tutorials? thanks
  15. pritam79

    Ease Of Programming

    So what should a beginning programmer (programmer for the web) start off with- ASP or PHP? One more question, there are lots of PHP tutorials available (pdf format) but they do not seem to provide all details of a language. Are those tutorials not sufficient to master any language because i have been told so?
  16. pritam79

    Asp Comparision

    Hello there, I am new to scripting languages and have done some simple stuff like forms, sessions etc and how they work in PHP. Also I went through the similar aspects of ASP. But I found the ASP programming constructs a bit difficult to master for people who have just started learning scripting languages. May be that’s not the case for experienced programmers, but I just get the feeling that PHP is easier to understand and master. Please tell me which language would be better to start off with. Thanks to all.
  17. pritam79

    Ease Of Programming

    Hello there, I am new to scripting languages and have done some simple stuff like forms, sessions etc and how they work in PHP. Also I went through the similar aspects of ASP. But I found the ASP programming constructs a bit difficult to master for people who have just started learning scripting languages. May be that’s not the case for experienced programmers, but I just get the feeling that PHP is easier to understand and master. Please tell me which language would be better to start off with. Thanks to all.
×
×
  • Create New...