Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. how do you know there is no cookie set. have you tried to print the value setcookie("user", "joe bloggs", time()+3600); print $_COOKIE['user'];
  2. Yes If your using HTTP POST access the data using $_POST So as an example your asp file will post 4 bits of data and the php will add a user to the database if($_POST['action'] && $_POST['action'] == 'createacct') { $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $name = mysql_real_escape_string($_POST['name']); // connect to database and insert the new user $x = mysql_connect(); mysql_select_db(); mysql_query("INSERT INTO users....... } get the idea your form names / values action | createacct username password name
  3. If you have yum its easier yum install php-gd Then restart apache
  4. if your files are wmv then how do you plan on displaying them?
  5. This is not meant to display the image. It gets the filesize from the header. Why are you trying to display the image. I thought you were trying to check if a file exists / get the size of the file.
  6. function getSizeFile($url) { if (substr($url,0,4)=='http') { $x = array_change_key_case(get_headers($url, 1),CASE_LOWER); if ( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) { $x = $x['content-length'][1]; } else { $x = $x['content-length']; } } else { $x = @filesize($url); } return $x; } print getSizeFile("http://www.google.co.uk/intl/en_uk/images/logo.gif");
  7. Yes you can use fopen() but only if the remote server allows this. What is wrong with checking the HTTP header with the URL as I said. Heres some code. Try it out: <?php function httpHeader($url) { $urlParts = parse_url($url); $fp = fsockopen($urlParts['host'],80,$errno,$errstr,10); $out = "GET ".$url." HTTP/1.1\r\n"; $out.= "Host: ".$urlParts['host']."\r\n"; $out.= "Connection: Close\r\n\r\n"; fwrite($fp,$out); $content = fgets($fp); return $content; } $url = "http://www.google.co.uk/intl/en_uk/images/logo.gif"; print httpHeader($url); ?>
  8. Then I would use the HTTP status code to check the file exists. From the url http://yoursite,com/files/000.wmv - if it returns a 200 then the url is fine. If it returns a 404 then the file does not exist. Test it out here http://www.seoconsultants.com/tools/headers.asp Then write a PHP script to do it, not that hard.
  9. No, not at all. As my previous post. Once you call session_start() you have an active session. To add data to the session you simply use $_SESSION['name'] = "neil"; easy. No need to commit anything. If I want to overwrite that value: $_SESSION['name'] = "koolaid"; Just make sure that session_start() is at the top of all pages where you are using a session. Sessions remain persistent through all your pages until you destroy it or it times out: unset($_SESSION['name']);
  10. miles off. you have code within your echo statement. <?php if ($row_rs_positions['active'] == 'Yes') { do { echo '<div class="displayjobs"> <div class="jobheading"> <p><a href="careers.php?positionid='.ucwords($row_rs_positions['positionid']).'">'.ucwords($row_rs_positions['title']).'</a><strong> - <span class="style5">Added'.ucwords($row_rs_positions['date']).'</span></strong></p> </div> <div class="jobdesc"> <p>'.ucwords($row_rs_positions['summary']).'.... <a href="careers.php?positionid='.ucwords($row_rs_positions['positionid']).'">View Position</a></p> </div> </div>'; } while($row_rs_positions = mysql_fetch_assoc($rs_positions)); } else{ echo '<div class="jobopenings"><p align="center">Thank you for your interest in Laser Dynamics. Currently we do not have any job openings within The Company. We are, however, always accepting resumes and applications. If you would like to be considered for a future position here at Laser Dynamics, please submit a resume and application <a href="submitapp.php">here</a>.</p></div>'; } ?>
  11. Page 1 session_start(); $_SESSION['blah1'] = "whatever"; $_SESSION['blah2'] = "i love my dog"; Page 2 session_start(); $_SESSION['blah1'] = "whenever"; $_SESSION['blah2'] = "i love my cat"; That is it. session_id() not needed. Why you are throwing the session Id through the url I dont know
  12. Why are you using this function? session_write_close(); Also session_start(); should be called prior to any other code
  13. To note, you should not be containing variables within quotes or object properties either. They are not printed strings. $AuthorID[$x][0]= "$row->created_by"; $AuthorID[$x][0]= $row->created_by;
  14. file_exists() takes a server path not a url. Extract the filename from the url and specify the path i.e. /var/www/html/myfiles/media/00001.wmv
  15. echo $i."<br />";
  16. Instead of a counter $x as the array key use the authors id. $Authors[$row->id] = $row->name;
  17. Again http://recaptcha.net/
  18. Won't work. A simple delay would get past this. Bots are cleverer than this and designed to mimic a human. Bots usually read the form prior to submitting. Field names will be extracted. Math questions are the easiest to get through. Any other type of questions a real user may not know the answer to also. The best method is recaptcha http://recaptcha.net/
  19. You will have to re-create your database on your new host.
  20. At least its 15:45 in the UK, nearly home time, come on!
  21. I find it more interesting fixing other peoples code than what i'm supposed to be working on at work right now.
  22. Ill let you off this time
  23. Again you are setting the array key to 0 Change to $i = 0; foreach($rows as $row) { echo "<li>$row->title ($row->publish_up)</li>"; $Authors[$i]= $row->created_by; echo "Author's id: $row->created_by"; $i++; }
  24. This $out.'/$1/$2 change to $out.'/$1$2 Nearly there
  25. You are setting the array key to 0 each time Change to $i = 0; foreach($rows as $row) { echo "<li>$row->title ($row->publish_up)</li>"; $Authors[$i]= "$row->created_by"; echo "Author's id: $row->created_by"; $i = $i + 1; }
×
×
  • 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.