Jump to content

the_oliver

Members
  • Posts

    364
  • Joined

  • Last visited

    Never

Everything posted by the_oliver

  1. how are you trying to view the data?  Through a terminal or through php?
  2. fair play!  does the session thing sound like a good idea though.  Never tried it so would be intrested to know if it would work!
  3. Ok, so as i explained above you need to get the data out of the form by posting it, and then add it into your Body: (this bit) [code]$mail->Body    = "This is a test message.";[/code] The way to do this is to set your form action to POST. Do this by putting the <form method="POST" action="send.php"> at the top of your form.  At the bottom of your form i asume you have a button or something.  This should be set to Submit the form. Esentualy posting it is making it a variable that is availible to the script that does the sending (your php script).  Odviously the next stage is to get the Posted variable back in a way that is usedull to you. This is done by using [code]$_POST['field_name'])[/code] Where i have put field name you put what ever your textarea, or field, or whatever, was called in the origional for.  This will get the data that was in that field back out, and you can use it as a standard variable.  In your case this would be by adding it into your $mail->Body bit.  Try [code]$mail->Body = "Name: ".$_POST['name_field'])." was the content of the for.";[/code] There for what ever was in the field called name_field would be included in the body of the message.
  4. Out of intrest why are you storing all of your data in a session?  MySQL can should be able to cope with regular re-polls of the database unless you have a seriously high number of conections, inwhich case it may be worth thinking of a diffrend db like postgres? I ask because it seems to me you are storing all the infomation in the session, when it is unlikly that you will need to call on all of it.  Leaving it all in the database untill you actualy need it would also make your coding much simpler. For example: To connect to the database needs only be: [code] $user = "USERNAME"; $pass = "PASSWORD"; $host = "IP ADDRESS"; $db = "DATABASE"; $link = mysql_connect( $host, $user, $pass ); if (!$mysql_connection)           {           die("Could not open connection to database server $host");           }[/code] In reality your preforming a lot of checks, every time, that are not realy nessesary.  Your either connected or not.  They can be usefull for troubleshooting, but just pad out your real code. Then to query the database: [code] include "FILE WITH CONNECTION DETAILS.php"; global $mysql_connection; $query = "SELECT author,movie_length FROM move_table_name WHERE title LIKE 'saw1'"; $result = mysql_query($mysql_connection, $query); $data = mysql_fetch_array($result);         [/code] Then you can use the array as you wish: [code]$text = $data["WHICH_EVER_COLOUB_YOU_POLED_FOR"]; or $text2 = $data["THE_OTHER_COLOUB_YOU_POLED_FOR"];[/code] Compare, print, whatever you please! Perhaps i have missed the point? but it seems to me that this would be dramaticly simpler, require drematicaly less code, and thus be much easyer to find out were things are going wrong.
  5. not sure if there a simpler way, but you could create a nother columb in your db table, put a 1 it for all files you want, and refine your serch to only include results where there is a 1 in this field.
  6. could you not write the file on a web page, rather than email, and have the page add it into your site/database and email it to a list of people. (could be stored in a variable or database to save time and for easy addition with no extra work!) Would make life a hell of alot simpler, and you could still make it so it appeard to come from news@yourdomin.com Doing entirly by email would be extreemly complex, and to have it automaticaly up date (with out clicking a line like radar sugests) would envole setting up some sore of cron job or something.  Lot of hastle to avoid using a web form!! and it could still take html or whatever you want so long as you put the right headers in.
  7. Sorry, ment to explain that but hit the mouse by ,mistake! This bit: [code]$Subject = Trim(stripslashes($_POST['Subject']));[/code] Is the bit that is getting the data from the form.  Your form should be set as follows: [code]<form method="POST" action="send.php">[/code] and you replace the send.php with teh file where you stored the code abouve. All that is is saying is to cut out any spaces etc from that particular string posted when the form was submited.  Where i have put subject or, field1 etc you put in whatever your textarea of field was called.  The text/value that was in that field will then be stored in the varible at the start and you can do what you like. The //validation bit is juat checking that there is a value in a field, and if not stoping the form from being submited. The //prepare email body text does exactly what it says.  Its taking all the strings you have taken out of the form, and putting them into one, is a coherent manor. //Send email is the bit that does all the work.  Its taking all the variables and actualy sending the email. The final if statment is simple redirecting the users, depending on weather it sent correctly or not. Hope that makes sence
  8. <?php $EmailFrom = Trim(stripslashes($_POST['EmailFrom'])); $EmailTo = "bla@bla.net"; $Subject = Trim(stripslashes($_POST['Subject'])); $field1 = Trim(stripslashes($_POST['field1'])); $field2 = Trim(stripslashes($_POST[field2'])); // validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) {   print "<meta http-equiv=\"refresh\" content=\"0;URL=redirectto.whatever\">";   exit; } // prepare email body text $Body = ""; $Body .= "Company: "; $Body .= $field1; $Body .= "\n"; $Body .= "Enquiry: "; $Body .= $field2; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ //IF SUCCESFULL REDIRECT TO   print "<meta http-equiv=\"refresh\" content=\"0;URL=../redirect.bla">"; } else{ //IF UNSUCCESFULL REDIRECT TO   print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact.php?hdr=merror&usr=non_idnt&area=public\">"; } ?>
  9. Does sound like a good plan.  A way to get round the problem of them 'changing ip address' if its dynamic, would be to also store there session number as well as ip.  This wont change unless they exit and the reopen there browser.  As you say the chances are nothing! Can i ask why your using a text file not a database?  Sounds like it could turn out to be quite a lot of work for cron!  Perhaps you could assign each user and id in a database, and then there session and ip numbers could just be updates using there id as a refrance?
  10. Still dont get it.  Header field in what?
  11. Hello. I have a from, which when submited sends the infomation as an email. to do this i use this code [code]$success = mail($EmailTo, $Subject, $Body, "From: <$From>");[/code] However i want to be able to include HTLM code in the $Body part.  At the moment im doing it by starting the body with: [code]$Body = "   <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"     \"http://www.w3.org/TR/html4/loose.dtd\"> <html>......[/code] However the emails always show the actual code, no the effects! What am i doing wrong? Thanks.
  12. RAID is an administrators god send!  Odviously most people use RAID for an instant back up, if one disk fails the other simply takes over.  Again this can be done on lots of diffrent levels, the most common being a mirror raid.  Data is simply copied onto both disks identicaly, meening higher reliability and thus possibly grater up time.  A striped raid is another example, and used to have two disks acting as one larger one.  Often to alow higher availibilty.  The one isue that can occour with raid is that if there is a coruption on one disk it will be copyed over onto the other. Hardware RAID is almost always vastly superior, for the odvious resion that it does not rely on the softwere!  It will copy data from one disk to the other regardles of what the softwere is doing.  There for if the softwere is playing up your data will still be copied.  This does require a hardware RAID controler however. [code]The system takes way, way, too long to copy files. About an hour to copy 5 gig from one folder to another. I would expect longer write times but this is excessive.[/code] Realy you should not expet this!  The whole idea of it is that its instintainus.  When you origionaly set up the RAID there will be a long time to instiate it.  This is becase it has to ensure that the data on each disk is identical to start with.  Even the empty packets.  However once the system is running, there should be no noticible diffrence.  It is almost sertinatly down to the 80/32 problem.  Linux trying to copy data that the bios/disks are saying isnt there. (due to your clipping).  Could try a manual install and tell it what to copy?  Most importantly with linux its never the operating system always you! After thought, do you have a resionable about of RAM in there?
  13. Essentualy a unique is what it says.  For exampe say you have a table with 30 rows.  You could have a coloum called id.  This colour could have a unique (diffrent) number for each row.  This can be very helpfull for identifiying rows, espesialy for example if two are the same.  so basicly the unique attribute meens not the same as anything else in that row. You might find it usefull that you can set your database to automaticaly add the next number in a sequence whenever a row is generated.  This meens you will always have a unique value.  Basicly for most uses they are the same except that for a primary key there can be no blank entries, where as with a unique there could be one blank entrie. Hope this clarifys things a little!
  14. Im out of ideas then!  Sorry!  Could go to the extreem and wipe the whole box and start affresh!  Alternitivly just drop it out a window and claim on insurance!
  15. So all the md5() part is doing is taking your origional 'word' used as a password, and changing it into a whole load of random letters and numbers.  For example if you type [code]echo md5('password'); [/code] your browser will print 5f4dcc3b5aa765d61d8327deb882cf99.  This is the 'md5 version' of the word password.  The idea basicly beeing that your not going to remember or reconise a random string of numbers and letters that long.  There for no one is going to know that 5f4dcc3b5aa765d61d8327deb882cf99 meens password.  The other important thing is that there is no way to reverse the prosses.  There is no way of typing in that random string and getting the word password back. So the important thing is how you can use it.  For example, when a user registers on your site they type in the password they want into a text field.  Then your script will take this word and convert it into an md5 string : [code]md5($_POST['password'])[/code] It is then this string, not the password that is stored in the database, meening no one can just reed the password off. Next when the user tries to log in, you take agian the plaing word they type, convert it into and md5 string, and check this string against the one in the database, in exactly the same way you were with the strate text. Dont forget however that you will have to convert all your old passwords to an md5 string. Hope this makes sence.  Let us know how it goes.
  16. So there would definatly seem to be somthing funky going on with in the config.  Swapping out the cgi part to see what happens could posibly provide some usefull explinations.  Do you need cgi for anything specific? or forsee needing it again?  it could be that the php stuff is corupt (something went wrong from install, faulty download etc) and it might be worth trying to replace this from a diffrent source. [code] I don't have php-5.1.2-Win32 back to back like that[/code] To be honest it might be best in the long run just to start the config file again from new.  Or perhaps see if someone has put an example of a working vertion on the web.
  17. The fact that it runs plain .html files but not php files would suport the theiory above!  It does look like the php moduls are not tied in propaly.  If this is not the case then you probably need to rebuild the php moduals. Good Luck!
  18. will it run a plain .html file?  Or possibly even some funky fire wall problem? possibly allowing only one way trafic?
  19. In reality mySQL should happily chew through that number of fields at a desent speed regardless of the length used.  What will have more of an effect are the specs of the server its running on, and how hard the other uses are hammering the connection.  Being on shared hosting you are unlikly to be able to find this out.  You could consider simple hosting your database with another provider? You could possibly speed it up by having a table only containing the name (such as 'php') and an id_number in it, relating to the full infomation in the other table?  Just meens the table is smaller for the search to plow through.  Just a thought.
  20. Not sure about the memory v. disk question... doesn't seem to make much sence to me!  If there is a power failur your going to lose the data regardles of where it is stored. The main diffrence is that postgreSQL is truly open source.  This can allow much more room for individual develepment from the back-end side of things.  MySQL is much more common.  For example on most server with php installed MySQL comands are compiled, but pgsql arnt.  PostgreSQL is also capable of doing more back end.  For example calculations, meening a faster service in the program/web script/etc.  Also if you a running a serriously lage amount of data though a database postgreSQL may run a little faster.  To a large extent i think its down to perfrance, and ultimatly the bult of the queiry comands are very similar!  I have never realy found a satisfactory awnser to the question 'whats the difference?'!!  Must also confes to being a little biast infavior of postgreSQL though!
  21. if you used pgsql instead of mysql you could have it do calculations for you server side!  just an interesting though!
×
×
  • 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.