Jump to content

cags

Staff Alumni
  • Posts

    3,217
  • Joined

  • Last visited

Everything posted by cags

  1. I really should read posts better, not watch TV. In your second query, you don't have a close double quote " at the end of it before the semicolon. If you'd have posted with the PHP code tags, you might have seen that <?php <?php echo "<font face=\"verdana\">"; echo "<br />"; $db = mysql_connect("localhost", "", ""); mysql_select_db(""); $query = "SELECT id, date_created FROM ap_form_1, ap_element_options WHERE ap_form_1.id = ap_element_options.form_id ORDER BY date_created DESC; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo "<br />ID: "; echo $row['id']; echo " Date Volunteered: "; echo $row['date_created']; } ?> ?>
  2. Hmm.. interesting. Your right it doesn't appear in the same place on the file. The same information is still in the source though. For example in multiple places in the source it has javascript code with zip=9420 in it. I don't know how the address work there, but this sound like the sort of thing your after extracting.
  3. Holy crap, that site sure has a lot of whitespace in the HTML file. Getting the HTML should be as simple as something like this... $source = file_get_contents($url); The tricky bit will be working out exactly where in this code the address is. I don't suspect it will be too tricky using Regex, but as I don't speak... erm... dutch? I'm not entirely sure where on the page the address is, let alone in the HTML.
  4. You need to load the value from the cookie first, then increment it, then save it back to the cookie. You could add this at the top of your page.;; $centon = $_COOKIE['centon'];
  5. The format I've always used for JOIN'ing tables, is this... $query = "SELECT id, date_created FROM ap_form_1 JOIN ap_element_options ON ap_form_1.id = ap_element_options.form_id ORDER BY date_created DESC;
  6. It's realising it's an invalid date and adding the default value. What you want is this. date_default_timezone_set("Europe/Lisbon"); $data=date("Y-m-d");
  7. When you say 'all I get' are we talking when you echo out the value? when you add it to a database? May be a stupid question, but you have the variable name as $data, your not trying to insert $date into a database are you?
  8. Some of the characters in the string need to be escaped. I'm not great at Regex, but try this... preg_match_all("/<a.*?href=\"([^\"]*).*?>.*?<\/a>/is", $page, $matches);
  9. There are lots of ways you can access various information... <?php // access one specific servers information $current_server_id = 'Foo'; $current_server = $server[$current_server_id]; $current_server_ip = $current_server['ServerIP']; // loop through servers foreach($server as $k=>$s) { $current_server_id = $k; $current_server = $s; $current_server_ip = $s['ServerIP']; } ?> Does that help?
  10. As far as looping out the information goes, surely you just want something like... <?php echo '<b>Server Status:</b><br/>'; foreach($server as $s) { echo $s['ServerName'] . ': Status<br/>'; } ?> I'm not sure on how you plan on checking the status, is it a value in the array or is that the point of the question?
  11. Oops, you would, I put them in the wrong order, my bad. That should have said... <?php str_replace("http://", "", $_POST['url']); ?>
  12. Do you have to use regex? $path = "mysite.com/dl/10587125/09c6247/filename.html" $filename = basename($path);
  13. Your only actually sending one of the queries to the database. <?php $sql = "INSERT INTO answered(Qanswered, answer)VALUES('$question', '$yes')"; $result=mysql_query($sql); $sql = "UPDATE user SET Votes='1' WHERE USER ID='87654' "; $result=mysql_query($sql); ?>
  14. Never user mssql so difficult to say for certain. Can we see the PHP lines in question, I'm sure the error will stand out.
  15. Oh right, D'uh, I see what you mean. Is this the only way to do it, I don't especially want to create two extra files (the htaccess and the css.php files) just to set the header.
  16. I think your gonna have to be clearer about what your trying to do. When you mentioned removing images, we assumed you meant removing actual images, but the more you talk the less likely it seems this is what you want to do. It appears now that you wish to parse HTML text, and remove the <img /> tag for any image that has a width or height (or some combination) below a certain value. Is this the case? If it is, to what purpose? Where are you getting the HTML from initially?
  17. I realise I can use the header function to set the headers to the correct values, what I don't understand is how exactly to implement that. If I have a css.php with the code you gave in (ignoring the $_GET['file'], with the correct uri listed instead) how would I apply that to a standard HTML structured file? As a simple example let's say I have... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="/css/styles.css" media="screen, projection, tv " /> </head> <body> </body> </html> Am I understanding correctly that I would have the link href as href="/css/css.php" and then readfile(/css/styles.css) within that file? Also how do I apply the same theory to the images, bearing in mind alot of them are only referenced in the css (I will be changing the multiple files to a css sprite as soon as I can be bothered to learn how).
  18. I'm a Forest supporter, odd how I tend to miss that out of my introduction huh, lol.
  19. From an educational perspective I looked up RusselReal's function of mysql_list_fields, whilst it works the function is considered deperacated and the suggested replacement is "SHOW COLUMNS FROM `table`" (as used by neil.johnson).
  20. I've never really worked with classes so I couldn't say for that, but as far as dynamically generating an array of field names, I'd personally do something like... <?php $results = mysql_query("SELECT * FROM `table` LIMIT 1"); $row = mysql_fetch_assoc($results); $db_fields = array(); foreach($row as $k=>$v) { $db_fields[] = $k; } ?> Looking at neil. johnsons code (EDIT: and RusselReal's), he has used a similar method. I suspect it may be slightly more efficient, but I was previously unaware of the SHOW COLUMNS keywords. I didn't really need to post, but was intruiged as to whether somebody perhaps slightly more in the know could illustate a performance difference between my method and that of neil. johnsons.
  21. The OP didn't specify they wanted Hotmail.com e-mail addresses, they specified Hotmail addresses (which I assume would include .co.uk and any other variants, especially looking at the OPs Regex). Obviously you could use SELECT * FROM TABLE WHERE `email` LIKE '%hotmail%', but this would match an email address of hotmail_sucks@yahoo.com (prepare to be found by a spambot crawler if you own that address), which I assume is not wanted. Regex certainly seems the way forward.
  22. <?php str_replace($_POST['url'], "http://", ""); ?>
  23. cags

    Syntax

    I believe the correct format would be... `vni`.`FROM`. Have you tried... SELECT count(*) as count, `vni`.`id`, `vni`.`FROM`, unread, `vni`.`message`, `vni`.`network`, `vni`.`READ`, DATE_FORMAT(vni.DATE, '%b %e at %l:%i%p') DATE, `vn`.`number` FROM media_1.virtual_number_inbox vni INNER JOIN `media_1`.virtual_numbers vn ON `vni.vnID` = `vn.id` INNER JOIN (SELECT count(*) unread FROM media_1.virtual_number_inbox WHERE userID = '1' AND `READ` = '0' AND `FROM` = `vni`.`FROM`) as unreadcount WHERE `vni.userID` = '1' GROUP BY `vni`.`FROM` I'm not entirely sure if the structure of some of this code is right, for exaxmple... FROM media_1.virtual_number_inbox vni Are they two different tables, if so, should they not have a comma between them? Same applies on the next line.
  24. cags

    Syntax

    Either your using some advanced MySQL technique I don't know about, or FROM is a field in your vni table. This is likely to cause problems because FROM is a keyword in mysql and you have it listed in your code without back ticks (at the start where specifying which fields to SELECT, and again near the end of line 4 and again on line 6).
  25. Touching on whats been covered so far. Sessions are essentially a cookie that is stored on the server as opposed to the client PC. In order to associate that client PC with the correct cookie, sites use a SESSION_ID. By default SESSION_ID's are stored on the client PC as a cookie. That's not the only way of doing it (just the simplest), it's possible to persist the SESSION_ID using a GET or POST variable.
×
×
  • 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.