Jump to content

Drongo_III

Members
  • Posts

    579
  • Joined

  • Last visited

Posts posted by Drongo_III

  1. 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.

  2. 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.

  3. 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);
    

     

  4. 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.

  5. 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?

  6. 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.

     

  7. 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 <jack@example.com>, Jack <jack@example1.com>' . "\r\n";
    $headers .= 'From: Jack <jack@example.com>' . "\r\n";
    $headers .= 'Cc: jack@example.com' . "\r\n";
    $headers .= 'Bcc: jack@example.com' . "\r\n";
    $headers .= "Reply-To: jack@example.com\r\n";
    $headers .= "Return-Path: jack@example.com\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.

  8. 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

  9. 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.

  10. 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); 
    

  11. 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...

  12. 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? 

  13. 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!!  :D

     

    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!

  14. 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?

  15. 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";
    
       }
    
    
    
    

  16. 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 ;)

     

     

     

    More from Zoe:

     

     

     

    If you are running cPanel, I highly, highly recommend, both for your sanity and the sanity of any support personnel who access your server, that you use cPanel's integrated nameservers.  Simply point the NS records from your registrar to your cPanel box, and let cPanel handle all your domain records.

     

    If your mail is handled by cPanel, your MX records are automagic.  They just work.  Add subdomains?  Just work.  Add SPF or domainkeys?  Just work.

     

    You then manage your DNS records in cPanel under the "Simple DNS Zone Editor" or "Advanced DNS Zone Editor."  The zone editors check your records for sanity, so your nameserver won't fail due to malformed records or anything.

     

    Because you're running cPanel, you have a nameserver running ANYWAY, managed by your panel, so I highly recommend you use it unless you have a very specific reason to avoid it.  One final pitch (as a professional support technician) your support tech will appreciate having all records handy in case of repair... and you'll appreciate not having to play go-for between support and your registrar when (not if, it's DNS, this stuff happens) things change.

     

    WITH ALL THAT SAID, I hate when people don't answer the question I ask, so in answer to your question, your checklist in your followup question is technically right and will work.  Re scenario two, no;  if you point your NS records to your VPS they will automatically work (after 24-72 hours as the DNS catches up it's caches) because cPanel manages them (see my overly wordy sales pitch above).

     

    The biggest thing to know about DNS is that there is one-only-one authoritative nameserver.  All other nameservers have NS records which point to the authoritative nameserver.  You just need to pick which server is the authoritative nameserver, and make sure all others point to it.  It can be any server you want, but with cPanel it's best to use the built in one for sanity's sake.

  17. 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 i seem to be having difficulties  if i dont want to enter data into a field in a mysql table do i juts put NULL in the sql query ?

  18. 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

     

  19. 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. :)

     

    It depends on where the actual nameservers exist.

     

    If you are using the nameservers at your registrar, you need to put your MX record on the registrar;  placing them on your server will do no good.  As long as your mail exchanger information doesn't change, you don't need to edit the MX record at the registrar unless you change mail hosting.

     

    If, however, your VPS contains a nameserver (like if you are running cPanel), then you need to point the nameservers to your VPS at the registrar.  You then put your MX record in your cPanel zone file.  If you ever move nameservers to another server, you will need to move your MX record to the new server as well.

     

    It's an either/or.  Domain names can (pretty much) only have one authoritative zone record (you can be on multiple nameservers, but that record better completely match on all of them or else really weird name resolution things happen), so you need to decide exactly where it will live and make sure your NS records at your registrar point there.

     

    --The above was written by my friend Zoe, a linux tech and network tech at HostGator.  I don't know anything about this topic, but I knew she did.  I probably won't be able to do any follow-up answers.

  20. 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... :/

  21. 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.

     

     

     

    Im making a application but many users can access it at the same time, also the data that needs to be stored into the database in 3 parts firstly the user will enter some details the comany will fill out the reamining details and the user will then accept or decline the companies proposal. The issue im havign will it be easier to just store all of this information into session variables and then save them into the database at the end when all of the details are ready ?

     

    Thank You

  22. 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 :)

     

    Drongo_III, putting a background color would solve this issue, however, the whole page background is an image, so that is not an option :(

×
×
  • 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.