php help needed - pls

11 replies
Hey guys

I have just gotten a script for my wife and I think there is a problem.

Can someone have a quick look and let me know what the problem is?

MyTickerScript.com Ticker Generating Script is the url

many thanks

Kevin
#needed #php #pls
  • Profile picture of the author wayfarer
    We can't see any of the source by looking at a URL, PHP code is not viewable through a browser. It would be more helpful to see the actual PHP code in question in question around line 198 in config.php, and around lines 147-172 in main.php.

    Did you confirm that the directories /home/bitz/public_htmlsl/ and /home/bitz/public_htmlbg/ actually exist? If they do exist, there may be a permissions problem. You can set the permissions through your FTP application. The highest level of permissions is "777", which will allow you to read, write, and execute in that directory.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[219072].message }}
  • Profile picture of the author wayfarer
    Well, there needs to be a public_htmlbg folder according to the error that is being outputted, so it is looking for that directory and not finding it. It is quite possible that the config.php file needs to be altered, as it is quite common to have such files to customize scripts according to your needs, much like a Wordpress installation needs to have connection information, etc changed in order for it to run.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[219101].message }}
    • Profile picture of the author Kevin Birch
      Hi

      here is the editable bit of config.php:

      <?php
      if ( !isset( $__template_number ) ) {
      $__template_number = 1;
      }

      $__admin_user = "kevinb"; // User name to log into administration backend
      $__admin_pwd = "xxxx"; // Password to log into administration backend

      $__your_web_site_name = "Ticker Bits"; //Your website name

      $base_path = "/home/bitz/public_html";
      $main_path = "http://www.tickerbits.com/";
      $template_images_path = "http://www.tickerbits.com/images/{$__template_number}/";
      $uploaded_images_folder = "/uploads/";
      $path_to_smarty = "/home/bitz/public_html/smarty/libs/";
      $path_to_templates = "/home/bitz/public_html/templates/";
      $basepath_to_fck = "/home/bitz/public_html/FCKeditor/";
      $path_to_fck = "/FCKeditor/";

      $mysql_host = "localhost"; // Hostname of server where MySQL is installed, typically localhost
      $mysql_db = "bitz_ticker"; // MySQL database name
      $mysql_user = "bitz_admin"; // MySQL user name
      $mysql_pwd = "xxxx"; // MySQL user password

      // DO NOT EDIT PAST THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING

      Can you see anything in there?

      The script also isn't displaying the background and sliders

      Cheers
      {{ DiscussionBoard.errors[219110].message }}
  • Profile picture of the author wayfarer
    What is on line 198?

    ***EDIT***
    ah... wait... I figured it out...
    on the line that reads:

    $base_path = "/home/bitz/public_html"

    make it say:

    $base_path = "/home/bitz/public_html/"

    with a slash at the end... there's your typo. It is expecting there to be two paths, and putting the strings together to look for directories public_htmlbg/ and public_htmlsl/ when it should be looking for public_html/bg/ and public_html/sl/
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[219115].message }}
    • Profile picture of the author Kevin Birch
      HI - notepad doesn't do lines . . here is the full file:

      <?php
      if ( !isset( $__template_number ) ) {
      $__template_number = 1;
      }

      $__admin_user = "kevinb"; // User name to log into administration backend
      $__admin_pwd = "xxxx"; // Password to log into administration backend

      $__your_web_site_name = "Ticker Bits"; //Your website name

      $base_path = "/home/bitz/public_html";
      $main_path = "http://www.tickerbits.com/";
      $template_images_path = "http://www.tickerbits.com/images/{$__template_number}/";
      $uploaded_images_folder = "/uploads/";
      $path_to_smarty = "/home/bitz/public_html/smarty/libs/";
      $path_to_templates = "/home/bitz/public_html/templates/";
      $basepath_to_fck = "/home/bitz/public_html/FCKeditor/";
      $path_to_fck = "/FCKeditor/";

      $mysql_host = "localhost"; // Hostname of server where MySQL is installed, typically localhost
      $mysql_db = "bitz_ticker"; // MySQL database name
      $mysql_user = "bitz_admin"; // MySQL user name
      $mysql_pwd = "xxxx"; // MySQL user password

      // DO NOT EDIT PAST THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING

      $__font_size = 10;
      $__min_font_size = 6;
      $__week_font_size = 8;
      $__font = "{$base_path}includes/tahoma.ttf";

      $max_image_size = 1048576*3; // 3Mb
      $preview_width = 128;

      $DEFAULT_FCK_WIDTH = 600;
      $DEFAULT_FCK_HEIGHT = 450;

      $DEFAULT_INPUT_WIDTH = 400;

      $__weeks_data = array(
      0 => 'Congratulations! After recognizing the early signs of pregnancy you have now entered the first trimester of pregnancy',
      1 => 'Congratulations! After recognizing the early signs of pregnancy you have now entered the first trimester of pregnancy',
      2 => 'At this point in time your baby is too small to detect with the naked eye even though he is growing remarkable fast',
      3 => "Your baby at 4 weeks is still incredibly miniscule, about .014 to .04 inches long. That is roughly the equivalent to 1/2 to 1mm long, which isn't very long at all",
      4 => 'During the early part of this pregnancy at 5 weeks the central nervous system, muscles, bones and even the heart will begin to form',
      5 => 'Your baby is growing! During pregnancy week 6 your physician will measure your baby with ultrasound',
      6 => 'During pregnancy week 7 your baby will grow tremendously, up to 13 mm in length! Your baby is much closer to the size of a large blueberry or small grape by 7 weeks pregnant than a pea',
      7 => 'Your baby is doing a lot of growing during pregnancy 8 weeks. Up until this point in time your baby had a small tail... that starts to disappear this week, and your little one will soon have eyelids to cover their blossoming eyes',
      8 => "At 9 weeks most of the aspects of your baby's physical structure such as head, arms, legs and torso are in place",
      9 => 'By Week 10 your baby is less at risk for congenital malformations, which usually occur during the first nine weeks of pregnancy. You should breathe a big sigh of relief by the end of pregnancy week 10 now that this important developmental stage is past!',
      10 => 'Your little one is growing larger and larger as you continue your pregnancy week by week. By pregnancy week 11 your baby is big enough to hold in the palm of your hand',
      11 => "Your baby's genitals will start showing signs of being either male or female soon. During pregnancy Week 12, your baby's brain is starting to make hormones, and nerve cells are multiplying at a rapid rate",
      12 => 'By the end of pregnancy week 13 your baby looks like a tiny yet fully formed baby. Your baby is anywhere from 2 and a half to a little over 3 inches long and weighs up to .7 ounces',
      13 => 'At 14 weeks pregnant your tummy should start pouching a little bit now. Some women find this a welcome change. You may also notice that you start having additional symptoms such as constipation',
      14 => "The bones in your baby's body are also starting to get harder during pregnancy at 15 weeks. Your baby is spending most of his time practicing breathing, by inhaling and exhaling amniotic fluid",
      15 => "Your baby is planning on doing some major growing in the next few weeks. By pregnancy 16 weeks she'll be able to hold her head slightly straighter and her eyes are finally moving into their final position in the front of the head",
      16 => 'At pregnancy 17 weeks time your baby should be hearing things. Your baby will start putting on some layers of fat in the weeks to come, though at this point in time your baby is made up of primarily water',
      17 => 'By 18 weeks pregnant your baby is now anywhere from 5 to approximately 6 inches long at 18 weeks and weighs a little over 5 ounces! In case you are wondering that is about the size of a small can of soup!',
      18 => "By pregnancy week 19 your baby is starting to produce meconium, the baby's first bowel movement",
      19 => 'Congratulations! You are at the midpoint of your pregnancy, and onlookers are definitely starting to notice your bump! Remember that you are halfway through your pregnancy by 20 weeks pregnant, only 20 more weeks to go!',
      20 => "Your baby's organs and central nervous system are still developing and maturing. Your baby's skin continues to develop and mature as well",
      21 => "Compared to your baby's first weeks of life, your baby at pregnancy week 22 is now a giant! At more than 7 1/2 inches long your baby weighs over 12 ounces during pregnancy 22 weeks!",
      22 => 'Your baby has lots of room to move in your uterus now, so her movements are probably quite strong at this point. You probably feel lots of flipping and flopping, and may even notice your stomach moving about!',
      23 => 'Your baby is now more than one pound and is about 8 ? inches long! As you track your pregnancy week by week from this point out your baby will resemble a tiny albeit complete little human being!',
      24 => 'The structures that form the spine start to form and blood vessels in the lungs continue to develop this week',
      25 => "Your baby's heart continues to grow and develop during pregnancy at 26 weeks. You may even be able to hear your baby's heart beat through a traditional stethoscope placed on your stomach",
      26 => "Your baby at 27 weeks now weighs slightly over 2 pounds by 27 weeks pregnant. Your baby's total length is close to 15 inches",
      27 => 'Your uterus measures at least 3 inches above your bellybutton, or is approximately 28 cm tall. You should be steadily gaining weight from now on',
      28 => 'Congratulations! You have now entered the third trimester! From 29 Weeks and beyond you will experience rapid weight gain among other wonderful things. By pregnancy week 29 your baby weighs about 2.7 pounds and is more than 16 and a half inches long!',
      29 => 'You are now in the home stretch of pregnancy by pregnancy at 30 weeks, and quickly running out of room to expand!',
      30 => 'Your baby is busy accumulating layers of fat under his skin as you continue your pregnancy week by week. The arms, legs and body start to fill out and look less wrinkly as each week progresses. Your baby may be finding the space in your womb tighter and tighter by 31 weeks pregnant',
      31 => 'Your baby now has toenails and fingernails to complement her frame, though it will probably be a while before your baby requires an official pedicure or manicure',
      32 => 'Your baby is busy concentrating on weight gain during pregnancy week 33 and during the remainder of your pregnancy week by week. By pregnancy week 33 your baby weighs a little over 4 pounds and may be a little over 19 inches long!',
      33 => 'You probably are getting a little bit uncomfortable by Week 34. You are also likely to start feeling anxious to meet your newborn baby!',
      34 => 'Your uterus by 35 weeks pregnant is a whopping 6 inches above your bellybutton. You may have gained close to 30 pounds around 35 weeks pregnant',
      35 => 'You are round and beautiful during pregnancy 36 weeks. Your uterus during pregnancy at 36 weeks is now more than 5 and a half inches from your navel',
      36 => 'Congratulations! You have now entered the final stages of your pregnancy week by week. Between Week 37 and Week 41 most women are considered full term',
      37 => "Have you packed your hospital yet? If you haven't you better sit down and do it today. You could go into spontaneous labor at any point in time as you continue your pregnancy week by week",
      38 => 'During week 39 it is common to have early signs of labor. Your baby now probably weighs between 7 and 7 and a half pounds',
      39 => 'Your baby is ready to bust out of your uterus. With little room to move during pregnancy at 40 weeks your baby is probably starting to think about making a grand entry into the world',
      40 => "Surprise! You're still here! Feeling anxious yet? Your baby must be holding on for a reason!",
      41 => 'Be sure the car is full of gas, that your birth bag or birth kit is ready and that you get as much sleep as you can. Because your baby is on his way!'
      );

      // COMMON FUNCTIONS
      function getSessionVar( $var, $default ) {
      if ( isset( $_SESSION[$var] ) ) {
      return $_SESSION[$var];
      }
      else {
      return $default;
      }
      }

      function safe_get_string($param, $default)
      {
      if (array_key_exists($param, $_GET))
      {
      if (!get_magic_quotes_gpc())
      {
      return addslashes($_GET[$param]);
      }
      else
      {
      return $_GET[$param];
      }
      }
      else {
      return $default;
      }
      }

      function safe_get_integer($param, $default) {
      if (array_key_exists($param, $_GET)) {
      return (int) $_GET[$param];
      }
      else {
      return $default;
      }
      }

      function safe_post_string($param, $default) {
      if (array_key_exists($param, $_POST)) {
      if (!get_magic_quotes_gpc()) {
      if ($_POST[$param] != "") {
      return addslashes($_POST[$param]);
      }
      else {
      return $default;
      }
      }
      else {
      if ($_POST[$param] != "") {
      return $_POST[$param];
      }
      else {
      return $default;
      }
      }
      }
      else {
      return $default;
      }
      }

      function unsafe_post_string($param, $default) {
      if (array_key_exists($param, $_POST)) {
      if ($_POST[$param] != "") {
      return stripslashes($_POST[$param]);
      }
      else {
      return $default;
      }
      }
      else {
      return $default;
      }
      }

      function safe_post_integer($param, $default)
      {
      if (array_key_exists($param, $_POST)) {
      return (int) $_POST[$param];
      }
      else {
      return $default;
      }
      }

      function loadTextFromFile( $filename ) {
      if ( file_exists( $filename ) ) {
      return implode( "\n", @file( $filename ) );
      }
      else {
      return '';
      }
      }

      function saveTextToFile( $filename, $text ) {
      $f = @fopen( $filename, 'w' );
      if ( $f == false ) {
      return false;
      }

      if ( !@fwrite( $f, str_replace( "\\", "", $text ) ) ) { //"
      return false;
      }

      if ( !@fclose( $f ) ) {
      return false;
      }

      return true;
      }

      function getImagesList( $path ) {
      $images = false;
      if ( $handle = opendir( $path ) ) {
      $images = array();
      while ( false !== ( $file = readdir( $handle ) ) ) {
      if ( ( $file != '.' ) && ( $file != '..' ) && ( !is_dir( $path . $file ) ) ) {
      $images[] = basename( $file );
      }
      }
      closedir( $handle );
      sort( $images );
      }

      return $images;
      }

      function logError( $text ) {
      echo $text; // temp
      }

      // PROJECT SPECIFIC FUNCTIONS
      function __unserialize( $sObject ) {

      $__ret = preg_replace( '!s\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $sObject );

      return unserialize( $__ret );

      }

      function getTickerPage( $tickertype ) {

      if ( $tickertype == 1 ) {
      return 'pregnancy.html';
      }
      elseif ( $tickertype == 2 ) {
      return 'breastfeeding.html';
      }
      elseif ( $tickertype == 3 ) {
      return 'baby.html';
      }
      elseif ( $tickertype == 4 ) {
      return 'birthday.html';
      }
      elseif ( $tickertype == 5 ) {
      return 'conceive.html';
      }
      elseif ( $tickertype == 6 ) {
      return 'angelremembrance.html';
      }
      elseif ( $tickertype == 7 ) {
      return 'weightloss.html';
      }
      elseif ( $tickertype == 8 ) {
      return 'wedding.html';
      }
      elseif ( $tickertype == 9 ) {
      return 'anniversary.html';
      }
      elseif ( $tickertype == 10 ) {
      return 'adoption.html';
      }
      elseif ( $tickertype == 11 ) {
      return 'vacation.html';
      }
      elseif ( $tickertype == 12 ) {
      return 'cruise.html';
      }
      elseif ( $tickertype == 13 ) {
      return 'event.html';
      }

      }

      function createRandomCode( $code_length = 4 ) {
      $symbols = array(
      'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
      'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1',
      '2', '3', '4', '5', '6', '7', '8', '9'
      );

      $code = '';

      for ( $i = 0; $i < $code_length; $i++ ) {
      $code .= $symbols[rand( 0, count( $symbols ) - 1 )];
      }

      return $code;
      }

      function getImageTextWrappedHeight($width, $font, $text, $textSize) {
      //Recalculate X and Y to have the proper top/left coordinates instead of TTF base-point
      $text = str_replace ("\r", '', $text); //Remove windows line-breaks
      $srcLines = split ("\n", $text); //Split text into "lines"
      $dstLines = array(); // The destination lines array.
      foreach ($srcLines as $currentL) {
      $line = '';
      $words = split (" ", $currentL); //Split line into words.
      foreach ($words as $word) {
      $dimensions = imagettfbbox($textSize, 0, $font, $line.$word);
      $lineWidth = $dimensions[4] - $dimensions[0]; // get the length of this line, if the word is to be included
      if ($lineWidth > $width && !empty($line) ) { // check if it is too big if the word was added, if so, then move on.
      $dstLines[] = ' '.trim($line); //Add the line like it was without spaces.
      $line = '';
      }
      $line .= $word.' ';
      }
      $dstLines[] = ' '.trim($line); //Add the line when the line ends.
      }
      //Calculate lineheight by common characters.
      $dimensions = imagettfbbox($textSize, 0, $font, "MXQJPmxqjp123"); //use a custom string to get a fixed height.
      $lineHeight = $dimensions[1] - $dimensions[5]; // get the heightof this line

      return count( $dstLines )*$lineHeight;
      }

      //A function for pixel precise text Wrapping
      function imageTextWrapped(&$img, $x, $y, $width, $font, $color, $text, $textSize, $align="l") {
      //Recalculate X and Y to have the proper top/left coordinates instead of TTF base-point
      $y += $textSize;
      $dimensions = imagettfbbox($textSize, 0, $font, " "); //use a custom string to get a fixed height.
      $x -= $dimensions[4]-$dimensions[0];

      $text = str_replace ("\r", '', $text); //Remove windows line-breaks
      $srcLines = split ("\n", $text); //Split text into "lines"
      $dstLines = Array(); // The destination lines array.
      foreach ($srcLines as $currentL) {
      $line = '';
      $words = split (" ", $currentL); //Split line into words.
      foreach ($words as $word) {
      $dimensions = imagettfbbox($textSize, 0, $font, $line.$word);
      $lineWidth = $dimensions[4] - $dimensions[0]; // get the length of this line, if the word is to be included
      if ($lineWidth > $width && !empty($line) ) { // check if it is too big if the word was added, if so, then move on.
      $dstLines[] = ' '.trim($line); //Add the line like it was without spaces.
      $line = '';
      }
      $line .= $word.' ';
      }
      $dstLines[] = ' '.trim($line); //Add the line when the line ends.
      }
      //Calculate lineheight by common characters.
      $dimensions = imagettfbbox($textSize, 0, $font, "MXQJPmxqjp123"); //use a custom string to get a fixed height.
      $lineHeight = $dimensions[1] - $dimensions[5]; // get the heightof this line

      $align = strtolower(substr($align,0,1)); //Takes the first letter and converts to lower string. Support for Left, left and l etc.
      foreach ($dstLines as $nr => $line) {
      if ($align != "l") {
      $dimensions = imagettfbbox($textSize, 0, $font, $line);
      $lineWidth = $dimensions[4] - $dimensions[0]; // get the length of this line
      if ($align == "r") { //If the align is Right
      $locX = $x + $width - $lineWidth;
      } else { //If the align is Center
      $locX = $x + ($width/2) - ($lineWidth/2);
      }
      } else { //if the align is Left
      $locX = $x;
      }
      $locY = $y + ($nr * $lineHeight);
      //Print the line.
      imagettftext($img, $textSize, 0, $locX, $locY, $color, $font, $line);
      }
      }

      ?>
      {{ DiscussionBoard.errors[219117].message }}
    • {{ DiscussionBoard.errors[219124].message }}
  • Profile picture of the author wayfarer
    See my above post. I edited it, then it looks like you responded to my first version...
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[219122].message }}
  • {{ DiscussionBoard.errors[219128].message }}
  • Profile picture of the author wayfarer
    Will the beer stay cold on the journey from the UK to the US?
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[219130].message }}

Trending Topics