Jump to content

mark103

Members
  • Posts

    268
  • Joined

  • Last visited

Everything posted by mark103

  1. Hi guys, I need your help. I am using the code below to send email via using with php, however, I can't be able to remove the mailed-by hostname which is something like: server01.domain.com. Here's the screenshot: Here's the code: if(isset($name)) { $name = $_GET['name']; $headers = "From: "-f .$name."@myemail.com"; $to = "myname@myemail.com"; $subject = $type; $message = $comments . ' ' . $rate; $header = "From: Your Name <tester@email.org>\l\n"; $header .= "Reply-To: no answer <myname@myemail.com>\l\n"; $header .= "Return-Path: tester@email.org\l\n"; $header .= "Envelope-from: tester@email.org\l\n"; $header .= "MIME-Version: 1.0\l\n"; $header .= "Content-Type: text/html\l\n"; mail($to, "test", "hello,how r u today? I'm a Noobie", $header); echo "Thank you for sent us your feedback"; When I use the code on above, the mailed-by hostname did not get removed. I want to remove it so I can send email to my clients for update email newsletters, registering form...etc Anyone who know how to remove the mailed-by hostname would be much appreciate. Thanks, Mark
  2. Not that one I mean, I said that how I can change the Mailed-by hostname to my own hostname? Don't you know what mailed-by header suppose to mean? if you are not sure, check it here: http://bbpress.org/forums/topic/php-mail...e-hostname And this: http://discussion.dreamhost.com/thread-100033.html If you get this, then do you know how I can change the hostname to my own mailed-by hostname?
  3. Thanks Ken, and the last thing I need is how can I modify the mailed-by header? I get something is like: myservername.com I want to change the mailed-by header from 'myservername.com' to 'myownservername.com' How I can could modify for mailed-by header?
  4. Thanks Ken, so three things that I need to make some changes on here: $headers = "From: tester@myemail.com"; how do I extract the value from the $name method to input them into the $headers? Something is like this: $headers = "From: ($_GET['name']) & ""@myemail.com""; As for this line, I am trying to extract the values from $rate and $comments into $message method. How I could do that?? $message = $comments && $rate; As well, how can I modify the mailed-by header? I want to change the mailed-by header from 'myservername.com' to 'myownservername.com'
  5. Thanks ken, I have fixed all of the problems which I have removed the extra single quote in some lines. However, could you please help me with this: if(isset($name)) { $to = "myemail@myemail.com"; $subject = $type; $message = $comments & $rate; $headers = "tester@myemail.com"; mail($to, $subject, $message, $headers); echo "Thank you for sent us your feedback"; } else { if(isset($email)) { $to = "myemail@email.com"; $subject = $type; $message = $comments && $rate; $headers = $email; mail($to, $subject, $message, $headers); } I have problem with some of the methods included the $headers and $message. How can I get the headers to included with the email where it have came from, e.g: tester@myemail.com. I have only get myname@infinity.nameserver.com. how can i included something are like "tester@myemail.com" and how can I included the $comments and $rate into the email body?
  6. You have choose the incorrect line. The line 69 is here: $message = '$comments, $rate'; I don't know where the problem is. Do you know where the problem is and what I should get rid of?
  7. Hello guys, I have a problem with the php, I have got an parse error, the error is: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/myuser/public_html/mysite.com/email.php on line 69 <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'user'); define('DB_PASSWORD', 'pass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $name = clean($_GET['name']); $email = clean($_GET['email']); $comments = clean($_GET['comments']); $rate = clean($_GET['rate']); if($name == '') { $errmsg_arr[] = 'name or member ID missing'; $errflag = true; } else { } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['name'])) { $insert[] = 'member_or_from = \'' . clean($_GET['name']) .'\''; // echo "tested"; } if(isset($_GET['email'])) { $insert[] = 'email_address = \'' . clean($_GET['email']) . '\''; } if(isset($_GET['comments'])) { $insert[] = 'comments = \'' . clean($_GET['comments']) . '\''; } if(isset($_GET['rate'])) { $insert[] = 'rate = \'' . clean($_GET['rate']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); if(isset($name)) { $to = "myemail@myemail.com"; $subject = $type'; $message = '$comments', '$rate'; $headers = 'From: $name '@myemail.com'' mail($to, $subject, $message, $headers); } else { $to = "myemail@myemail.com"; $subject = $type'; $message = '$comments', '$rate'; $headers = 'From: $email' mail($to, $subject, $message, $headers); if (!mysql_query($sql,$link)) { die('Error: ' . mysql_error()); } echo "Thank you for sent us the feedback"; } } } ?> I don't know where it went wrong in line 69. Please could any of you help me to correct the problem I am getting?? Any advise would be much appreciate.
  8. well I mean when I input the username into 'user=test' and password into 'pass=whatever' then extract the data from mysql and print them out in the php page. i tried this: if ($username == "") And this: if(isset($username) && isset($password)) { I keep getting the blank page when I have included the data into 'user' and 'pass'. I need to check with the if variable that if I included the 'user' and 'pass' method then extract the data from the database. Hope you can help me with this.
  9. well i mean that if i input the data of the username and password using with $username and $password method, then do something. no, it doesn't work. I keep getting blank page. Any idea?
  10. please can someone help????????????????
  11. Thanks Mike, I can see the problem is being fixed. However, I need your help with the if variable. I want to check with the if variable that if I have included the 'user' and 'pass' method. Something like this? if($username,$password) { $query = "SELECT firstname, lastname, email_address FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($query) or die('Error:<br />' . $qry . '<br />' . mysql_error()); echo "<p id='myfirstname'>"; echo $row['firstname'] . "</p>"; echo "<p id='mylastname'>"; echo $row['lastname'] . "</p>"; echo "<p id='email_address'>"; echo $row['email_address'] . "</p>"; } else { When I input the username and password, I get the blank page. Not sure if the if variable is correct. Any idea?
  12. Hi guys, I have a problem with the print out method. I have got a warning implode, I have tried to get passed with the invalid arguments, but I keep getting this in nowhere I can find any situations. however I am still getting this: Warning: implode() [function.implode]: Invalid arguments passed in /home/mysite/public_html/mysite.com/members.php on line 82 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where username='test' and passwd='test'' at line 1 here's line 82: if ($names = implode(',',$insert)) { And here's the update code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myuser'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $firstname = clean($_GET['firstname']); //variable in the url you posted was firstname, not value. $lastname = clean($_GET['lastname']); $email = clean($_GET['email_address']); if($username == '') { $errmsg_arr[] = 'username ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD ID missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $query = "SELECT firstname, lastname, email_address FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($query) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<p id='myfirstname'>"; echo $row['firstname'] . "</p>"; echo "<p id='mylastname'>"; echo $row['lastname'] . "</p>"; echo "<p id='email_address'>"; echo $row['email_address'] . "</p>"; } $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password' AND firstname='$firstname' AND lastname='$lastname'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result) > 0) { $row = mysql_fetch_row($result); // echo "The information have already been updated in the database"; } else { if(isset($_GET['firstname'])) { $insert[] = 'firstname = \'' . clean($_GET['firstname']) .'\''; } if(isset($_GET['lastname'])) { $insert[] = 'lastname = \'' . clean($_GET['lastname']) . '\''; } if(isset($_GET['email_address'])) { $insert[] = 'email_address = \'' . clean($_GET['email_address']) . '\''; } if ($names = implode(',',$insert)) { // $names = implode(',',$insert); } else { $sql="UPDATE members SET {$names} where username='{$username}' and passwd='{$password}'"; if (!mysql_query($sql,$link)) { die('Error: ' . mysql_error()); } echo "The information have been updated"; } } } ?> Can someone help me how to ignore the warning implode when I did not included the $name method??
  13. thanks so what do you mean by "Assign it to variable"?
  14. Hi guys I would like one of you to help me. I have a bit of trouble with the echo, where I don't want to print out on the php page. The echo that I don't want to print out on my page is "The information have already been updated in the database". I don't want to get rid of them, but I want to hide them in the php unless I update some information using with the methods through $username and $name. Here's the code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myuser'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $user = clean($_GET['user']); $image = clean($_GET['image']); $name = clean($_GET['name']); if($username == '') { $errmsg_arr[] = 'username ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD ID missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result) > 0) { $qrytable1="SELECT id, image, name FROM favorites WHERE username='$username'"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); $row = mysql_fetch_row($result); echo "The information have already been updated in the database"; } else { if(isset($_GET['user'])) { $insert[] = 'username = \'' . clean($_GET['user']) .'\''; } if(isset($_GET['image'])) { $insert[] = 'image = \'' . clean($_GET['image']) . '\''; } if(isset($_GET['name'])) { $insert[] = 'name = \'' . clean($_GET['name']) . '\''; } $names = implode(',',$insert); $sql = "INSERT INTO favorites (username, image, name) VALUES ('$user','$image','$name')"; if (!mysql_query($sql,$link)) { die('<br>Error: ' . mysql_error() . "<br>Query: $sql" ); } echo "The information have been updated."; } while ($row = mysql_fetch_array($result1)) { echo "<p id='image'>"; echo $row['image'] . "</p>"; echo "<p id='name'>"; echo $row['name'] . "</p>"; echo '<p id="delete"> <a href="delete.php?id='.$row['id'].'">Delete</a></td>'; } } ?> Any advise would be much appreicate. Thanks, Mark
  15. Thanks for your help. This time I get a different error. Error: Column count doesn't match value count at row 1 Query: INSERT INTO user_banned_list (username, email, IP_domain) VALUES('','') Here's the update code: $sql = "INSERT INTO members (username, email, ip) VALUES('','$_GET[names]')";
  16. Here it's: Error: Column count doesn't match value count at row 1 Query: INSERT INTO member (username, email, IP) VALUES('','','','') And here's the update code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbusername'); define('DB_PASSWORD', 'mydbpassword'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $adduser = clean($_GET['adduser']); $email = clean($_GET['email']); $IP = clean($_GET['ip']); if($username == '') { $errmsg_arr[] = 'username is missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD is missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { if(isset($_GET['adduser'])) { $insert[] = 'username = \'' . clean($_GET['adduser']) .'\''; } if(isset($_GET['email'])) { $insert[] = 'email = \'' . clean($_GET['email']) . '\''; } if(isset($_GET['ip'])) { $insert[] = 'ip = \'' . clean($_GET['ip']) . '\''; } $names = implode(',',$insert); $sql="INSERT INTO members (username, email, ip) VALUES('','$_POST[adduser]','$_POST[email]','$_POST[ip]')"; if (!mysql_query($sql,$link)) { die('<br>Error: ' . mysql_error() . "<br>Query: $sql" ); } echo "The information have been updated"; } } ?>
  17. The same one I has Error: Column count doesn't match value count at row 1
  18. Hi guys, I need your help. I am trying to insert the rows in the mysql database as I input the values in the url bar which it would be like this: www.mysite.com/testupdate.php?user=tester&pass=test&user1=tester&email=me@shitmail.com&ip=myisp However i have got a error which i don't know how to fix it. Error: Column count doesn't match value count at row 1 <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbusername'); define('DB_PASSWORD', 'mydbpassword'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); $adduser = clean($_GET['user1']); $email = clean($_GET['email']); $IP = clean($_GET['ip']); if($username == '') { $errmsg_arr[] = 'username is missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD is missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $sql = "INSERT INTO `members` (`username`,`email`,`IP`) VALUES ('$adduser','$email','$IP')"; if (!mysql_query($sql,$link)) { die('Error: ' . mysql_error()); } echo "The information have been updated."; } ?> Here's the name of the columns i have got in my database: username email IP I have input the correct columns names, so I can't correct the problem I am getting. Please can you help?
  19. Thanks for your help. I have fixed the problem. However I am getting an error: Parse error: syntax error, unexpected T_ELSE in /home/username/public_html/mysite.com/myscript.php on line 30 Here it is the line 30: else { And here's the full code: <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'username'); define('DB_PASSWORD', 'password'); define('DB_DATABASE', 'databasename'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $datastrings = clean($_GET['strings1']); if($encryption == 'thestrings') { echo "<p id='strings1'>"; echo $row['strings1'] . "</p>"; else { } $URL="http://www.google.com"; header ("Location: $URL"); } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $query = "SELECT data_strings FROM table1"; $result=mysql_query($query) or die('Error:<br />' . $qry . '<br />' . mysql_error()); } } ?> Do you know why I am getting an error?
  20. Hey guys, I need your help. It took me hours to try and fix the problem as I am still trying to get the data from the mysql database to print into the php page, but I keep getting the error message of the array which it said "data is not found". <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'username'); define('DB_PASSWORD', 'password'); define('DB_DATABASE', 'databasename'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $datastrings = clean($_GET['strings1']); if($datastrings== '') { $errmsg_arr[] = 'data is not found'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $query = "SELECT data_strings FROM table1"; $result=mysql_query($query) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<p id='data1'>"; echo $row['data1'] . "</p>"; } } ?> I am sure that the column in the database are valid. The name of the column is data_strings and the table name is called table1. Any idea why I keep getting the error message of the array?
  21. Thanks, I have fixed the problem. However, I am getting an parse error with unexpected T_VARIABLE in /home/username/public_html/mysite.com/delete.php on line 19 Here it the line 19: $deleted = mysql_affected_rows(); Any idea?
  22. You still haven't connected to the database. Ken I know that I still haven't connected to the database. In which line I need to change it with?
×
×
  • 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.