Jump to content

bothwell

Members
  • Posts

    103
  • Joined

  • Last visited

    Never

Everything posted by bothwell

  1. Sometimes webhosts provide a barebones script to their customers in cpanel or whatever admin console they use. Most other people probably just use whatever they can get to work from hotscripts.com or similar: http://www.hotscripts.com/category/php/scripts-programs/form-processors/
  2. Resolved. The answer is to use a dot as the select value rather than the node title (while selecting the parent node of the one you want to loop ). <xsl:template match="photos" name="pics"> <xsl:for-each select="photos/photo"> <xsl:sort select="photo"/> <p>[i][b][u]<xsl:value-of select="."/>[/u][/b][/i]</p> </xsl:for-each> </xsl:template>
  3. bothwell

    Looping in XSLT

    N00b to XSLT - can't quite figure out how this loop works. The code below returns the first result from <photos> rather than all three from the node. How can I return all of the results in a loop? XML: <properties> <property> <propertyID>135427</propertyID> <photos> <photo>/proppics/594/picture_130428_1.gif</photo> <photo>/proppics/594/picture_130428_2.gif</photo> <photo>/proppics/594/picture_130428_3.gif</photo> </photos> </property> </properties> XSLT: <xsl:template match="/"> <xsl:for-each select="properties/property[propertyID=$id]"> <tr> <th><xsl:value-of select="ShortAddress1"/>, <xsl:value-of select="Area"/>, <xsl:value-of select="City"/>, <xsl:value-of select="Postcode"/></th> </tr> <tr> <td> <xsl:element name="allpics"> <xsl:call-template name="pics"></xsl:call-template> </xsl:element> </td> </tr> </xsl:for-each> </xsl:template> <xsl:template match="photos" name="pics"> <xsl:for-each select="photos"> <p><xsl:value-of select="photo"/></p> </xsl:for-each> </xsl:template> Thanks for any help!
  4. The reason the bottom table has put the boxes further away to the right is because it's expanding the tables to 100% and also expanding the td widths so that they fit the data inside them. You can fix this behaviour by setting your table column widths explicitly with: td width="n" Where 'n' is either a pixel width or a percentage width that you want. Note that if you use % widths then the tables will be liquid, whereas pixel widths are more predictable but inflexible. You may also wish to look at how colspan works.
  5. No problem - file paths are a reasonably frequent 'gotcha' for me, to the extent that I'll often specifically define WWW_ROOT in a config file so I can just prepend any file declarations with it.
  6. If it's a *nix server, then create a php file that runs the delete query you need, and then set up a cron job on the server to ping that file every 10 minutes. Your hosting package will have the details for creating cron jobs in its FAQ somewhere, probably.
  7. Wrong, session_start() must be placed on every page that you wish to access the super-global $_SESSION. Yes, this is true. I always put it in header.php so I forget about it right away
  8. $_SERVER['DOCUMENT_ROOT'] might not be what you expect - try echoing out $_SERVER['DOCUMENT_ROOT'] . '/gh/nav_game/' . $_GET['game'] . '.php' And its variations and check that the filepath it thinks it's looking for is the same filepath that you think it should be looking for.
  9. You only need to start the session once, in your login page. The session info will pass through to all your pages itself, you shouldn't need to do anything else.
  10. Wrap the forms in a div each and apply a CSS float to the left-most one: <div style="float:left"> <form method="post" action="index3.php" > <input name="username" value="<?php echo $user; ?>" type="hidden"><input name="password" value="<?php echo $pass; ?>" type="hidden"><INPUT TYPE="image" SRC="img/forgotten_password.gif" style="padding: 5px; display: inline;" BORDER="0" ALT="Submit Form"> </form> </div> <div> <form method="post" action="read.php" ><input name="username" value="<?php echo $user; ?>" type="hidden"><input name="password" value="<?php echo $pass; ?>" type="hidden"><INPUT TYPE="image" SRC="img/stolen_password.gif" style="padding: 5px; display: inline;" BORDER="0" ALT="Submit Form"> </form> </div> <br clear="left"/>
  11. Or alternative to the above: SELECT ip.item_id, ip.points_spent, ip.purchase_date, i.title, i.file_path FROM {items_purchased} ip, {items} i WHERE user_id = $user_info[user_id] AND ip.item_id = i.item_id AND (pack_id BETWEEN 1 AND 4) ORDER BY i.title ASC Edit: pack_id will still be ambiguous with the above. You need to use the dot operator on the pack_id command, like where you've got ip.item_id so that mysql knows which table you mean.
  12. It is a bit strange. According to php.net the format you're trying to send in is perfectly valid. Have you tried it on a live email server at all? It might just be some sort of config issue with your hMailserver (I'm assuming you're using that in a dev enviro).
  13. Your first debug action should be to make sure that the url parameters are found in the array or not: if (in_array($_GET['game'], $games)) { print "game is in array"; } else { print "game not found in array"; } Also try echoing out the contents of $_SERVER['DOCUMENT_ROOT'] . '/gh/nav_game/' . $_GET['game'] . '.php' to make sure that the filepath it's eventually trying to use is what you expect. Do you always get the default game page, or does something else happen?
  14. You'd think so, yer :/ Was your last attempt setting both $to = 'wi@company.com'; and $headers .= 'To: GM-WEBIMPORT <wi@company.com>' . "\r\n"; in the script?
  15. Your mail sending line should read: mail($destination,"Web Enquiry",$mes,$header,'-fyou@yourdomain.com'); Replace you@yourdomain.com with your own from address, leaving the -f part in front of it as in the example.
  16. Try using the $headers option instead, so something like: ... $headers .= 'To: GM-WEBIMPORT <wi@company.com>' . "\r\n"; $headers .= 'From: The Sender <thesender@company.com>' . "\r\n"; $headers .= 'Bcc: youremail@company.com' . "\r\n"; ... mail($to, $subject, $message, $headers);
  17. Yeah, it's all guess-work for me, too, especially since I can't replicate the problem at all! I'm calling imagedestroy() at the end of the resize, but I guess the problems are starting before it even gets to that point. Good call on the error logs, I'll enable those and see what transpires. Thanks!
  18. if ($credits <> 0) Should be: if ($credits != 0) or: if ($credits > 0) The '<>' not-equal-to syntax is for MySQL, rather than PHP
  19. Only jpg files can be uploaded by design, so it can't be a filetype problem. Sometimes if a different machine is used, the exact same file can be uploaded and then processed properly, so I'm confident there aren't any problems with the functions that are being used, something else strange is going on. Honestly, script time-out is my only idea at this point, but even that doesn't make a lot of sense given that the problem is so sporadic.
  20. Change your first line to: if($_POST['RadioGroup'] == 'ken' || $_POST['RadioGroup'] == 'chris') { $destination="sarah@here.com"; } else if ($_POST['RadioGroup'] == 'clap' || $_POST['RadioGroup'] == 'put') { $destination = 'somewhere@else.com'; } The || operator means 'or'. Your radio buttons on your form should have name="RadioGroup" in their attributes as well.
  21. Hi guys, one of my clients has been having problems for a long time with image uploading - I've tried several methods to try and get it working, and thought "hurrah! Finally!" when they reported success using Uploadify. You can imagine my disappointment when I got an email saying 'oh, I tried it from the laptop at home and it wouldn't work'. The code process goes like this: Image comes in through $_FILE Gets a new name set move_uploaded_file does its stuff image is resized to sane dimensions A record is put in a database I've learned now that what happens when it fails is that the code steps through to move_uploaded_file and then fails on the resize method. There's nothing actually wrong with the resize method - I have never been able to replicate the behaviour my client is reporting on any machine, it always works for me. Moreover, the behaviour only apparently occurs on certain machines. What on earth could be causing this? Script timeouts if they upload gigantic files? But why would it only happen on certain boxes? The time of day doesn't seem to matter either. I'd really appreciate any ideas you guys might have about where the problem could be, this is completely beyond me. Mods feel free to move this if it's in the wrong place - couldn't quite decide if I need PHP help or server help!
  22. You've already got your root directory set as $home, so just build it from there. echo '<a href="'.$home.'">Home</a> / <a href="'.$home'music">Music</a><br/>';
  23. Well, one thing I can see from the actual url for the page is that it's actually designed to go in an iframe (the IFRAME value that's in the type parameter). I'm guessing that the failure to load is on hopfeed's end as a security precaution and that you're not likely to be able to do what you want to do. You should really be using an iframe for it or seeing if they've got any other specific parameterised URLs that don't rely on an iframe type to work.
  24. You need to start a session before any other output on the page, including HTML. See here: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  25. What the hell? ??? Well, I've no idea how to fix the encoding, but we can convert the character to its html entity, I guess. while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $data = htmlentities($data); $import="INSERT into imba(name,class,spec,role,normal,best,warnings,warnings2,normal2,best2) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[5]','$data[6]','$data[7]','$data[7]','$data[5]','$data[6]')"; mysql_query($import) or die(mysql_error()); } This should get it into your database at least.
×
×
  • 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.