Jump to content

graham23s

Members
  • Posts

    890
  • Joined

  • Last visited

Posts posted by graham23s

  1. <?php
     // Daniel URL duplicator.
     // Input links list.
     $linksList = "links.txt";
     // How many times to duplicate the url?
     $manyTimes = 1000;
     // Read in the list.
     for ($x = 0; $x <= $manyTimes; $x++)
     {
      $handle = fopen($linksList, "r");
      $line = fgets($handle);
      echo $line;
      fclose($handle);
     }
    ?>
    

    Hey Guys,

     

    I'm stuck on this simple bit of code lol what I'm trying to do is load in a list of urls:

     

    site1.com

    site2.com

    site3.com

    etc

     

    For each site that is read, I'm trying to duplicate it X times, above would print to screen the same url 1000 times, then move onto the next print it 1000 times etc until the list is done (or how ever many times I select)

     

    I can't think of the best way to do it!

     

    any help would be appreciated guys!

     

    Graham

     

     

     

     

  2. Hey Guys,

     

    I'm receiving an api request back that looks like:

    [{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174222182518,"lsrc":80972326202,"ltgt":31581262572,"luuu":"groups.google.com/group/comp.infosystems.www.users/msg/9a210e5f72278328","pda":100,"ueid":355370,"uid":358079,"ulc":1394603890,"umrp":7.348021108330069,"umrr":4.2306065019844527e-07,"upa":95.04277845195264,"us":200,"ut":"HTTP cookie - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/HTTP_cookie"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174457993090,"lsrc":80972326202,"ltgt":31622557610,"luuu":"support.google.com/chrome/answer/95582?hl=en","pda":100,"ueid":355370,"uid":358079,"ulc":1394603890,"umrp":7.348021108330069,"umrr":4.2306065019844527e-07,"upa":95.04277845195264,"us":200,"ut":"HTTP cookie - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/HTTP_cookie"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174457997214,"lsrc":80972326202,"ltgt":31622557668,"luuu":"support.google.com/chrome/answer/95626?hl=en","pda":100,"ueid":355370,"uid":358079,"ulc":1394603890,"umrp":7.348021108330069,"umrr":4.2306065019844527e-07,"upa":95.04277845195264,"us":200,"ut":"HTTP cookie - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/HTTP_cookie"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174704422109,"lsrc":80972326202,"ltgt":31675615115,"luuu":"www.google.com/support/chrome/bin/answer.py?hl=en&answer=95582","pda":100,"ueid":355370,"uid":358079,"ulc":1394603890,"umrp":7.348021108330069,"umrr":4.2306065019844527e-07,"upa":95.04277845195264,"us":200,"ut":"HTTP cookie - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/HTTP_cookie"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174704422260,"lsrc":80972326202,"ltgt":31675615123,"luuu":"www.google.com/support/chrome/bin/answer.py?hl=en&answer=95626","pda":100,"ueid":355370,"uid":358079,"ulc":1394603890,"umrp":7.348021108330069,"umrr":4.2306065019844527e-07,"upa":95.04277845195264,"us":200,"ut":"HTTP cookie - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/HTTP_cookie"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051896270,"lsrc":80975346908,"ltgt":31567049373,"luuu":"books.google.com/?id=0IZboamhb5EC&lpg=PA731","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051900386,"lsrc":80975346908,"ltgt":31567051168,"luuu":"books.google.com/?id=58KxPNa0hF4C&lpg=PA463","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051902110,"lsrc":80975346908,"ltgt":31567051879,"luuu":"books.google.com/?id=6xiYiybkE8kC&vq=core","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051902955,"lsrc":80975346908,"ltgt":31567052243,"luuu":"books.google.com/?id=7veohk0fkLYC&lpg=PA88","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051904343,"lsrc":80975346908,"ltgt":31567052883,"luuu":"books.google.com/?id=9iQYSQ9y60MC&lpg=PA49","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051905960,"lsrc":80975346908,"ltgt":31567053635,"luuu":"books.google.com/?id=BgZyXNIrvB4C&pg=PT12","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051911261,"lsrc":80975346908,"ltgt":31567055934,"luuu":"books.google.com/?id=Ho_RmgOnwgwC&lpg=PA8","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051913146,"lsrc":80975346908,"ltgt":31567056717,"luuu":"books.google.com/?id=JttyjBoyb3AC&lpg=PA12","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051920509,"lsrc":80975346908,"ltgt":31567059840,"luuu":"books.google.com/?id=SF7U27JsLC4C&dq=iraq+invasion+removes+hussein","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051921673,"lsrc":80975346908,"ltgt":31567060362,"luuu":"books.google.com/?id=T_0TrXXiDbUC&dq=slavery+%22American+Civil+War%22","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051922547,"lsrc":80975346908,"ltgt":31567060715,"luuu":"books.google.com/?id=UYpVAAAAYAAJ","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051925466,"lsrc":80975346908,"ltgt":31567061980,"luuu":"books.google.com/?id=Y1dOLQN9hvwC&dq=SEALs+kill+Osama+bin+Laden","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051936195,"lsrc":80975346908,"ltgt":31567066473,"luuu":"books.google.com/?id=jLy-NKnQitIC&pg=PA45&dq=uk+us+special+relationship","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051937261,"lsrc":80975346908,"ltgt":31567066890,"luuu":"books.google.com/?id=ka6LxulZaEwC&vq=annexation&dq=territorial+expansion+United+States+%22manifest+destiny%22","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051943179,"lsrc":80975346908,"ltgt":31567069364,"luuu":"books.google.com/?id=r71u_AgE7iYC&lpg=PA142","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051949934,"lsrc":80975346908,"ltgt":31567072219,"luuu":"books.google.com/?id=yd4GqkP5XYgC&lpg=PA229","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174051950951,"lsrc":80975346908,"ltgt":31567072673,"luuu":"books.google.com/?id=zq4rsWNrYo4C&q=Reaganomics&dq=Reaganomics","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174052414947,"lsrc":80975346908,"ltgt":31567405066,"luuu":"books.google.com/books/about/A_History_of_the_American_People.html?id=RXSVQjz1_tMC","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174052676940,"lsrc":80975346908,"ltgt":31567608329,"luuu":"books.google.com/books/about/An_Empire_of_Wealth.html?id=rmsUs_KDgHAC","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"},{"fmrp":8.770560720053982,"fmrr":7.78614635427592e-05,"lrid":174054227159,"lsrc":80975346908,"ltgt":31568894639,"luuu":"books.google.com/books/about/History_of_the_American_Economy_With_Acc.html?id=lyhI1q_E4G0C","pda":100,"ueid":73314,"uid":156486,"ulc":1393624567,"umrp":6.978036065267593,"umrr":1.3614443568106348e-07,"upa":94.43262161988372,"us":200,"ut":"United States - Wikipedia, the free encyclopedia","uu":"en.wikipedia.org/wiki/United_States"}]
    

    I'm trying to retrieve all the backlinks located in these parts:

     

    "uu":"en.wikipedia.org/wiki/HTTP_cookie"

    "uu":"en.wikipedia.org/wiki/United_States"

    etc

     

    I tried this regex:

        $regex    = returnSeoMozLinks("google.com");
        $pattern  = '""uu"":""(.*?)""';
        $success  = preg_match($pattern, $regex, $match);
        if ($success) {
    	  echo "Match: ".$match[0]."<br />"; 
        }
    

    But it doesn't seem to work, i can do it in vb net but i am rusty with php lol

     

    any help would be appreciated guys!

     

    cheers

     

    Graham

  3. Hi Guys,

     

    When i upload and merge my watermark .png on to my  images it still shows the square border rather than just the logo, the square borders should be invisible.

     

    My watermark code:

    	 // DEFINITIONS...
         define('WATERMARK_OVERLAY_IMAGE', '../img/img-wmLogo.png');
         define('WATERMARK_OVERLAY_OPACITY', 100);
         define('WATERMARK_OUTPUT_QUALITY', 100);
    

    Function code:

    function create_watermark($source_file_path, $output_file_path)
    {
     list($source_width, $source_height, $source_type) = getimagesize($source_file_path);
     if ($source_type === NULL) {
     return false;
     }
     
     switch ($source_type) 
     {
     case IMAGETYPE_GIF:
     $source_gd_image = imagecreatefromgif($source_file_path);
     break;
     case IMAGETYPE_JPEG:
     $source_gd_image = imagecreatefromjpeg($source_file_path);
     break;
     case IMAGETYPE_PNG:
     $source_gd_image = imagecreatefrompng($source_file_path);
     break;
     default:
     return false;
     }
     
     $overlay_gd_image = imagecreatefrompng(WATERMARK_OVERLAY_IMAGE);
     $overlay_width = imagesx($overlay_gd_image);
     $overlay_height = imagesy($overlay_gd_image);
     imagecopymerge($source_gd_image,$overlay_gd_image,$source_width - $overlay_width,$source_height - $overlay_height,0,0,$overlay_width,$overlay_height,WATERMARK_OVERLAY_OPACITY);
     imagejpeg($source_gd_image, $output_file_path, WATERMARK_OUTPUT_QUALITY);
     imagedestroy($source_gd_image);
     imagedestroy($overlay_gd_image);
     
    }
    

    It appears like: http://www.camnev-electronics.com/wwwwwwwwwwwwwwwwwwwwwwwww-2743.html and http://www.camnev-electronics.com/test-2739.html

     

    I know nothing about photoshop but my designer has swore blue the background is transparant, is this a coding problem would you say? i can't think of what else to chjeck.

     

    any help would be appreciated!

     

    cheers guys

     

    Graham

  4. Hey Guys,

     

    I'm using a simple function to retrieve data from an html page based on if a div exists or not.

    function retrieveArticleBod($scrapedArticleURL)
    {
    	echo "<hr><b>DEBUG: </b>$scrapedArticleURL</hr>";
    	$html = file_get_html($scrapedArticleURL);
    	/* echo "<pre>"; print_r($html); */
    	
    	// CHECK IF THE BLOCK EDITOR DIV EXISTS
    	if (isset($html->find('div[class=block_editor]')))
    	{	
    		foreach ($html->find('div[class=block_editor]') as $body)
    		{
    		 echo "<hr><b>DEBUG: </b>" . $body->innertext . "</hr>";
    		 return $body->innertext; 
    		}	
    	 } else {
    		foreach ($html->find('.content_desc_4 mt23 mb0') as $body)
    		{
    		 echo "<hr><b>DEBUG: </b>" . $body->innertext . "</hr>";
    		 return $body->innertext; 
    		}	
    	}
    	
    } 
    

    The first if if (isset($html->find('div[class=block_editor]'))) is causing the error Can't use method return value in write context, basically i'm trying to say if it exists run the code accordingly, i'm a touch rusty with php lol can anyone see what i have done wrong?

     

    cheers guys

     

    Graham

  5. Hi P,

     

    Sorry i should have posted the entire menu block:

     

                                <?
                                $menu = array(
                                    array(
                                        'system_name' => 'home-content',
                                        'title' => 'Home',
                                        'li_class' => 'menu_home'
                                    ),
                                    array(
                                        'system_name' => 'apply',
                                        'title' => 'Apply',
                                        'li_class' => 'menu_apply'
                                    ),
                                    array(
                                        'system_name' => 'how-it-works',
                                        'title' => 'How it Works',
                                        'li_class' => 'menu_how_it_works'
                                    ),
                                    array(
                                        'system_name' => 'testimonials',
                                        'title' => 'Testimonials',
                                        'li_class' => 'menu_testimon'
                                    ),
                                    array(
                                        'system_name' => 'faq',
                                        'title' => 'FAQ\'s',
                                        'li_class' => 'menu_faq'
                                    ),
                                    array(
                                        'system_name' => 'privacy-policy',
                                        'title' => 'Privacy Policy',
                                        'li_class' => 'menu_privacy'
                                    ),
                                    array(
                                        'system_name' => 'contact-us',
                                        'title' => 'Contact Us',
                                        'li_class' => 'menu_contact'
                                    ),
                                );
                                foreach ($menu as $elem) {
                                    $selected1 = '';
                                    $selected2 = '';
                                    if ($elem['system_name'] == $this->system_name) {
                                        $selected1 = '<b>';
                                        $selected2 = '</b>';
                                    }
                                    if ($elem['system_name'] != 'home-content') {
                                        $elem['system_name'] = $elem['system_name'] . '.html';
                                    } else {
                                        $elem['system_name'] = '';
                                    }
    
                                    printf('<li class="%s">%s<a href="%s\%s">%s</a>%s</li>', $elem['li_class'], $selected1, ROOT, $elem['system_name'], $elem['title'], $selected2);
                                }
                                ?>
    

     

    This prints the href data out like apply.html, contact-us.html, privacy-policy.html what i'm ideally trying to do is once it brings back the apply.html page out to change it to www.anothersite.com rather than apply.html i have a mental block lol

     

    cheers mate

     

    Graham

  6. Hi Guys,

     

    Theres probably a really simple way to do this, but i haven't touched php in a wee while lol this code:

     

                                foreach ($menu as $elem) {
                                    $selected1 = '';
                                    $selected2 = '';
                                    if ($elem['system_name'] == $this->system_name) {
                                        $selected1 = '<b>';
                                        $selected2 = '</b>';
                                    }
                                    if ($elem['system_name'] != 'home-content') {
                                        $elem['system_name'] = $elem['system_name'] . '.html';
                                    } else {
                                        $elem['system_name'] = '';
                                    }
    
                                    printf('<li class="%s">%s<a href="%s/%s">%s</a>%s</li>', $elem['li_class'], $selected1, ROOT, $elem['system_name'], $elem['title'], $selected2);
                                }
                                ?>
    

     

    Prints out the navigation on one of my sites, when the code loops through the menu i want to change one of the href targets for example:

     

    if (loop through menu)
    {
    if (page returned for example users page)
    
      {
       <a href="[b]CHANGE THIS TO SOMETHING.html[/b]">
      }
    }
    

     

    So i only need to change one of the hrefs not all of them :)

     

    any help would be appreciated

     

    thanks guys

     

    Graham

  7. Hi Guys,

     

    For some reason i'm having a hard time getting .htaccess code through the old noggin lol i added a blog (wordpress) to one of my sites, when i goto view it at www.site.com/blog/ it shows up as 404

     

    the .htaccess code is:

     

    RewriteEngine on
    Options +FollowSymLinks
    RewriteCond %{SCRIPT_FILENAME} !-f 
    RewriteRule ^[^/]+-([0-9]+)\.html$ product.php?id=$1 [QSA,L]
    RewriteCond %{SCRIPT_FILENAME} !-f 
    RewriteRule ^([0-9]+)-[^/]+\.html$ category.php?cat-id=$1 [QSA,L]
    

     

    That is just really so the categories are formatted neater, i'm struggling to see why the above code would stop the blog being shown.

     

    any help would be appreciated guys!

     

    cheers

     

    Graham

  8. Hi Guys,

     

    Although i can code in PHP fairly well i'm using a 3rd party script for some of my sites for quickness.

     

    In the .htaccess file is:

     

    Options +FollowSymLinks
    RewriteEngine on
    
    #RewriteBase 
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # General stuff
    RewriteRule ^.htaccess$ - [F]
    RewriteRule ^$ index.php
    #RewriteRule ^.*/img/(.*\.(jpg|gif|png|swf))$ /img/$1
    RewriteRule ^files/ - [L]
    RewriteRule ^update\.php - [L]
    RewriteRule ^updatefeed\.php - [L]
    RewriteRule ^proxy\.php - [L]
    RewriteRule ^install_img/ - [L]
    RewriteRule ^themes/ - [L]
    RewriteRule ^modules/ - [L]
    RewriteRule ^js/ - [L]
    RewriteRule ^js/tinymce/ - [L]
    #RewriteRule ^js/scriptaculous/ - [L]
    #RewriteRule ^.*/js/(.*\.js)$ /js/$1
    #RewriteRule ^.*/css/(.*\.css)$ /css/$1
    RewriteRule ^.*/ajax/(.*\.html)$ /ajax/$1
    RewriteRule !(\.(js|css|gif|png|jpg|ico|swf))$ index.php
    
    #ErrorDocument 404 /page/not-found/
    <IfModule mod_php5.c>
    php_flag magic_quotes_gpc Off
    php_flag register_globals Off
    php_flag short_open_tag on
    php_value error_reporting 2047
    php_value ignore_user_abort On
    </IfModule>
    

     

    The problem is, when i put a robots.txt file in and try to view it like: www.site.com/robots.txt it springs up a 404 (i assume it's because the .htaccess isn't allowing it)

     

    any help would be appreciated guys!

     

    cheers

     

    Graham

  9. Hi Guys,

     

    I'm sure i have done this before, is there a way to shorten dates like:

     

    December 16, 2010 to Dec 16, 2010

     

    and

     

    January 16, 2010 to Jan 16, 2010

     

    etc, i have used $dateFormatted2 = date("F j, Y", strtotime($d2)); to get the date format i have now.

     

    any help would be appreciated

     

    thansk guys

     

    Graham

  10. Hi Guys,

     

    This is really stumping me here lol i have set my registration page code to email me when a user signs up (once its entered in the database)

     

    code:

     

    <?php
    if (isset($_POST['submitSignUp']))
    {
       // Errors array()
       $errors = array();
    
       // POST vars
       $fName = mysql_real_escape_string($_POST['fname']);
       $lName = mysql_real_escape_string($_POST['lname']); 
       $email = mysql_real_escape_string($_POST['email']); 
       $pass1 = mysql_real_escape_string($_POST['pass1']); 
       $pass2 = mysql_real_escape_string($_POST['pass2']); 
       $cntry = mysql_real_escape_string($_POST['cntry']); 
       
       // Does passwords match
       if ($pass1 != $pass2)
       {
          $errors[] = "Your passwords don't match."; 
       }
       
       // Potential errors 
       // Empty fields
       if (empty($fName) || empty($lName) || empty($email) || empty($pass1) || empty($pass2)) { 
            $errors[] = "You never filled in all the fields."; 
       } else {
        
           // Does user exist? 
           $result = mysql_query("SELECT * FROM `dig_customers` WHERE `email`='$email' LIMIT 1"); 
           if (mysql_num_rows($result) > 0) {    
              $errors[] = "The e-mail address <b>$email</b> has already been registered.";  
           } else {
    
           // Empty for now...
    
           }
       }  
       
       // display errors if any exist
       if (count($errors) > 0) 
       { 
           print "<div id=\"errorMsg\"><h3>Ooops! There was error(s)</h3><ol>"; 
           foreach($errors as $error) 
           { 
              print "<li>$error</li>"; 
           }
           print "</ol></div>";
       } else {
           print "<div id=\"okMsg\"><p>All done  you can now sign in.</p></div>";
           
             // Encrypt the password before insertion
             $encPass = md5($pass1);
    
             // Insert into the database
             $q = mysql_query("INSERT INTO `dig_customers` 
             
             (`id`,
              `password`,
              `password_unencrypted`,
              `gender`,
              `title`,
              `first_name`,
              `last_name`,
              `address`,
              `city`,
              `state_county`,
              `post_zip_code`,
              `country`,
              `email`,
              `home_number`,
              `mobile_number`,
              `news_letter`,
              `special_offers`,
              `admin_level`,
              `registered`) 
             
               VALUES 
              
              ('',
              '$encPass',
              '$pass1',
              'NULL',
              'NULL',
              '$fName',
              '$lName',
              'NULL',
              'NULL',
              'NULL',
              'NULL',
              '$cntry',
              '$email',
              'NULL',
              'NULL',
              'NULL',
              'NULL',
              'N',
               NOW())");
    
              if ($q)
              {
    
                // Alert on signup
                send_graham_email("User Has Signed Up!");
              
              }
           
       }
    
    }
    ?>
    

     

    When i do a test signup on: http://www.digicures.com/sign-up.php everything works great i get an email and the entry is saved in the database, over the paste week or so i have had about 8 emails saying people have signed up but when i check the database there nothing there!

     

    i can't understand it, only when the insert query is true should it send me the mail eh?

     

    can anyone see any problems with the code at all?

     

    cheers guys

     

    Graham

  11. Hi Guys,

     

    I can't figure this one out, in my registration code i set it to email when a user successfully registers:

     

    code:

     

    <?php
    if (isset($_POST['submitSignUp']))
    {
       // Errors array()
       $errors = array();
    
       // POST vars
       $fName = mysql_real_escape_string($_POST['fname']);
       $lName = mysql_real_escape_string($_POST['lname']); 
       $email = mysql_real_escape_string($_POST['email']); 
       $pass1 = mysql_real_escape_string($_POST['pass1']); 
       $pass2 = mysql_real_escape_string($_POST['pass2']); 
       $cntry = mysql_real_escape_string($_POST['cntry']); 
       
       // Does passwords match
       if ($pass1 != $pass2)
       {
          $errors[] = "Your passwords don't match."; 
       }
       
       // Potential errors 
       // Empty fields
       if (empty($fName) || empty($lName) || empty($email) || empty($pass1) || empty($pass2)) { 
            $errors[] = "You never filled in all the fields."; 
       } else {
        
           // Does user exist? 
           $result = mysql_query("SELECT * FROM `dig_customers` WHERE `email`='$email' LIMIT 1"); 
           if (mysql_num_rows($result) > 0) {    
              $errors[] = "The e-mail address <b>$email</b> has already been registered.";  
           } else {
    
           // Empty for now...
    
           }
       }  
       
       // display errors if any exist
       if (count($errors) > 0) 
       { 
           print "<div id=\"errorMsg\"><h3>Ooops! There was error(s)</h3><ol>"; 
           foreach($errors as $error) 
           { 
              print "<li>$error</li>"; 
           }
           print "</ol></div>";
       } else {
           print "<div id=\"okMsg\"><p>All done  you can now sign in.</p></div>";
           
             // Encrypt the password before insertion
             $encPass = md5($pass1);
    
             // Insert into the database
             $q = mysql_query("INSERT INTO `dig_customers` 
             
             (`id`,
              `password`,
              `password_unencrypted`,
              `gender`,
              `title`,
              `first_name`,
              `last_name`,
              `address`,
              `city`,
              `state_county`,
              `post_zip_code`,
              `country`,
              `email`,
              `home_number`,
              `mobile_number`,
              `news_letter`,
              `special_offers`,
              `admin_level`,
              `registered`) 
             
               VALUES 
              
              ('',
              '$encPass',
              '$pass1',
              'NULL',
              'NULL',
              '$fName',
              '$lName',
              'NULL',
              'NULL',
              'NULL',
              'NULL',
              '$cntry',
              '$email',
              'NULL',
              'NULL',
              'NULL',
              'NULL',
              'N',
               NOW())");
    
              if ($q)
              {
    
                // Alert on signup
                send_graham_email("User Has Signed Up!");
              
              }
           
       }
    
    }
    ?>
    

     

    i moved this part: print "<div id=\"okMsg\"><p>All done :) you can now sign in.</p></div>"; and the INSERT query to where it is now thinking this has solved it, but i just got an email saying "user has signed up!" but when i check the stats they haven't LOL

     

    can anyone see where i have went wrong?

     

    cheers guys

     

    Graham

  12. Hi Guys,

     

    I'm getting a bit muddled with a loop here lol, what i'm trying to do is loop out the last 10 poular products from mysql and query amazon:

     

    <?php
          // Start the table
          print "<table width=\"90%\" align=\"center\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" />";
          
          // Credentials
          $PublicKey   = "";
          $PrivateKey  = "";
          
          // Get the stored keywords for this category
          $qI = mysql_query("SELECT * FROM `fcs_products_viewed` LIMIT 10");
          
          while ($aI = mysql_fetch_array($qI))
          {
    
          $pID = $aI['product_unique_id'];
    
          // Prarameters we need to send to the function
          $parameters = array(
          'Operation'       => 'ItemLookup',
        //'SellerId'        => 'A23I0F0MWQH94Z',
        //'Keywords'        => 'potter',
        //'SearchIndex'     => 'DVD',  //Books for example.
        //"$searchparameter"=> $searchparameterdata    ,
        //'ItemPage'        => 1,  //which page?
        //'Service'         => 'AWSECommerceService'   ,  //this makes it version 4
        //'SubscriptionId'  => $subscriptionid         ,  //is this correct?
        //'AWSAccessKeyId'  => $awsaccesskeyid         ,  //is this correct?
          'ItemId'          => $pID,
        //'ResponseGroup'   => 'Medium'                ,  //Small, Medium or Large
          'ResponseGroup'   => 'Medium'  //Small, Medium, Large or SellerListing
          );
          
          } // End while loop
    
          // Execute the function to return our URL
          $url = amazon_signed_request("co.uk", $parameters, $PublicKey, $PrivateKey);
          //print $url;
          // Load the results and get the contents    
          $response = simplexml_load_file($url);
      
          // Pagination numbers
          $totalPages = $response->Items->TotalPages;
          //print $totalPages;
          // Loop through the xml nodes
          foreach ($response->Items->Item as $item) 
          {     
          
            // We need a function to check what ID number we need
            //$identificationNumber = amazon_id_number($catName);
            // All products so far seem to have an ASIN number which will be the identifier
          
            $title       = $item->ItemAttributes->Title;
            $price       = $item->OfferSummary->LowestNewPrice->FormattedPrice;
            $asin        = $item->ASIN;
            $img_src     = $item->SmallImage->URL;
            
            // Cut the title string  if it's mega long
            if (strlen($title) > 100)
            {
              $title = substr($title, 0, 99);
            }
            
            // Clean symbols from the titles
            $titlesCleaned = amazon_strip_symbols($title);
    
            // Replace that stupid symbol
            $newprice = str_replace("Â", " ", $price);
              
            //print $itemID ;                   
            $amazonDisplay = "<form action=\"cart.php?add=Add\" method=\"POST\" name=\"fcsProductBox\" />
                        <input type=\"hidden\" name=\"fcsCartTriggered\" value=\"1\" /> 
                        <input type=\"hidden\" name=\"fcsCartProductId\" value=\"$asin\" />
                        <input type=\"hidden\" name=\"fcsCartProductQT\" value=\"1\" />
                        <input type=\"hidden\" name=\"fcsCartVendor\" value=\"amazon\" />
                        <table class=\"prod\">
                         <tr>
                          <td valign=\"top\" class=\"pic\"><img src=\"$img_src\" border=\"0\" alt=\"$titlesCleaned\"></td>
                           <td class=\"desc1\">
                           <div>
                            <h3>".amazon_friendly_url($titlesCleaned, $asin)."</h3>
                            <p><b>".amazon_friendly_url($titlesCleaned, $asin)."</b></p>
                           <p>" . word_wrap_amazon_product_description($asin) . "</p>
                        </div>
                       </td>
                       </tr>
                        <tr>
                         <td class=\"price\">$newprice</td>
                         <td class=\"add-inf\"><input type=\"image\" img src=\"img/img-add-to-cart.png\" title=\"Add this item to your shopping cart\"></td>
                          </tr>
                             </table>
                                </form>";   
               
        if ($x == 0){    
          print("<tr>\n<td valign=\"center\" align=\"center\">$amazonDisplay</td>\n");    
        } elseif ($x == 2) {       
          print("<td valign=\"center\" align=\"center\">$amazonDisplay</td></tr>\n");         
        } else {     
          print("<td valign=\"center\" align=\"center\">$amazonDisplay</td>\n");    
        } 
    
         // Use some basic math to determine how many to show per line
         $x++; $x = $x % 2; 
    
        }
    
          print "</tr></table>\n";
      
    //}
    ?>
    

     

    i have a while() loop to get the last 10 products, but i need to use a foreach() at the same time to get the detaisl from amazon the way i have it now only loops 1 item.

     

    any help would be appreciated

     

    thanks guys

     

    Graham

  13. Hi Guys,

     

    I'm sure my logic is off somewhere in my code, basicaly i resize an uploaded image and move to it's location depending on whether it came from the US or UK site:

     

    Resize Function:

     

    function resize_image($uploadDirectory, $newFileName, $us = false)
    {
        $original_image   = $uploadDirectory;
        $ext              = substr($original_image, strrpos($original_image, '.') + 1);
        $canvas_width     = 65;
        $canvas_height    = 65;
        $canvas           = imagecreatetruecolor($canvas_width, $canvas_height);
        $white_background = imagecolorallocate($canvas, 255, 255, 255);
        
        imagefill($canvas, 0, 0, $white_background);
        list($image_width, $image_height) = getimagesize($uploadDirectory);
        
        $ratio = $image_width / $image_height;
        if ($ratio > 1) {
            $new_image_width  = 65;
            $new_image_height = 65 / $ratio;
        } //$ratio > 1
        else {
            $new_image_width  = (float) 65 * $ratio;
            $new_image_height = 65;
        }
        
        if ($ext == "jpg") {
            $original_image = imagecreatefromjpeg($original_image);
        } //$ext == "jpg"
        if ($ext == "gif") {
            $original_image = imagecreatefromgif($original_image);
        } //$ext == "gif"
        
        imagecopyresampled($canvas, $original_image, 0, 0, 0, 0, $new_image_width, $new_image_height, $image_width, $image_height);
        
        $new_thumbnail_name = "thumb-$newFileName";
        
        if ($ext == "jpg") {
        
        if ($us)
        {
        
          imagejpeg($canvas, "../../site.com/imgProducts/img-th/$new_thumbnail_name", 100);
          return ("$new_thumbnail_name");
        
        } else {
        
          imagejpeg($canvas, "../imgProducts/img-th/$new_thumbnail_name", 100);
          return ("$new_thumbnail_name");        
        
        }
         
        } //$ext == "jpg"
        
        if ($ext == "gif") {
        
        if ($us)
        {
        
          imagegif($canvas, "../../first-site.com/imgProducts/img-th/$new_thumbnail_name", 100);
          return ("$new_thumbnail_name");
        
        } else {
        
          imagegif($canvas, "../imgProducts/img-th/$new_thumbnail_name", 100);
          return ("$new_thumbnail_name");      
        
        }   
            
            
        } //$ext == "gif"
        imagedestroy($original_image);
        imagedestroy($canvas);
    }
    

     

    Upload Code:

     

    <?php
    if (isset($_POST['submit-add-product'])) 
    {
    
        $productNM = ucwords($_POST['txt-product-name']);
        $productDS = escape_data($_POST['txt-product-description'], 1);
        $productPM = $_POST['txt-product-p-medicine'];
        $productCT = $_POST['txt-product-category'];
        $productPR = $_POST['txt-product-price'];
        $productST = $_POST['txtSite'];
        $fileName  = $_FILES['txt-product-image']['name'];
        $fileTemp  = $_FILES['txt-product-image']['tmp_name'];
        $fileType  = $_FILES['txt-product-image']['type'];
        $fileSize  = $_FILES['txt-product-image']['size'];
    
        /*if (!empty($_FILES['txt-product-image-2']['name'])) {
            $fileName2nd        = $_FILES['txt-product-image-2']['name'];
            $fileTemp2nd        = $_FILES['txt-product-image-2']['tmp_name'];
            $fileType2nd        = $_FILES['txt-product-image-2']['type'];
            $fileSize2nd        = $_FILES['txt-product-image-2']['size'];
            $fileExtension      = substr(strrchr($fileName2nd, '.'), 0);
            $fileExtension      = strtolower($fileExtension);
            $replacedName2nd    = str_replace(" ", "-", $productNM . "-2nd");
            $newFileName2nd     = "$replacedName2nd-" . time() . "$fileExtension";
            $uploadDirectory2nd = "../imgProducts/img-fs/$newFileName2nd";
            $generate2ndImage   = true;
        } //!empty($_FILES['txt-product-image-2']['name'])
        
        if (empty($productNM)) {
            print "<p class=\"fcp-message-error\">You never entered a product name.</p>";
        } //empty($productNM)
        if (empty($productDS)) {
            print "<p class=\"fcp-message-error\">You never entered a product description.</p>";
        } //empty($productDS)
        if (empty($productPR)) {
            print "<p class=\"fcp-message-error\">You never entered a product price.</p>";
        } //empty($productPR)
        if (empty($fileSize)) {
            print "<p class=\"fcp-message-error\">You never entered a product image.</p>";
        } //empty($fileSize)
        if (!isImageFile($fileType)) {
            print "<p class=\"fcp-message-error\">The file you uploaded doesn't seem to be an image.</p>";
        } //!isImageFile($fileType)*/
        
        $fileExtension   = substr(strrchr($fileName, '.'), 0);
        $fileExtension   = strtolower($fileExtension);
        $replacedName    = str_replace(" ", "-", $productNM);
        $newFileName     = "$replacedName-" . time() . "$fileExtension";
        $uploadDirectory = "../imgProducts/img-fs/$newFileName";
        
        // US //
        if ($productST == "US")
        {
          $uploadDirectory = "../../first-choice-pharmacy.com/imgProducts/img-fs/$newFileName";
          //move_uploaded_file($fileTemp, $uploadDirectory2nd);
          
          if (move_uploaded_file($fileTemp, $uploadDirectory)) {
              $productWM = watermark_image($uploadDirectory, $newFileName, 1);
              $productTH = resize_image($uploadDirectory, $newFileName, 1);
          } //move_uploaded_file($fileTemp, $uploadDirectory)
          
          /*if (isset($generate2ndImage)) {
              watermark_image($uploadDirectory2nd, $fileTemp2nd);
              move_uploaded_file($fileTemp2nd, $uploadDirectory2nd);
          } //isset($generate2ndImage)*/
          
          $qI = mysql_query("INSERT INTO `fcpv3_products` (`id`,`category_id`,`product_name`,`product_description`,`product_thumbnail`,`product_fullsize`,`product_fullsize_second`,`product_price`,`product_weight`,`p_med`,`is_breakable`,`site`,`date_added`) VALUES ('','$productCT','$productNM','$productDS','$productTH','$newFileName','$newFileName2nd','$productPR','0.00','$productPM','N','US',NOW())");
          
          if ($_POST['updateTwitter'] == "yes") {
              $last_product_id = mysql_insert_id();
              $twitter_url     = generate_seo_friendly_links($productNM, $last_product_id);
              $username        = 'firstchoicephar';
              $password        = '';
              $status          = urlencode(stripslashes(urldecode('We just added ' . $productNM . ' http://www.firstchoicepharmacy.co.uk/product.php?id=' . mysql_insert_id())));
              if ($status) {
                  $tweetUrl = 'http://www.twitter.com/statuses/update.xml';
                  $curl     = curl_init();
                  curl_setopt($curl, CURLOPT_URL, "$tweetUrl");
                  curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                  curl_setopt($curl, CURLOPT_POST, 1);
                  curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status");
                  curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
                  $result      = curl_exec($curl);
                  $resultArray = curl_getinfo($curl);
                  if ($resultArray['http_code'] == 200) {
                      print "<p class=\"fcp-message-success\">Tweet made successfully .</p>";
                  } //$resultArray['http_code'] == 200
                  else {
                      print '<p class="fcp-message-error">OOPS, an error has occured Posting to twitter, please contact the site administrator.</p>';
                      curl_close($curl);
                  }
              } //$status
              
              if ($qI) {
                  print "<p class=\"fcp-message-success\">You have successfully added a new product.</p>";
              } //$qI
              else {
                  print '<p class="fcp-message-error">OOPS, an error has occured please contact the site administrator.</p>';
              }
          } //$_POST['updateTwitter'] == "yes"
          
        } elseif($productST == "UK") {
           
              if (move_uploaded_file($fileTemp, $uploadDirectory)) {
                  $productWM = watermark_image($uploadDirectory, $newFileName);
                  $productTH = resize_image($uploadDirectory, $newFileName);
              } //move_uploaded_file($fileTemp, $uploadDirectory)
              
              /*if (isset($generate2ndImage)) {
                  watermark_image($uploadDirectory2nd, $fileTemp2nd);
                  move_uploaded_file($fileTemp2nd, $uploadDirectory2nd);
              } //isset($generate2ndImage)*/
              
              $qI = mysql_query("INSERT INTO `fcpv3_products` (`id`,`category_id`,`product_name`,`product_description`,`product_thumbnail`,`product_fullsize`,`product_fullsize_second`,`product_price`,`product_weight`,`p_med`,`is_breakable`,`site`,`date_added`) VALUES ('','$productCT','$productNM','$productDS','$productTH','$newFileName','$newFileName2nd','$productPR','0.00','$productPM','N','UK',NOW())");
              
              if ($_POST['updateTwitter'] == "yes") {
                  $last_product_id = mysql_insert_id();
                  $twitter_url     = generate_seo_friendly_links($productNM, $last_product_id);
                  $username        = 'firstchoicephar';
                  $password        = 'milr';
                  $status          = urlencode(stripslashes(urldecode('We just added ' . $productNM . ' http://www.firstchoicepharmacy.co.uk/product.php?id=' . mysql_insert_id())));
                  if ($status) {
                      $tweetUrl = 'http://www.twitter.com/statuses/update.xml';
                      $curl     = curl_init();
                      curl_setopt($curl, CURLOPT_URL, "$tweetUrl");
                      curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
                      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                      curl_setopt($curl, CURLOPT_POST, 1);
                      curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status");
                      curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
                      $result      = curl_exec($curl);
                      $resultArray = curl_getinfo($curl);
                      if ($resultArray['http_code'] == 200) {
                          print "<p class=\"fcp-message-success\">Tweet made successfully .</p>";
                      } //$resultArray['http_code'] == 200
                      else {
                          print '<p class="fcp-message-error">OOPS, an error has occured Posting to twitter, please contact the site administrator.</p>';
                          curl_close($curl);
                      }
                  } //$status
                  
                  if ($qI) {
                      print "<p class=\"fcp-message-success\">You have successfully added a new product.</p>";
                  } //$qI
                  else {
                      print '<p class="fcp-message-error">OOPS, an error has occured please contact the site administrator.</p>';
                  }
              } //$_POST['updateTwitter'] == "yes"
           
        }
    
    } //isset($_POST['submit-add-product'])
    ?>
    

     

    When i change the $us flag the US site works and the UK one doesn't, the full size image always gets uploaded fine it appears to be my logic in the resize function (i think :))

     

    a fresh pair of eyes would be great

     

    thanks guys

     

    Graham

  14. Hi Guys,

     

    Using this code i am able to overlay a logo onto an image:

     

    <?php
       // Load the image where the logo will be embeded into
       $image = imagecreatefromjpeg("box.jpg");
    
       // Load the logo image
       $logoImage = imagecreatefrompng("logo.png");
       imagealphablending($logoImage, true);
    
       // Get dimensions
       $imageWidth=imagesx($image);
       $imageHeight=imagesy($image);
    
       $logoWidth=imagesx($logoImage);
       $logoHeight=imagesy($logoImage);	 
    
       // Paste the logo
       imagecopy(
          // source
          $image,
          // destination
          $logoImage,
          // destination x and y
          $imageWidth-$logoWidth, $imageHeight-$logoHeight,
          // source x and y
          0, 0,
          // width and height of the area of the source to copy
          $logoWidth, $logoHeight);
    
       // Set type of image and send the output
       //header("Content-type: image/png");
       //imagePng($image);
       imagejpeg($logoImage, "imageWithLogo.jpg", 100);
       
       // Release memory
       imageDestroy($image);
       imageDestroy($imageLogo);
    ?>
    

     

    this part:

     

      //header("Content-type: image/png");

      //imagePng($image);

     

    shows me the complete image with the logo ontop, what i'm having trouble with is saving the image.

     

    any help would be appreciated

     

    thanks guys

     

    Graham

     

  15. Hi Guys,

     

    Before i re-jig code i was wondering if this is possible, i have 2 ecommerce sites located on my server like:

     

     

    /www/site1.com

    /www/site2.com

     

    Instead of going into the admin panel of each site and uploading products individually i was going to re-jig the  admin code in site1.com to upload products to both site1 and site2.

     

    i know "../" goes up 1 directory but is it possible to not only go up a directory but move them into another sites folders altogether?

     

    kind of like:

     

    site1.com/admin/upload.php

     

    can move files into:

     

    site2.com/images/uploads/

     

    thanks guys

     

    Graham

     

    hop that makes sense!

     

    cheers guys

     

    Graham

  16. Hi Guys,

     

    I use this function to generate seo friendly names for my products once pulled from the database:

     

    function generate_seo_friendly_links($pNM, $pID)
    {
        $replacedNM = str_replace(" ", "-", $pNM);  
        $replacedNM = rtrim($replacedNM);  
        $brandNewSEOFriendlyURL = "<a href='$replacedNM-$pID.html'>$pNM</a>";    
        return $brandNewSEOFriendlyURL;
    }
    

     

    This works great, the only thing is say a product is stored in the database like:

     

    product name it would then be converted to: product-name.html

     

    if for example theres 2 spaces:

     

    product  name it would then be converted to: product--name.html

     

    with the 2 "--" so for every space it finds we replace with a "-" etc

     

    is there a way i could ignore more than 1 space and always have it like product-name-here.html so the names are more uniformed, i can't think of a way to do it.

     

    any help would be appreciated

     

    thanks guys

     

    Graham

  17. Hi Guys,

     

    I'm using the following code to write emails to a .txt file:

     

    
                    // Write the email to file
                    $leadsFile = "leads/emails.txt";
                    $fh = fopen($leadsFile, 'a') or die ("can't open leads file!");
                    $writeData = "$conEM\r\n";
                    fwrite($fh, $writeData);
                    fclose($fh); 
    

     

    which works great, but i can't figure out how to NOT write an email to the .txt file if it's already on it, i'm not using a database for a change i'm stumped lol

     

    thanks for any help guys

     

    Graham

     

     

  18. Hi Guys,

     

    I'm trying to write a descripton, if the description contains [any of these words] ignore:

     

    <?php
                    $ignoreWords = array(
                        "Commission",
                        "commission",
                        "affiliate",
                        "Affiliate",
                        "affiliates",
                        "Affiliates",
                        "Conversion",
                        "conversion",
                        "conversions",
                        "Conversions",
                        "Earn",
                        "earn"
                    );
                    
                    
                    if (in_array($pdcD, $ignoreWords))
                    {
                    
                      $newDescription = "For further information please click <b><a href=\"$url\" target=\"_blank\">here</a></b>.";
    
                    } else {
                    
                      $newDescription = $pdcD;
                    
                    }
    ?>
    

     

    If tghe description contains any of those words do the first option else do the second but when testing it doesn't work it executes the second option.

     

    any help would be appreciated

     

    thanks guys

     

    Graham

×
×
  • 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.