-
Posts
579 -
Joined
-
Last visited
Posts posted by Drongo_III
-
-
Hi guys
I hope someone can help me with an php mail issue as server setup is something i dont know very much about.
I have a simple form on a client's website that sends its output via the php mail() function.
The website's domain is hosted externally. They have pointed the A and @ records to my server and their MX records are set elsehwere and point to an external mail server.
The issue is the form outputs works perfectly on my own email addresses but not on the client's email. At first i assumed my messages were getting spammed on the client's side but it has been confirmed that this is not the case.
When i check the zone file on my server it has a default mx record setup as "theirsite.com.". And when i check the 'email delivery route' in cpanel it tells me it's directing locally to theirsite.com.
I assume this is incorrect and it should actually be pointing externally. Am i right in thinking i need to setup the zone file to point at their external mail servers and this will correct the issue with delivering off the mail() function?
Any advice is very gratefully received!
Drongo
-
If you didnt want to send the user to another page you could set the form's action to '#' which would keep them on the page. Then you could have some logic in your page to check if the form was submitted and if it was it could run whatever login function you have to verify the user. Then if they are logged in you could have some further logic to include admin elements on the current page.
Something along those lines.
Or you could use ajax to post to the login function and then refresh the page - but you would need to use header again for that
But as suggested i would stick with using headers because this is just unecessarily complicating things
-
i dont quite see how the value of $received is being assigned?
You are adding it's value to$data and then echoing out $received - but why would that display your new value?
try this to test it
foreach($row['received'] as &$data) { $data += $received; echo $data; echo "<br/>"; } print_r($row['received']);
Also you need to pass data by reference or it wont change outside of the loop.
-
If you need any more help just yell!
Great, thanks. I shall take a look at a client side approach.
-
This is really more client side to be honest.
You just need some jquery and some logic within your jquery.
specifically you'll use the .change() function to register when a new selection has been made (i.e. from your drop down) and this would fire off the code for the new piece of the form you want to display.
This should point you in the right direction - http://api.jquery.com/change/
You could of course load the form elements using ajax but i cant exactly see why it would be worth sapping server resources for soemthing that can be done client side
Hey everyone,
I am looking to create an advanced contact form but need someone to point me in the right direction.
I need to create a customer service form and would like it to contain the usual fields e.g. Name, Email etc. but also want to include a drop down field which has a couple of options e.g. Sales Enquiry, Order Status etc.
Once one of those options has been selected e.g. Order Status, I then want a further section of the form to appear where the user can input data such as their order number, order date etc.
Does anyone have any ideas on how to achieve this or know of any demos/scripts which they think might help.
-
The effect of white space is so infinitesimal that you really need never worry about it!
it's better to produce readable code than bunch everything up to save a few thousandths of a millisecond...
My two pennies...
Do I really have to care about the amount of spaces/tabs I have in my program?
Is my code good? Example:
class SportListout{ public $start; public $db; private $junk = 'This is junk data. Unable to find it \'s parents. It is recommended that you delete this data.'; function __construct($db){ $this -> db = $db; $this -> setStartingParent(); } function searchListout($sp){ $notif = 'There are no search results that match that criteria.'; if(strlen($sp) > 0){ if(strlen($sp) < 3){
This is my common text format. Is this ok or should I not make spaces in between functions?
-
Can see that being a problem. If your boss is happy with the approach of adding 'read' message IDs to a field in the users table i can't see an issue with flipping it round and adding 'unread' IDs. So everytime a new message is created then it would add it's ID to the users table. Once they view and click "don't show, or whatever, you remove the ID from the user's table.
As far as standard practice I am not entirely sure. Haven't really built this into anything i've worked on but as always there are about ten ways to get to the same end goal and this sounds fairly reasonable.
Cool ok thank you. That makes sense. However in this case the administrator comes along and adds say a message saying
"there have been changes to our terms click here to close"
the ID of that message upon creation will have to be added to all of the users accounts within the database. Is this standard practise? I really have no idea about this part of a website as I have never done it before.
-
The only issue i can see with storing the IDs of 'read' messages is that you will be filling up that cell with useless data.
So would it not be a better idea store the ID of new messages in the members table when new messages are created. Then once the user has read the message that ID is removed from the user's messageID field. Thereby you are removing data rather than contantly addnig to it.
This does depend of course on the process of creating new messages and whether this can practically work.
-
check if it's set first?
i.e.
if(isset($_POST['password'], $_POST['username'])){ $username = $_POST['username']; $password = $_POST['password']; } else { Do whatever........ }
-
Looks about right to me. Except you practically want to make your salt something that can't be cracked by a library. So it should really be a long string of random characters.
You might want to go further and hash the md5 password:
$password = "Userpassword"; $salt = sha1(md5($password)); $password = md5($password.$salt);
-
Just cos i'd written it lol...
<?php $test = Array ( 'InboundSMS' => Array ( 'ID' => '3135765', 'Originator' => '+447537404702 ', 'Destination' => '+447537404702 ', 'Keyword' => 'UCB2' , 'Date' => '2012-01-25' , 'Time' => '12:09:08' , 'Body' => 'UCB2 this is a test "sms", with commas.. Test onlt for UCB Function ' ) ); echo $test['InboundSMS']['ID']; foreach($test['InboundSMS'] as $key => $value){ echo $key . " " . $value; } ?>
Hello
Can someone help me with this array?
<?php Array ( [inboundSMS] => Array ( [iD] => 3135765 [Originator] => +447537404702 [Destination] => +447537404702 [Keyword] => UCB2 [Date] => 2012-01-25 [Time] => 12:09:08 [body] => UCB2 this is a test "sms", with commas.. Test onlt for UCB Function ) ) ?>
Array ( [inboundSMS] => Array ( [iD] => 3135765 [Originator] => +447537404702 [Destination] => +447537404702 [Keyword] => UCB2 [Date] => 2012-01-25 [Time] => 12:09:08 [body] => UCB2 this is a test "sms", with commas.. Test onlt for UCB Function ) )Ive been using a foreach loop to each the array results but it wont echo any result
<?php foreach($qarray2 as $mnb => $keyws){ echo $keyws[1]; } ?>
I would like to echo the array results but im having a hard time on it.. can someone help me on this?
Any help will be appreciated..
thanks guys.
-
You could either do
action="#"
or
action="http://www.YourContactPage.com"
So the action just targets the current page and the php would then check to see if POST submt is set (you need to give submit a name btw), if it is then it'll process and you can display a thank you message.
Your php code isn't necessarily incorrect because you could just set the
header('Location:')
to direct to a thank you page. But the issue I can foresee (at a glance) would be if you throw an exception because once that outputs the head location won't be able to redirect and your user would end up on a blank page with an error message.
I did not know that about the forms. so that means that my error is in the .php not the .html.
If I want it to return to the same page that it is submitted from (basically refresh the page) wouldn't I just put in the same url or would I want to actually make the button refresh?
-
Don't forms always redirect to the location of the action?
If you don't want it to redirect you could simply run it from that page with a simple if statement to check if the form was submitted. i.e.
<?php if(issset($_POST['submit'])){ Run code to process the form - call functions required etc. } else { include('YourForm.php') }
Or
You could set your head location to return the use to a thank you page.
-
Thanks Jack that's brill!
I'll give this a shot and see if there's any joy.
Thanks for your help!
$headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'To: Jack <[email protected]>, Jack <[email protected]>' . "\r\n"; $headers .= 'From: Jack <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; $headers .= "Reply-To: [email protected]\r\n"; $headers .= "Return-Path: [email protected]\r\n";
That should probably do it, if it make sure all of the adresses are consistent with eachother (from is your postfix account, return-patch and reply-to are the same as from). Change the Content type if you ant plain text. Also, you can remove CC and BCC.
-
OOP just keeps everything clean and tidy when you're working on bigger things. It also helps you write reusable code and keeps it all separate.
For the basic of OOP i found this guy's tutorials on youtube really handy -
I'm not saying that's the absolute pinnacle of learning but if you want a fast overview of the concepts behind OOP its fab!
Where would you guys recommend I go to learn and become familiar with writing Object Oriented PHP code? Also what are the advantages of writing object oriented code? Is it better than the 'traditional' coding style? I mean without using Objects, Classes, Methods, etc.. Is one way more efficient than the other? I've been seeing a lot of object oriented php code lately, and I'm just curious and want to learn the concept of OOP, any help is appreciated.
Thanks!
-CLUEL3SS
-
Thanks Jack!
It helps to have a second opinion. I will try being more conscientious with my headers and see if that fixes the isssue.
Out of interest any specifics on precisely what headers might be useful to include? Being tht this is such a simplistic email i am a bit unsure.
Drongo
the hyphen doesn't usually cause an issue with mail, many organizations actually delete spam as it arrives, so make sure your have your give your headers in full (return addresses, etc). Chances are that your mail is being caught in SPAM and either the mail is automatically deleted by the receiving organizations mail client (Microsoft does this with webmail, and client email services, if the user is not an administrator). The best cure is to list headers (Just google, full php mail headers.)
Since you're recieving the mail on a seperate client, it wouldn't be a postfix issue, or a php syntax error.
-
Hi Guys
I've got an odd issue on my hands and i hope someone can help.
I have a simple contact form on a client's site.
the php mail code is below.
Anyway this works perfectly for me and always delivers to my email. However, the client doesnt get anything and nothing (according to them) is getting caught by their spam checker.
The ONLY difference i can spot in all of this is that their email address contains a hyphen, whereas all the email addresses i have tested on do not. Is it possible this could cause an issue? OR is just that they can't work their spam checker and its their fault?
If the hyphen could cause an issue then can anyone suggest an alternative syntax to guard against this?
Many thanks chaps!
Drongo
$to = "[email protected], [email protected],"; $subject = "form submission"; $message = " <html> <head> <title>form submission</title> </head> <body> <h2>form submission</h2> The form was submitted from the $originates form <br/><br/> Name: $validated[name] <br/><br/> Email: $validated[email] <br/><br/> Telephone (if entered): $validated[number] <br/><br/> Enquiry: $validated[enquiry] </body> </html> "; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // More headers $headers .= 'From: <[email protected]' . "\r\n"; mail($to,$subject,$message,$headers);
-
When you store you page data in the database have a column for "page type".
So in your code:
Page type of 1 = Two col. layout
Page type of 2 = three col. layout with blog posts
so when your controller talks to the model for data, the model will return the page data requested and the 'page type' number. Then when you call the view controller you can have some logic to call a different layout depending on the page type. And this way you can acheive multiple layouts.
There might very well be a better way and i did it this way just because it made sense to me. But it worked ok for me.
I dont quite follow you on this one.
Or you could store the page data (in your database) with a field for "view type" which could hold a number corresponding to a particular view layout (that's what i did when i built my own little cms to practice). So when your controller calls the model, that model will pull down the "view type" along with the page data and the controller can then use that "page type" number to render the necessary view.
Thanks for the replies...
-
Or you could store the page data (in your database) with a field for "view type" which could hold a number corresponding to a particular view layout (that's what i did when i built my own little cms to practice). So when your controller calls the model, that model will pull down the "view type" along with the page data and the controller can then use that "page type" number to render the necessary view.
I am building a cms in cakephp, well i haven’t yet started but i have a good idea on what i want. I have never really used MVC before so it's quite confusing to say the least.
I want a index page which can hold numerous controllers so I am able to have control over multiple tables in my database from just one view. Is this possible...? Also does anyone know of any good tutorials or help info that can guide me a bit better throughout this project?
-
I would recommend getting to know ajax and specifically becoming more familiar with json - which will all help you connect client side actions with serverside processing.
And yes - jquery has lots of good and simple functions for helping you do the above - so learn both
-
Also worth familiarising yourself with this mate - http://uk3.php.net/manual/en/features.file-upload.php . Get to know the $_files array - it'll help you a lot cos i know i found it all a bit confusing at first.
Hi everyone!!
I have looked into how the upload script works and this is what i have:
<?php if ((($_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"; } ?>
Which is un-tested at the moment, but let's just say for talking sake it worked 100% what elements of this script would i be looking at to display the files uploaded on to another page, in my case my homepage?
ive found as to yet, that the uploads have to be stored on a file somewhere on my server, which i've set up. But i thought it would be just as easy to have a field in my table named upload and display it within the table next to the other results? instead i just get whatever the file name is named.jpg.
Any help in looking towards the answer? many thanks in advance guys!
-
Hurrah!
thanks a lot. Actually it worked for me.
-
Well this works fine for me:
<?php if(isset($_GET['item']) && !empty($_GET['item'])){ $cat = $_GET['item']; echo $cat; }else{ echo "No menu item selected"; } ?>
Can you post what you've done?
-
You've pretty much answered your own question really with one minor change.
You probably want to check if the 'item' variable is actually set first and then make sure it's not empty. e.g.
if(isset($_GET['item']) && !empty($_GET['item'])){ $cat = $_GET['item']; echo $cat; }else{ echo "No menu item selected"; }
� What's this?
in PHP Coding Help
Posted
As the others have said, using the html entity will fix it in most cases and is probably the best way.
I have had this issue a few times when copying text from word (even with the charset set as utf
. I notice it happens on commas and apostrophes and sometimes the simplest fix is to delete the character and re-write it in your editor, which fixes the comma and apostrophe issue.