Jump to content

kenrbnsn

Staff Alumni
  • Posts

    8,234
  • Joined

  • Last visited

Everything posted by kenrbnsn

  1. You have to concatenate anything else onto the $message variable if you want more to appear in the email message. Where you have: <?php if (!empty($title1)) { echo '<br/>$title1:'; } if (!empty($title2)) { echo '<br/>$title2:' ; } if (!empty($title3)) { echo '<br/>$title3:'; } if (!empty($title4)) { echo '<br/>$title4:'; } if (!empty($title5)) { echo '<br/>$title5:'; } if (!empty($title6)) { echo '<br/>$title6:'; } if (!empty($title7)) { echo '<br/>$title7:'; } if (!empty($title8)) { echo '<br/>$title8:'; } ?> If you want those strings in the message you have to do something like <?php if (!empty($title1)) { $message .= '<br/>$title1:'; } if (!empty($title2)) { $message .= '<br/>$title2:' ; } if (!empty($title3)) { $message .= '<br/>$title3:'; } if (!empty($title4)) { $message .= '<br/>$title4:'; } if (!empty($title5)) { $message .= '<br/>$title5:'; } if (!empty($title6)) { $message .= '<br/>$title6:'; } if (!empty($title7)) { $message .= '<br/>$title7:'; } if (!empty($title8)) { $message .= '<br/>$title8:'; } ?> And then, after the "// etc..." <?php $message .= "</th> </tr> <tr> <th>Price:</th> <th>$total </th> </tr> <tr> <th>Registrant:</th> <th>$name</th>"; ?> Ken
  2. Does the user that the webserver is running under have permission to do a sudo? Ken
  3. Yes there is. You have to terminate the string with a "; or else you get the error you're getting. <?php $message = "<html> <style type='text/css'> #apDiv1 { position:absolute; left:338px; top:278px; width:311px; height:129px; z-index:1; } #apDiv2 { position:absolute; left:50px; top:207px; width:181px; height:149px; z-index:2; } #apDiv2 { text-align: center; } </style> </head> <body><div id='apDiv1'> <table width='408' border='1' cellspacing='2' cellpadding='2'> <tr> <th width='90' scope='col'>Event(s):</th> <th width='298' scope='col'>"; // <----- see the added "; ?> Ken
  4. You could do something like this: <?php $tmp = array('tech'=>$tech,'crew'=>$crew,'number'=>$number); foreach ($tmp as $f=>$v) { if ($v == '') { $tmp[$f] = 'Not Assigned'; } } ?> When you want to use the value, you would need to get the value from the array. Ken
  5. I tested with: <?php $json_str = '{ "email": "l-wilson-1986@hotmail.co.uk", "titleitalic": "normal", "profileDetails": "#d0deea", "titlefontcolor": "none", "titleoffsettop": 100, "titleoffsetleft": 100, "aboutbackgroundcolour": "transparent", "aboutunderline": "none", "aboutfontfamily": "Arial", "aboutbold": "normal", "aboutitalic": "normal", "aboutfontcolor": "#d0deea", "aboutoffsettop": 325, "aboutoffsetleft": 100, "statusoffsetleft": 450, "statusinfooffsetright": 250, "pictureoffsetleft": 100, "profilebold": "normal", "profileunderline": "none", "profileitalic": "normal", "profilefontcolor": "#fff", "profilefontfamily": "Arial", "profilebackgroundcolour": "#2c3c49" }'; $x = json_decode(($json_str),true); echo '<pre>' . print_r($x,true) . '</pre>'; $json_errors = array( JSON_ERROR_NONE => 'No error has occurred', JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded', JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded', JSON_ERROR_SYNTAX => 'Syntax error', ); echo 'Last error : ', $json_errors[json_last_error()], PHP_EOL, PHP_EOL; ?> And it works fine. There has to be something wrong with the incoming string. If you have magic quotes turned on there are probably backslashes escaping the quotes in the string. Use stripslashes on it before passing it to json_decode <?php $myjson = stripslashes($_POST['jsonstring']); ?> Ken
  6. Why are you trying to create a directory using a URL: <?php mkdir("http://multi-search.org/BSGN/$secure_folder", 0777); ?> The mkdir function takes a path to the directory in the local filesystem. Ken
  7. The format for storing the date really has no relation to how you present it to the user. Present it to the user the way they are use to seeing it. Ken
  8. This line <?php $sql = "SELECT * FROM `users` WHERE `id`='".username."'"; ?> probably should be <?php $sql = "SELECT * FROM `users` WHERE `id`='$username'"; ?> Ken
  9. When I run your code, I get: Plus you're not echoing the result. Try: <?php class findName { private $name; public function setName($sname='') { if(!$sname) { $this->name = "There is no name to return."; } else { $this->name=$sname; } } public function getName() { return $this->name; } } $n = new findName(); $n->setName(); echo $n->getName() . "<br>\n"; ?> Ken
  10. You're missing the terminating quote and semi-colon at the end of this string: <?php $message = "<html> <style type='text/css'> #apDiv1 { position:absolute; left:338px; top:278px; width:311px; height:129px; z-index:1; } #apDiv2 { position:absolute; left:50px; top:207px; width:181px; height:149px; z-index:2; } #apDiv2 { text-align: center; } </style> </head> <body><div id='apDiv1'> <table width='408' border='1' cellspacing='2' cellpadding='2'> <tr> <th width='90' scope='col'>Event(s):</th> <th width='298' scope='col'> ?> Ken
  11. You seem to be posting code sections, not continuous code, since the code you posted has a mixture of HTML and PHP with the starting "<?php" tag. Please post all of the code. Ken
  12. If you do a show source on the web page, you will see that the & was changed to &. It's just that the browser is display a "&" for the "&" Ken
  13. Sure it works. You can do that with any array. Instead of asking the question and waiting for a reply, it's easy enough to try it in a quick script. Ken
  14. Be carefull with empty, since it can return a false positive if the string being checked contains a single zero: <?php $x = '0'; if (empty($x)) echo "$x is empty<br>\n"; else echo "$x is not empty<br>\n"; ?> The above code will print 0 is empty Ken
  15. Try: <?php $sites = array_map('trim',file('file.txt')); //read the whole file into an array & trim the newline character from the end of each line foreach ($sites as $link) { echo "<a href='$link'>$link</a><br />"; } ?> Ken
  16. What does the content of the file look like? Ken
  17. This line <?php mail(isInjected($to), isInjected($subject), isInjected($message), isInjected($headers)); ?> is not going to work, since the function isInjected() returns only a "true" or "false" value and the mail() function is expecting strings as parameters. Do the calls before calling mail() and only do the mail() function if all the returned values are "true". Ken
  18. Please show us your code between tags. Ken
  19. Please post your current code. Ken
  20. You can try reversing the single and double quotes: <?php $isql = oci_parse($conn, "INSERT INTO 'useridA' VALUES ('$userid')"); ?> Ken
  21. If you want help on the forum, the quickest way to get it is to post your code here between tags. Ken
  22. You have to explain why it's not working. "still isn't working" doesn't tell us very much. PHP errors? MySQL errors? Logic errors? Ken
  23. If this is the line <?php $q = "SELECT * FROM pages WHERE subject_id = {$row['id']"; ?> you're missing the terminating "}" after the "]": <?php $q = "SELECT * FROM pages WHERE subject_id = {$row['id']}"; ?> Ken
  24. You need a condition on each piece of the WHERE, try: <?php $sql = "SELECT `user_id`, `friend_id` FROM `partners` WHERE `user_id` = '${user_info['uid']}' OR `friend_id` = '${user_info['uid']}'"; ?> Ken
  25. Using the "{}" around an array reference within a string delimited by double quotes is fine. With MySQL you don't need to include the connection in the MySQL function call, it is optional. You need to include it in the MySQLi function call. To the OP, please use my code and post the exact message that is displayed on the browser and please don't SHOUT. Ken
×
×
  • 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.