-
Posts
579 -
Joined
-
Last visited
Everything posted by Drongo_III
-
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.
-
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.
-
Notice: Undefined index! (PHP ERROR)
Drongo_III replied to TottoBennington's topic in PHP Coding Help
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; } ?> 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.
-
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!
-
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!
-
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
-
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 = "info@mysite.com, theirsite@their-site.com,"; $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: <DoNotReply@mysite.com' . "\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. 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.
-
PHP or Jquery or should I use something else????
Drongo_III replied to Tech boy's topic in PHP Coding Help
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.
-
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"; }
-
Hi Dan Thank you so much for your response! I think I am finally starting to understand how this works in practice and how to set things up correctly. What sparked my question was a client who wants me to host their website but have their own mail server and want to keep the mx records as they are. And this got me wondering how well i understand this and whether i actually need to amend the zone file for the addon domain everytime or not (which i now realise i don't). The thing is there are lots of guides on dns - "what are name servers", "what does @ mean" etc. - but a discription of the elements that make up dns feels like a long way from how all the component parts work together in the real world when you have domains hosted with one company and a server for web space hosted with another. I shall keep reading up on it until i've fully cracked it but you may yet be bombarded with more questions on this hehe
-
Yes. Just check if the variable is empty and if so then set it to be NULL. But make sure you use double quotes or it will end up being inserted as the literal 'null' rather than null (without quotes).
-
Ok so here is my follow up question (sorry it is so long). Lets say my domain is hosted on 123 reg, and as above, I have my own vps server (with cpanel, whm) where i host my websites. So if i want to set all records in 123 reg am i correct in doing the following and is my understanding correct? [*]Change the A record (www and @) on the domain (on 123 reg) to point at my vps server where an addon domain is setup for it [*] keep the nameservers set to 123 reg (so this is the main authorative name server where dns lookups are made) [*] Setup the mx record on 123 reg - because this is where the dns system will look for my mx record with nameservers set to 123 reg Does that all sound correct? If so then here's scenario two: Am i right in thinking that if i change the name servers on 123 reg, so that they are now set to my own vps server's name servers, that i now need to setup the zone file on my own server for MX, WWW, @ etc. because now dns lookups are routed to my server instead of using 123 reg? Is that correct? If so i think the penny has finally dropped and i understand the distinction. If not, please tell me where i am wrong I am really keen to understand this as i operate on my own so i don't really have anyone to bounce this off and if i don't understand it then i might inadvertently make a mistake :/ Many thanks, Drongo
-
Thanks very much Dan! It's a bit of a confusing world when you get down to the nitty gritty of dns. I might well post a follow up question but don't worry if it's not your bag. Thank you very much for the info you have provided - it has helped me uderstand a bit more.
-
I hope someone can help me understand this. I have about enough knowledge of DNS to get by but there is something I am a tad confused by. I have a vps server. If i point a domain hosted by a third party at my server using my name servers I then have to setup an mx record on the zone file (on my server) for email to work - even though the mx records are setup on the domain in the domain control panel (on 123 reg). So am i right in thinking that everytime i point a domain at my server (which is setup as an addon domain) I need to also add the mx records into the zone file on my server? Do the mx records on the domain host simply become obsolete when you repoint the name servers? Any help in understanding this would be massively appreciated because i feel rather dumb for not quite grasping this... :/
-
I can;t see how sessions can work for this either. Since the company need to respond, presumably at a later date and from different computers. Probably best to store each stage as and when it happens and maybe add a field on each record with a flag for status - i.e. "awaiting company response", "awaiting user confirmation" so you can run a check to see the status of the record.
-
As i said, i'm not fully following what you are trying to achieve. if you post your code with a more indepth description might be able to come up with something better