Jump to content

soak

Members
  • Posts

    219
  • Joined

  • Last visited

    Never

Everything posted by soak

  1. Pretty sure you can do it from within cpanel somewhere. You shouldn't need to download anything AFAIK.
  2. Sorry, my mistake, the bcc emails should be seperated by a comma not a newline: <?php include 'db.php'; $message = $_POST['message']; $subject = $_POST['subject']; if(isset($_POST['submit'])){ if((!$message | !$subject)){ echo'You are missing some required information please go back and fill out all the required information'; } else { $sql = mysql_query("SELECT email FROM members ORDER BY `id` ASC"); if (mysql_num_rows($sql)) { $bcc = array(); while ($result = mysql_fetch_assoc($sql)) { $bcc[] = $result["email"]; } $from = 'email'; $to = 'email'; $header = "Bcc: ".implode(", ", $bcc)."\r\n" $header .= 'From: <no-reply@domain.org>' . "\r\n"; mail($to, $subject, $message, $header); } } } ?>
  3. http://uk2.php.net/getimagesize returns false and generates an E_NOTICE when the read fails or E_WARNING when the image is invalid so you could check for the false. I'd also prefix it with an @ to ensure that any errors are never displayed. I suspect that there are more "proper" ways of doing this. I never like having to prefix code with @.
  4. Yep, all you need is the php extension. Have you checked to see if it's already there with phpinfo()? If it's not I'll have to pass, I don't use cpanel a lot. There should be plenty of guides out there though and I suspect it's faurly simple once you find the right area in cpanel.
  5. SELECT *.wp, u.username, u.avatar, (SELECT COUNT(*) FROM wall_posts AS wpc WHERE wpc.poster_id = u.id) AS postcount FROM wall_posts AS wp JOIN users AS u ON u.id = wp.poster_id WHERE parent_id=". (int) $_GET['id'] ." ORDER BY post_id LIMIT 30 Should do the trick I think
  6. @Mchl, your code is missing for me but I'd do something like: SELECT * FROM cms_table WHERE DATE_FORMAT(date_field, '%m-%Y') = '01-2009'; to get all articles from January 09. This is "bad" for MySQL as you're forcing it to format all dates in the cms table to find the ones it needs. A better way would be to have a field in that table formatted accordingly.
  7. What OS and do you have ssh access or just cpanel? You'll also need the application imagemagick installed on the server
  8. When I run it I get: string(49) "http://img17.imageshack.us/img17/2729/porlhh7.gif" returned which seems fine. I've even checked the headers that imageshack is sending using teh web dev toolbar and they look fine too. I have noticed that sometimes imageshack is slow though so is possible your script may be timing out. :shrugs:
  9. You are never looping the results returned: <?php include 'db.php'; $message = $_POST['message']; $subject = $_POST['subject']; if(isset($_POST['submit'])){ if((!$message | !$subject)){ echo'You are missing some required information please go back and fill out all the required information'; } else { $sql = mysql_query("SELECT email FROM members ORDER BY `id` ASC"); if (mysql_num_rows($sql)) { $bcc = array(); while ($result = mysql_fetch_assoc($sql)) { $bcc[] = $result["email"]; } $from = 'email'; $to = 'email'; $header = "Bcc: ".implode("\r\n", $bcc)."\r\n" $header .= 'From: <no-reply@domain.org>' . "\r\n"; mail($to, $subject, $message, $header); } } } ?>
  10. I think you want: <?php if($_SESSION['cart']) { //if the cart isn't empty foreach($_SESSION['cart'] as $product_id => $product){ echo '['.$product['name'].'-'.$product['price'].']<br/>';} } EDIT: to add code tags
  11. Your expiry time is incorrect, assuming you want the cookie to last one hour your string should be: setcookie("auth", "1", time()+3600, "/", "whatever.com", 0);
  12. Can you post an example imageshack link please?
  13. That is how you do redirection. I can see two immeditate things wrong with your code. Your "=" should be "==" to test for a value and also $id is never being set to the value of $_GET['id']
  14. You need a SQL join. <?php $carrot = "SELECT *.wp, u.username, u.avatar FROM wall_posts AS wp JOIN users AS u ON u.id = wp.poster_id WHERE parent_id=". (int) $_GET['id'] ." ORDER BY post_id LIMIT 30"; $rabbit = mysql_query($carrot) if(!$rabbit) { echo "Oops, bad rabbit ($carrot)! " . mysql_error(); exit; } if(mysql_num_rows($rabbit)==0) { echo "Wall is empty."; } else { while($hat = mysql_fetch_assoc($rabbit)) { #ANOTHER BRICK IN THE WALL echo "post_id: ".$hat['post_id']." poster_id: ".$hat['poster_id']." posted: ".$hat['posted']." body: ".$hat['body']; echo "<br />"; } } Note that I cast $_GET['id'] as an int to protect against SQL injection. Please also give your variables sensible names. It's all very cute for you but it's gonna be no fun for anyone else having to debug your page.
  15. Before what? What did you change? if you add a die('x'); to just after if (isset($_POST['submit'])) { you'll see if it's getting that far. If it's not then likely something is broken client side.
  16. Try something like this, that way you're ensuring that people can't just load any random page on your site (a good thing) and you have the default there in case it's not one of your allowed pages. switch($_GET['page']) { case "mail": case "include": $page = $_GET['page']; break; default : $page = 'main'; } include($page.'.php');
  17. Try them again, they definitely do work! If you have problems then post your code snippet and we can advise. Something like: <?php $search_name = mysql_real_escape_string($search_name); $sql="SELECT userid, DISTINCT username, userlevel, donatordays, gender, level, money, points, house, location, gang, laston FROM users WHERE username LIKE '%$search_name%'"; ?>
  18. You're nearly there first time, just remove the single quotes: $oFCKeditor->Value= $row[cont] ;
  19. Can you post the code that isn't working please?
  20. If you use jQuery then jClock is very easy to use: http://jquery.jclock.js.googlepages.com/
  21. The root needs to be a filesystem path rather than a web url for including. try: $CFG->root = dirname(__FILE__);
  22. Try this: <?php include('stylesR2R.css') ?> <html> <body> <?php include ("dbinit.php"); ?> <font size="12" face="arial">Search Results.</font><br> <font face="arial"> <a href="runnersDirectory.php">Runners Directory.</a><br> <a href="index.php">Find a Runner.</a><br> <br> <?php // Bring me the data!!! $fields = array('firstName', 'lastName', 'age', 'sex', 'raceName', 'distance', 'city', 'state', 'date', 'time', 'place', 'divPlace', 'pace'); $fieldSql = array(); foreach ($fields as $field) { if (!empty($_GET[$field])) { $fieldSql[] = '`'.$field.'` LIKE \''.mysql_real_escape_string($_GET[$field]).'%\'; } } if ($fieldSql) { $query = 'SELECT * FROM `records` WHERE '.implode(' OR ', $fieldSql); } else { $query = 'SELECT * FROM `records`'; } $result = mysql_query($query, $db) or die(mysql_error().": $query"); $runners = mysql_fetch_assoc($result); ?> <?php if ($runners) { ?> <?php include('recordsTable.php'); ?> <?php }else{ echo "The runner you have searched for is not listed in this directory."; }?> <br><br><?php include('footerR2R.html') ?> </body> </html>
  23. If you're reading or writing a csv file then PHP (since 5.1) has built in functions that make it really easy: fputcsv and fgettcsv
  24. I'm pretty sure there's not, I think you need to assign it first. I know that array_pop, push etc don't like running on an explode.
  25. You could probably accomplish this pretty quickly yourself with file_get_contents/curl and simplexml.
×
×
  • 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.