Jump to content

graham23s

Members
  • Posts

    890
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    Scotland The Brave

graham23s's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  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 P, Ah that is because i messed with the opacity settings here: define('WATERMARK_OVERLAY_OPACITY', 100); I used 100 for the black one, and 50 for the transparent one Here is the latest one: http://www.camnev-electronics.com/img/img-wmLogo.png and another: http://www.camnev-electronics.com/img/wmlogo1.png I cannot figure it out at all lol cheers P Graham
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. Thanks a ton Cags i added the extension in the regex as advised, everything is working great thanks mate Graham
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
×
×
  • 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.