Jump to content

nysmenu

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nysmenu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What exactly are you getting in your inbox?
  2. This seems to be working and now I'm getting this: This is not my script, therefore, I do not know what "(tmp/tmp.jpg)" this is.
  3. Guys, I have this scrip to send images into a db. the problem is that it won't post into the db. Can someone please show me what I'm doing wrong. Thanks <?php $cn = mysql_connect("localhost","pass","pass"); mysql_select_db("db_image",$cn); if ($act=='view'){ $sql="SELECT * FROM tbl_image where id=$id"; $rst=mysql_query($sql) or die('sorry'); $data=mysql_fetch_array($rst); $type=$data[type]; Header("Content-type: $type"); echo $data[image]; } if ($act=='del'){ $sql="DELETE FROM tbl_image where id=$id"; $rst=mysql_query($sql) or die('sorry'); } if($submit) { $type = $_FILES['file']['type']; copy ($_FILES['file']['tmp_name'], "tmp/tmp.jpg") or die ("Could not copy"); $filer="tmp/tmp.jpg"; $handle = fopen($filer, "r"); $pure = addslashes(fread($handle, filesize($filer))); $sql = "insert into tbl_image(image,type) values('$pure','$type')"; $result = mysql_query($sql,$cn)or die(mysql_error()); } $sql="SELECT * FROM tbl_image"; $rst=mysql_query($sql) or die('sorry'); while ($data=mysql_fetch_array($rst)){ $id=$data[id]; echo "picture no $id <a href='./image.php?act=del&id=$id'>delete</a><br><img src='./image.php?act=view&id=$id'><br><br>"; } ?>
  4. I don't get it. Isn't WAMP a local server? This is happening on the remote server. do I still need to change in PHP_ini?
  5. And this is what I keep getting: 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 D:\hosting\member\car4students\c4site\testing.php on line 12 Message delivery failed...
  6. Hi L or anyone else, I spoke to my server. (not much help) However, they said I needed to integrate the script to work with the contact page. My problem is that I'm fairly new to this and there are some things I just don't understand still. This is the first time using a server that requires SMTP auth. Would you be so kind and point me in the right direction? I have been fighting with this thing for 2 days already. Thank you. this is what I did: <?php $to = "info@car4students.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $message, $email)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> <?php require("class.phpmailer.php"); $mail = new PHPMailer();$mail = new PHPMailer(); $mail->CharSet ="utf-8"; // You can adjust the Charset according to your language $mail->IsSMTP(); $mail->Host = "mail.car4students.com"; $mail->From="sales@car4students.com"; //REMEMBER, this MUST be same as your authorization email address above. $mail->FromName="My site's mailer"; $mail->SMTPAuth = true; $mail->Username = "info@car4students.com"; $mail->Password = "pass"; ?>
  7. Thanks L. I tried it and this is what I get: 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 D:\hosting\member\car4students\c4site\test.php on line 27 Message delivery failed... Error sending: You must provide at least one mailer is not supported.
  8. Hi, I was wondering if someone can help me please. I have this form set up called "contact" and the sending script is sending e-mails into my inbox but, it's not posting any information. Would someone please advice on what I'm doing wrong? Thanks. Here's the form: <form id="form1" name="form1" method="post" action="testing.php"> <table width="552" border="0" align="left"> <tr> <th width="110" align="left" scope="col">Name:</th> <th width="432" align="left" scope="col"><label for="name"></label> <label for="name4"></label> <input name="name" type="text" class="name1" id="name4" /> <label for="name2"></label></th> </tr> <tr> <th align="left" scope="col">Last name:</th> <th align="left" scope="col"><label for="lname"></label> <input name="lname" type="text" class="lname" id="lname" /></th> </tr> <tr> <th align="left" scope="col">E-mail:</th> <th align="left" scope="col"><label for="email"></label> <input name="email" type="text" class="email" id="email" /></th> </tr> <tr> <th align="left" scope="col">School:</th> <th align="left" scope="col"><label for="school"></label> <input name="school" type="text" class="school" id="school" /></th> </tr> <tr> <th align="left" scope="col">Message:</th> <th align="left" scope="col"><label for="message"></label> <textarea name="message" cols="45" rows="5" class="message" id="message"></textarea></th> </tr> <tr> <th align="left" scope="col">Insert code ></th> <th align="left" scope="col"><table width="414" border="0" cellspacing="5"> <tr> <th width="52" align="left" scope="col"><img id="captcha" src="securimage/securimage_show.php" alt="CAPTCHA Image" /> </th> <th width="117" align="left" valign="bottom" scope="col"><input name="captcha_code" type="text" class="captcha" size="15" maxlength="6" /> </th> <th width="219" align="left" scope="col"><a href="#" onclick="document.getElementById('captcha').src = 'securimage/securimage_show.php?' + Math.random(); return false">Reload Image</a> </th> </tr> </table></th> </tr> <tr> <th align="left" scope="col"> </th> <th align="left" scope="col"><label for="submit"></label> <input type="submit" name="submit" id="submit" value="Submit" /></th> </tr> </table> </form> and here's the sendingscript: <?php // Where to redirect after form is processed. $url = 'http://www.car4students.com/contact.php'; require("class.phpmailer.php"); $mail = new PHPMailer();$mail = new PHPMailer(); $mail->CharSet ="utf-8"; // You can adjust the Charset according to your language $mail->IsSMTP(); $mail->Host = "mail.car4students.com"; $mail->From="info@car4students.com"; //REMEMBER, this MUST be same as your authorization email address above. $mail->FromName="Contact Page"; $mail->SMTPAuth = true; $mail->Username = "info@car4students.com"; $mail->Password = "pass"; $mail->AddAddress("info@car4students.com"); $mail->name="louie"; $mail->subject = "Test 1"; $mail->body = "Test 1 of PHPMailer."; if(!$mail->Send()) { echo "Error sending: " . $mail->ErrorInfo;; } else { echo "E-mail sent"; echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; }?> Notice, I removed the captcha feature from the sending script as it is not a part of the script. Thanks
  9. Thanks Aviavi, but this is the script we are talking about.
  10. Thanks, I did like you said and still getting the same error. This script is weird, no matter what I do to it, it'll always come out with the same error. I tried without including a password and still the same error. You don't have a working code do you? I'm behind on this site and I can't find a solution. the other code I used (see it below) shows all the pages but , when view from page to page it'll always come back with the same info. <?php $username="pass"; $password="pass"; $database="mysql"; $dbh=mysql_connect(localhost,$username,$password) or die ('I cannot connect to the database because: ' . mysql_error()); @mysql_select_db($database); $result = mysql_query("SELECT COUNT(*) AS total_entries FROM help_topic") or die(mysql_error()); $row = mysql_fetch_row($result); $total_entries = $row[0]; $entries_per_page = 25; if(isset($_GET['currentpage'])) { $page_number = $_GET['currentpage']; } else { $page_number = 1; } $total_pages = ceil($total_entries / $entries_per_page); $offset = ($page_number - 1) * $entries_per_page; $result = mysql_query("SELECT * FROM help_topic LIMIT $offset, $entries_per_page") or die(mysql_error()); while($obj = mysql_fetch_array($result)) { // Display the data however you want here. print $obj ['url']; echo "<br>"; } for($i = 1; $i <= $total_pages; $i++) { if($i == $page_number) { // This is the current page. Don't make it a link. print "$i "; }else { // This is not the current page. Make it a link. print "<a href=\"untitled-1.php?page_number=$i\">$i</a> "; } } ?>
  11. Hi, I've used this script designed by CV and for some reason I can not get it to work. This is what i keep getting and I can't find a solution. Parse error: syntax error, unexpected T_DNUMBER in C:\wamp\www\websites\sun\Untitled-5.php on line 10 Has anyone ever been successful with this script? I need a script for a site I am building and can't seem to get one working correctly. Can someone please help. Thanks 1. <?php 2. // database connection info 3. $conn = mysql_connect('localhost','pass','pass') or trigger_error("SQL", E_USER_ERROR); 4. $db = mysql_select_db('mysql',$conn) or trigger_error("SQL", E_USER_ERROR); 5. 6. // find out how many rows are in the table 7. $sql = "SELECT COUNT(*) FROM hot_topic"; 8. $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); 9. $r = mysql_fetch_row($result); 10. $numrows = $r[0]; 11. 12. // number of rows to show per page 13. $rowsperpage = 10; 14. // find out total pages 15. $totalpages = ceil($numrows / $rowsperpage); 16. 17. // get the current page or set a default 18. if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { 19. // cast var as int 20. $currentpage = (int) $_GET['currentpage']; 21. } else { 22. // default page num 23. $currentpage = 1; 24. } // end if 25. 26. // if current page is greater than total pages... 27. if ($currentpage > $totalpages) { 28. // set current page to last page 29. $currentpage = $totalpages; 30. } // end if 31. // if current page is less than first page... 32. if ($currentpage < 1) { 33. // set current page to first page 34. $currentpage = 1; 35. } // end if 36. 37. // the offset of the list, based on current page 38. $offset = ($currentpage - 1) * $rowsperpage; 39. 40. // get the info from the db 41. $sql = "SELECT id, url FROM hot_topic LIMIT $offset, $rowsperpage"; 42. $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); 43. 44. // while there are rows to be fetched... 45. while ($list = mysql_fetch_assoc($result)) { 46. // echo data 47. echo $list['id'] . " : " . $list['url'] . "<br />"; 48. } // end while 49. 50. /****** build the pagination links ******/ 51. // range of num links to show 52. $range = 3; 53. 54. // if not on page 1, don't show back links 55. if ($currentpage > 1) { 56. // show << link to go back to page 1 57. echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; 58. // get previous page num 59. $prevpage = $currentpage - 1; 60. // show < link to go back to 1 page 61. echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; 62. } // end if 63. 64. // loop to show links to range of pages around current page 65. for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { 66. // if it's a valid page number... 67. if (($x > 0) && ($x <= $totalpages)) { 68. // if we're on current page... 69. if ($x == $currentpage) { 70. // 'highlight' it but don't make a link 71. echo " [<b>$x</b>] "; 72. // if not current page... 73. } else { 74. // make it a link 75. echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; 76. } // end else 77. } // end if 78. } // end for 79. 80. // if not on last page, show forward and last page links 81. if ($currentpage != $totalpages) { 82. // get next page 83. $nextpage = $currentpage + 1; 84. // echo forward link for next page 85. echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; 86. // echo forward link for lastpage 87. echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; 88. } // end if 89. /****** end build pagination links ******/ 90. ?>
  12. O,K, I got the code to work. One problem, I am not getting new info from page to page. Any suggestions? Thanks
  13. O.K. that part I understand, but I still do not understand where and how to include.
  14. Thank you for your reply. I had found that tutorial already, unfortunately I don't quite understand this too well. I tried using the script CV posted but I couldn't get it to work. I found the one I need help on but I can't figure out some things. Someone else posted a comment on CV's script similar to my problem and CV answered it with this: Just wrap a condition around the whole pagination section. if ($result > 0) { // pagination section here } I don't understand what to include in there or where. Can someone show me please? Thanks
  15. Hi, I am new at PHP. I need to make a pagination on my site and here's a code that seems to be working but when I go into different pages I get a message that says "page not found". Can someone please help me with this. Thanks. <?php $username="pass"; $password="pass"; $database="mysql"; $dbh=mysql_connect(localhost,$username,$password) or die ('I cannot connect to the database because: ' . mysql_error()); @mysql_select_db($database); $result = mysql_query("SELECT COUNT(*) AS total_entries FROM help_topic") or die(mysql_error()); $row = mysql_fetch_row($result); $total_entries = $row[0]; $entries_per_page = 25; if(isset($_GET['currentpage'])) { $page_number = $_GET['currentpage']; } else { $page_number = 1; } $total_pages = ceil($total_entries / $entries_per_page); $offset = ($page_number - 1) * $entries_per_page; $result = mysql_query("SELECT * FROM help_topic LIMIT $offset, $entries_per_page") or die(mysql_error()); while($obj = mysql_fetch_array($result)) { // Display the data however you want here. print $obj ['url']; echo "<br>"; } for($i = 1; $i <= $total_pages; $i++) { if($i == $page_number) { // This is the current page. Don't make it a link. print "$i "; }else { // This is not the current page. Make it a link. print "<a href=\"untitled.php?page_number=$i\">$i</a> "; } } ?> The first page shows this on the bar: http://localhost/websites/sun/Untitled-1.php which is good bu the other pages show this: http://localhost/websites/sun/untitled.php?page_number=2 Not Found The requested URL /websites/sun/untitled.php was not found on this server. I really appreciate your help...
×
×
  • 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.