Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. I used imageflip to flip the image horizontally and vertically so the text appears to be written from top to bottom. header('Content-type: image/png'); // create a 100*100 image $im = imagecreatetruecolor(100, 100); // Write the text $textcolor = imagecolorallocate($im, 0xFF, 0x00, 0xFF); imagestringup($im, 3, 40, 80, 'gd library', $textcolor); // write text bottom to top /* Flip the image, so text is top to bottom */ imageflip($im, IMG_FLIP_HORIZONTAL); imageflip($im, IMG_FLIP_VERTICAL); echo imagepng($im); imagedestroy($im);
  2. Runs fine for me. Link for anyone to test http://jsfiddle.net/WFsYL/ Maybe a stupid question but have you checked that you have javascript enabled on firefox and chrome? Also does the browser's (developer/javascript) console show any errors?
  3. You are getting that error because you are defining the myCallback function more than once, eg // define myCallback for first time function myCallback ($matches) { // SOME CODE } $bbcode = preg_replace_callback($pattern1,'myCallback',$bbcode); // callback #1 // define myCallback a second time function myCallback ($matches) { // SOME CODE } $bbcode = preg_replace_callback($pattern2,'myCallback',$bbcode); // callback #2 it is ok to have multiple calls to the same callback function // define myCallback once function myCallback ($matches) { // SOME CODE } $bbcode = preg_replace_callback($pattern1,'myCallback',$bbcode); // callback #1 $bbcode = preg_replace_callback($pattern2,'myCallback',$bbcode); // callback #2
  4. or it could mean the code is causing an error. Check your servers error log or enable error reporting at the top of the script ini_set('display_errors', 'On'); error_reporting(E_ALL); As a side note I think it would be better if you performed your queries using the database object ($wpdb) provided by wordpress rather than using the mysql_* functions
  5. This is what your code should be <?php if($post->post_type=='event') { $q1=mysql_query("SELECT * FROM table_name WHERE type = 1 AND cat = $post->ID "); if (mysql_num_rows($q1)) { $row_diamond=mysql_fetch_object($q1); ?> <td width="115" align="right" valign="middle" id="diamond1"><strong style="position:relative;bottom:-25px;">Presented by: </strong></td> <td id="diamond2" width="190"> <a href="<?=$row_diamond->website?>" title="<?=$row_diamond->website_title?>" target="_blank" style="cursor:pointer;"><img style="position:relative;bottom:5px;" src="<?php bloginfo('siteurl'); ?>/wp-content/plugins/sean_event/files/<?=$row_diamond->image?>" alt="<?=$row_diamond->alt_text?>"border="0"></a> <br /> </td> <?php } else{ ?> <td width="115" align="right" valign="middle" id="diamond1"> </td> <td id="diamond2" width="190"> </td> <?php } } ?>
  6. This is you logic error here if ($q1){ You should be checking to see if the query has returned any results. mysql_query only returns false if there is an error. You can use mysql_num_nows to see if the query returned any results. if (mysql_num_rows($ql) != 0){ $row_diamond=mysql_fetch_object($q1);
  7. mod_rewrite is not a PHP extension! It is an Apache module, which you can enable in the httpd.conf
  8. You need to check both variables values if ($_POST['blogarticle'] == "" || $_POST['blogtopic' ] == "") { // one or bott fields are empty } // OR alternatively use if (empty($_POST['blogarticle']) || empty($_POST['blogtopic' ])) { // one or both fields are empty }
  9. Where is $blogarticle and $blogtopic defined? If you have not defined them yet then you need to use $_POST['blogarticle'] and $_POST['blogtopic'] instead.
  10. When the user logs in does your website login code set the users id to the $_SESSION['id'] variable? Also as paddyfields said you must call session_start() in order for the $_SESSION data to persist.
  11. freichat requires the users id not their username! The three steps you need to do are listed in the wiki
  12. It is a domain resolution problem. Computers need to convert a domain name into an address in order to now where the device is located. The domain resolution is done via DNS this is what could be causing the delay.
  13. Change echo "<span class=\"$cf_i\">" . str_ireplace(';', "</span>, <span class=\"$cf_i\">", substr($i->fields[$cf_active_all[$cf_i]],1,-1) . '</span>'); to $fields = explode(';', substr($ifields[$cf_active_all[$cf_i]],1,-1)); $classes = array('odmb', 'odcr', 'odmb', 'odlgv', 'odtr'); foreach($fields as $key => &$field) { $field = '<span class="'.$classes[$key].'">'.$field.'</span>'; } echo implode(', ', $fields);
  14. What is the output of these statements printf('<pre>%s</pre>', print_r($i->fields, true)); printf('<pre>%s</pre>', print_r($cf_active_all, true)); What classes are you wanting to apply and to which fields?
  15. If all fields are going to have the same class then replace $cf_i with the name of the class you want to apply. If you want separate classes for each field then you will need to post more code, and what fields require which class.
  16. Does it improve if you use 127.0.0.1 instead of (localhost $dsn = 'mysql:host=127.0.0.1;port=3306;dbname=MyDatabase;charset=UTF8'; That code has got nothing to do with how long the script took to execute. It returns the memory usage. You should not be using this to determine how long your script took to execute. EDIT: To time script execution you'll want to use something like the examples here
  17. Then change echo to $xml .=
  18. Not sure but you could try echo "<span class=\"$cf_i\">" . str_ireplace(';', "</span>, <span class=\"$cf_i\">", substr($i->fields[$cf_active_all[$cf_i]],1,-1) . '</span>'); If not you'll need to post more code
  19. By wrapping your input fields within <form></form> tags <form action="file/to/process/form.php" method="post"> // your form fields here </form>
  20. $b_i is a variable which is being used as an array key for $diddy_all. Maybe you mean to add the span to the echo? echo "<span class=\"$b_i\">" . str_ireplace(';', ', ', substr($i->fields[$diddy_all[$bi_i]],1,-1)) . "</span>";
  21. You'll need to strip the number formatting when finding the minimum value. A modification of Barands code $min = 99999.99; foreach($xml->xpath('//Company') as $co) { if ($co->SLevel != '-') { $min = min($min, str_replace(',', '', $co->SLevel)); // strip number formatting } } $min = number_format($min, 2, ',', '.'); // format minimum value foreach( $xml->xpath("//Company[SLevel='$min']") as $lowest) { echo "$lowest->Name : $lowest->SLevel<br>"; }
  22. Ok, then use function setValue($fieldValue, $joinValue = ''){ $trimValue = trim(str_replace(array(' ','\t','\n','\r','\0','\x0B'), '', ($fieldValue))); return empty($trimvalue) ? 'No' : $joinValue . $trimvalue; } $xml .= "\t<soundPath>" . setValue($row['soundPath'], 'www.some url.com/somefolder/'). "</soundPath>\n";
  23. $complaint should be $debtor on line 94
  24. You just call mysq_real_escape_string on the users value $comp = $_GET['comp']; $sql="SELECT complain FROM complaint c WHERE c.d_name = '" . msyql_real_escape_string($comp) . "'";
  25. If $row['soundPath'] contains the actual path then use $xml .= "\t<soundPath>" . fieldExists($row['soundPath']) . "</soundPath>\n";
×
×
  • 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.