Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. I think there's an error there - the side1s and side2s in the cosine expression need to be swapped around. Also, a couple brackets missing: h= s1*sin(cos^-1((s2^2-s1^2-(t-b)^2)/(-2*s1*abs(t-b)))) And if i was being picky, the top-bottom would give a negative answer, hence the abs(). Good work though - took me a while to spot it! I make h equal to 4.8 Oh, and Demonic: I think your assumption that you get a right angle by splitting into a parallelogram and triangle is wrong. Otherwise this would be even easier with some normal trig.
  2. Personally, i'd feel very uneasy about using a site which was tracking me in real time.
  3. You can opt out of that. Either during the installation process or when you go to download Adobe Acrobat reader. Yeah, i know you can opt out. I just dislike the fact that i have to. These things should be opt in rather than opt out imo.
  4. Why would you want to prevent users from saving a copy?
  5. I hate anything like that. You cant even download adobe acrobat reader without being asked to instal the yahoo toolbar. It wouldn't be quite so bad if these things were set to off by default.
  6. That error is because data is being sent to the browser prior to the call of session_start(); If, as you say, this is the first line of your file, i would expect there is some whitespace before the opening php tag.
  7. Not entirely sure what you were trying to achieve with the extra double quotes and backslash, but this "works": <html> <head> <title></title> </head> <body> <?php // initialize sentury variable $sent = 0; while($sent <= 100) { echo"Count# $sent "; $sent++; } ?> I'll leave you to figure out how to make it increase by 5 each time. Just FYI: You can join strings (for echoing etc) by using the concatenation operator(.). For example: <?php $foo = 'foo'; $bar = 'bar'; echo $foo.$bar; //foobar ?> The backslash is the escape chacacter. This means the character following will be interpreted as a literal, and not have it's special function. For example, you may wish to echo a single double quote, and might try: <?php echo """; ?> This will, however, throw an error. This is because the string being echoed will be terminated by the 2nd double quote, meaning the third is just floating about, confusing PHP. To get around this, you could do this: <?php echo "\"" ?> This means the second double quote is treated as a literal, and so does not terminate the string being echoed. In this instance, it would probably have been easier to use single quotes to surround the string being echoed: <?php echo '"';//equivilant to the above, but a bit easier on the eye. ?> Finally, you may ask what the difference between using single and double quotes is. Well, when you use double quotes, variables contained within that string are evaluated. That is, their value is echoed to the screen. For example: <?php $foo = 'bar'; echo "String 1: $foo";//echos string 1: bar echo '<br />'; echo 'String 2:$foo';//echo string 2: $foo ?> Some of this issues may have been where the confusion in your code lay. Hopefully the crash course might have helped.
  8. Your question is a bit vauge, but i would guess this is to do with the settings of the browser on the 2nd machine. Whilst you are using sessions, PHP will most likely (i say most likely, because it depends on your php setup) be setting a cookie to track the session ID. Therefore, if your browser on your second machine isn't accepting cookies, then no session will be kept.
  9. Not at all. The first 3 results all look promising: http://www.google.co.uk/search?source=ig&hl=en&rlz=&q=flat+file+php+guestbook+&meta= or indeed: http://www.google.co.uk/search?hl=en&q=flat+file+php+guestbook+tutorial&meta= However, chrisdburns may be right (apart from the database bit). You may benefit more from looking at tutorials on individual parts of the problem, such as collecting data from a form and reading and writing to files.
  10. ...but only if PHP is configured to do this. You'll need: session.use_only_cookies turned off session.use_trans_sid turned on
  11. I can't actually believe this. I did actually see it just after i posted that. I've been hunting around on the profile page for ages! I think i may have to book an eye test Anyways, thanks for pointing it out.
  12. I've been looking for that "updated topics" link for bloomin' ages. I stumbled across it at some point, but havn't been able to find it since. I still can't actually find the link. I must be being blind, but where exactly is it?
  13. This is more of a javascript/ajax issue rather than a PHP issue. You might have more luck posting in the correct forum. I can't see anything immediately wrong with the javascript, exect that you're not sending the keyword in the url. As for the PHP, the only thing i see is that on one line, you use $_GET['keywordl']. I assume that's meant to be just 'keyword' Are you using firefox? Does the javascript error console give any indication of the problem?
  14. Well, given that you're probably only going to be wanting to edit one entry at a time, it would probably be neater to have a link which takes you to a page which allows the user to modify the row. You will need to pass something in the URL (hopefully you have a unique ID) to identify the row in question. You can then pull the relevant information from the database, and populate a form which the user can edit. Once the form is submitted, you can use an update sql query to change the row. Does that help?
  15. Yes, when you use the insert command, you will create a new row. You can either combine everything into one insert, or perform the first query as an insert and the second as an update query. I would recommend combining the queries, since it is more efficent. This should work for you: <?php $username="jaybirdf_Admin"; $password="607101593"; $database="jaybirdf_RealEstate"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); if ($_POST['Submit']) { if ($_POST['MAX_FILE_SIZE'] >= $_FILES['file']['size']) { $Address=$_POST['Address']; $Picture=$_POST['Picture']; $City=$_POST['City']; $Map=$_POST['Map']; $Bed=$_POST['Bed']; $Bath=$_POST['Bath']; $Terms=$_POST['Terms']; $SQFT=$_POST['SQFT']; $LSQFT=$_POST['LSQFT']; $Price=$_POST['Price']; $file=$_POST['Image']; $type=$_POST['FileType']; //print_r($_FILES); $photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $_FILES['file']['size'])); $query = "INSERT INTO Listing (Address,City,Map,Bed,Bath,Terms,SQFT,LSQFT,Price,Picture,Image,FileType) VALUES ('$Address','$City','$Map','$Bed','$Bath','$Terms','$SQFT','$LSQFT','$Price','$Picture','$photo','".$_FILES['file']['type']."')"; if (mysql_query($query)) { $messages[] = "Your files is successfully store in database"; } else { $messages[]= mysql_error(); } } else { $messages[]="The file is bigger than the allowed size please resize"; } } ?> <html> <head> <title>Add Image</title> </head> <body> <? if (isset($messages)) { foreach ($messages as $message) { print $message ."<br>"; } } mysql_close(); ?>
  16. I guess the only thing i would say i eat/drink habitually whilst coding is tea. But that goes for anything when i need to concentrate. I find it very relaxing.
  17. Right. Well perhaps stating that you had a large amount of code already written would have been a good idea. So, what exactly is the problem with the above code? What does it do? What doesn't it do? Can you narrow down the bit that doesn't work?
  18. Well, i assume you're able to create the form which you will input the product ID and you're just not sure where to begin with edit.php ? If thats the case, then maybe this will get you started. It's by no means complete - but it should provide a rough framework for the page. <?php //include your database connection if(!isset($_GET['id']){ header("location:form.php"); } $id = (int) $_GET['id']; if(isset($_POST['submit']){ //update the database } $sql = "SELECT * FROM `tbl` WHERE `id`=$id"; $result = mysql_query($sql) or die(mysql_error()); $num = mysql_num_rows($result); $row = mysql_fetch_assoc($result); if($num == 0){//if no results header("location:form.php"); } //otherwise, show the update form ?> <form action="edit.php?id=<?php echo $id;?>" method="post"> //you'll need to set up your form inputs with the value being taken from the database. For example: <input type="text" value="<?php echo $row['field_name']; ?>" name="fieldname" /> //other fields <input type="submit" name="submit" value="Edit" /> </form>
  19. As far as i'm aware, you have no option but to write a function: <?php function localdate(){ //replace with local names $days = array('Sunday','Monday','Tuesday','Wednesday','Thusday','Friday','Saturday'); $months = array('January','February','March','April','May','June','July','August','September','October','November','December'); list($day,$month,$date,$year) = explode(' ',date('w n j Y')); $day = $days[$day]; $month = $months[$month - 1]; return $day.' '.$month.' '.$date.' '.$year; } echo localdate(); ?> Edit: Perhaps not. If your language is one that is supported, this may be of some use: http://uk3.php.net/manual/en/function.setlocale.php
  20. Any salting will prevent the use of rainbow tables. The idea behind a rainbow table is that the hashes have previously been computed. If you're using a salt, these pre-computed hashes will be meaningless. Of course, it would be theoretically possible to have a rainbow table containing values with different salts, but given that present rainbow tables tend to struggle with a straightforward MD5 hashing of a random letter-number combination of sufficient length, i wouldn't worry about that in a hurry. Not just could - they will repeat. And this will happen with any of the hashing algorithms. As far as i'm aware there is no upper limit to the number of characters that can be turned into an MD5 (or SHA1) hash. Therefore, each hash does actually have an infinite number of corresponding unhashed strings. Of course, the odds of finding just two strings which produce the same hashed value are pretty low.
  21. 71 words per minute for me. I didn't like the way that you didn't have to delete the mistakes though. Im sure that more than doubled my error rate! Same sort of problem as redbullmarky i guess.
  22. Some of my favourite artists: Arctic Monkeys, Editors, The Cribs, The Rakes, The Shins, Cold War Kids, The Jam, Muse, The Killers, Art Brut, Kanye West, Daft Punk, Air, Jack Penate, Jamie T, Oasis, Blur, The Libertines... Currently listing to Vampire Weekend's and Hot Chip's new albums quite a lot. I guess most of my music falls into the indie/alternative genre, but i do like a bit of everything.
  23. In other words, you don't want the html tags stripped out completely, you just don't want them to actually be interpreted by the browser? (e.g. you want the bold tags to show up, but not make the text bold?) If so: htmlentities And it's definitely better to do this on display than on input. Aside from aforementioned security issues, what happens if you suddenly decide you DO want the some of the HTML to be used?
  24. Yes, it can work with a .html extension (or, indeed, any other extension you like). It's an apache setting. Ill just try and find it for you. Edit: Find this line in your http.conf: AddType application/x-httpd-php .php Then add this line: AddType application/x-httpd-php .html On a side note, php wont throw an error for a missing semi-colon if the php is closed directly after.
  25. You're either going to have to do some processing before the form is submittted with javascript (e.g. set a hidden field's value) or do the processing after the form has been submitted with php. If you think about what you're doing, your trying to have two variables inside one element of the post array. Therefore, $_POST['id'] will contain the two pieces of information you require. If you use a delimiter between the information, you could explode the data and extract the relevant parts.
×
×
  • 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.