Jump to content

graham23s

Members
  • Posts

    890
  • Joined

  • Last visited

Everything posted by graham23s

  1. Hi Ignace, Thanks for that, that looks like what i'm after, the only thing is it only prints out "http" rather than the whole url. thanks mate Graham
  2. Hi Guys, i have .txt file wich has a bunch of urls like: Scarboroughfutard:ch5108ap:http://site.com Smutzfutard:ch78374ap:http://site.com there is a few hundred of them like this, i was thinking of a way to loop each line and only take the url, then write the url in another .txt file clean of the gunk at the beginning but i can't think of a way to do it, i guess i need to load the .txt file but what would be the best way after that? any help would be appreciated thanks guys Graham
  3. Hi Corbin, affURL is an actual url that gets loaded into the browser that's made, can i still do it that way even though i'm not actually loading a .php file to show the popup? cheers mate Graham
  4. Hi Guys, What i'm attempting to do is update a mysql database through a javascript function, so when i click on <a href='onclick="return myfunction();"'></a> function myfunction(affURL) { if (confirm('You will now be redirected to the purchase page, continue?')) { // Need a way to log things, update mysql with vars passed through var l = screen.availWidth / 2 - 450; var t = screen.availHeight / 2 - 320; var win = window.open(affURL, 'payPopupMain', 'width=900,height=650,left='+l+',top='+t+',scrollbars=1'); } else { // Send them back to the payment.php page window.location('payment.php'); } } The code above opens up a browser for the user, but i also want to update mysql without the user seeing any of it, so all they see if the browser popup, and behind the scenes the script updates mysql with a few variables any help on what i would need to do would be appeciated. thanks guys Graham
  5. ah thanks mark works perfect Graham
  6. Hi Guys, I'm not sure if this is more PHP or a javascript problem (both really) i'm trying to pass a url to a javascript function using php. code: <a href="#" onclick="payScreenPopup(<?php print 1; ?>);"><img src="img/img-button.gif" border="0"></a> function payScreenPopup(affURL) { alert(affURL); var l = screen.availWidth / 2 - 450; var t = screen.availHeight / 2 - 320; var win = window.open(affURL, 'papPopupMain', 'width=900,height=650,left='+l+',top='+t+',scrollbars=1'); } The problem is numbers get through and are alerted fine, but when i try any kind of text it doesn't seem to get through and popup, i'm not sure if it's something i need to do on the php side of things or javascript. any help would be appreciated thank guys Graham
  7. darn so it is lol, geez it's to early for me lol thanks mate i took it out the while loop and all is good thanks again mate Graham
  8. Hi Guys, I just wrote this basic code to check whether there are unread messages in the message table if there is then a javascript popup tells me so: <?php // Check to see if there are unread messages and display message to raz $qm = "SELECT * FROM `fcp_contact_messages` WHERE `message_filed`='N'"; $rm = mysql_query($qm) or die (mysql_error()); // Loop while ($am = mysql_fetch_array($rm)) { // Message flag $mFlag = $am['message_read']; // if ($mFlag == "N") { // Set a boolean $messagesUnread = true; } // if (isset($messagesUnread)) { print "<script type='text/javascript'>alert('There are unread message(s) in the inbox.')</script>"; } } ?> The code works fine but the problem is if there is 10 unread messages then i get 10 popups, i was just really wanting the 1 popup. i can't see what i can do to fix this. any help would be appreciated. thanks guys Graham
  9. Sorry guys fixed it, i did: function generate_seo_friendly_links($pNM, $pID) { // Clean up the product names $replacedNM = str_replace(" ", "-", $pNM); $brandNewSEOFriendlyURL = "<a href='$replacedNM-$pID.html'>$pNM</a>"; return $brandNewSEOFriendlyURL; } cheers Graham
  10. Hi Guys, I'm trying to tuen my links into SEO friendly ones, everything works fine untill: // GET THE PRODUCTS RANDOMLY AND PUT THEM IN A VARIABLE $productDisplay = "<form action='cart.php' method='POST' name='fcp-add-cart-form' /> <input type='hidden' name='fcp-cart-trigger' value='1' /> <input type='hidden' name='fcp-cart-trigger-product-id' value='$pID' /> <input type='hidden' name='fcp-cart-trigger-quantity' value='1' /> <table class='$borderColor' border='0' cellpadding='20' cellspaing='0' /> <tr> <td align='center'><img src='imgProducts/img-th/$pTH' border='0'></td><td class='fcp-product-display' align='center'>" . generate_seo_friendly_links($pNM, $pID) . "</td> </tr> <tr> <td align='center'><div class='TopSellerNumber'>£$pPR</div></td><td align='center'>$pBtn</td> </td> </tr> </table> </form>"; this bit: " . generate_seo_friendly_links($pNM, $pID) . " if i echo the product name like normal the name is displayed within the table, but when i do the above all the return values are somehow out the table, the function is: function generate_seo_friendly_links($pNM, $pID) { // Clean up the product names $replacedNM = str_replace(" ", "-", $pNM); print "<a href='$replacedNM-$pID.html'>$pNM</a>"; } i can't see how returning the URL ammended somehow throws the table out of whack thanks for any help guys Graham
  11. Hi Guys, thanks for that i understand better now, the way my site is setup i use id's like: product.php?id=1 instead of the actual product name like: product.php?id=product_name_here Does that make it any harder for me, or does the same basic rules apply like above? thanks guys Graham
  12. Hi Wild, I meant to change this type of URL: product.php?id=5 to: product-name.html so the URL's are more SEO friendly. thanks mate Graham
  13. Hi Guys, I'm sorry if this is the wrong section, what i am trying to so is: currently all my products on my ecommerce site look like: productid=1234 i was trying to change it so the actual product name is show: product-name-for-id-1234 is there any tutorials on how i would best go about this? thanks for any help guys Graham
  14. thanks mate sorted Graham
  15. Hi Guys, i have made a basic rss feed in PHP but i get the error: An invalid character was found in text content. Line: 60 Character: 92 Ingredients per 0.6ml: Yellow to orange liquid containing - Vitamin C (Ascorbic Acid) 40mg ^ the above is line 60, my code for looping the data from mYSQL is: while($result = mysql_fetch_array($doGet)){ ?> <item> <title><?php echo htmlentities(strip_tags(($result['product_name']))); ?></title> <description><?php echo htmlentities(strip_tags($result['product_description'],'ENT_QUOTES'));?></description> <link>http://www.site.co.uk/product-information.php?id=<?php echo $result['id'];?></link> <pubDate> <?=strftime( "%a, %d %b %Y %T %Z" , $result['pubDate']); ?></pubDate> </item> <?php } ?> is there something else i need to do to the data to make it usable? thanbks for nay help guys Graham
  16. Hi Guys, I currently have a form with a subject,message and send button, but was wondering if it was possible to add an upload field so attachments could be sent? is that possible at all? thanks guys Graham
  17. Hi Mate, You could also just put the image TYPES in the array e.g: image/jpg, image/jpeg $allowed = array('image/jpg,'image/jpeg); $imageType = $fileType; In your code you are checking the "filetype" rather than filename hope this helps Graham EDIT: sorry re-read it you are checking the filename after all lol (i havce spent to long at the computer today lol)
  18. Hi Mate, When i run the url through the validator: http://www.firstchoicepharmacy.co.uk/rss.php The errors are: 'utf8' codec can't decode byte 0x99 in position 1459: unexpected code byte (maybe a high-bit character?) [help] In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations. line 26, column 0: item should contain a guid element (30 occurrences) [help] </item> line 46, column 15: description contains bad characters (3 occurrences) [help] Optrex Actimist? Liposomal Eye Spray provides instant relief for the symptom ... ^line 349, column 75: title should not contain HTML: & [help] <title><![CDATA[Canesten Cream Combi Internal & External Creams]]>< ... ^line 619, column 0: Missing atom:link with rel="self" [help] </channel> if that pin points anything thanks mate Graham
  19. Hi Mate, is there any errors displayed? is the directory chmod 777? cheers Graham
  20. Hi Guys, My RSS feed is throwing up some errors (There are errors in your feed) code: <?php include("inc/inc-dbconnection.php"); header('Content-type: text/xml'); ?> <rss version="2.0" encoding="utf-8"> <channel> <title>Firstchoicepharmacy.co.uk</title> <description>First Choice Pharmacy - Cheap Online UK Pharmacy</description> <link>http://www.firstchoicepharmacy.co.uk/</link> <copyright>2009 Firstchoicepharmacy.co.uk</copyright> <?php $q_rss = "SELECT * FROM `fcp_products` ORDER BY `date_added` DESC LIMIT 30"; $r_rss = mysql_query($q_rss); while ($a_rss = mysql_fetch_array($r_rss)) { // vars $rss_id = $a_rss['id']; $rss_nm = htmlentities($a_rss['product_name']); $rss_de = strip_tags($a_rss['product_description']); $rss_dt = $a_rss['date_added']; ?> <item> <title><![CDATA[<?php print("$rss_nm"); ?>]]></title> <description><![CDATA[<?php print("$rss_de"); ?>]]></description> <link>http://www.firstchoicepharmacy.co.uk/product-information.php?productid=<?php print("$rss_id"); ?></link> <pubDate><?php print("$rss_dt"); ?></pubDate> </item> <?php } ?> </channel> </rss> have i missed naything out can anyone see? thanks guys Graham
  21. Hi Guys, With some trial and error i have come up with this query: SELECT COUNT(DISTINCT(`CART_ID`)),`CUSTOMER_ID` FROM `fcp_orders_master_log` GROUP BY `CUSTOMER_ID` ORDER BY COUNT(DISTINCT(`CART_ID`)) DESC which does indeed (appear) to display the ID's of the customers who have placed the most orders DESC, but i'm not sure how to display the number of orders they have placed beside them code: <?php /*** * Site statistics ***/ $qRT = "SELECT SUM(`WP_TO_CHARGE`) AS `REVENUE_TAKEN` FROM `fcp_orders_completed` WHERE `WP_TEST_LIVE`='COMPLETED'"; $rRT = mysql_query($qRT); $aRT = mysql_fetch_array($rRT); $REVENUE_TAKEN = number_format($aRT['REVENUE_TAKEN'], 2); $qRP = "SELECT SUM(`WP_TO_CHARGE`) AS `REVENUE_TAKEN` FROM `fcp_orders_completed` WHERE `WP_TEST_LIVE`='LIVE'"; $rRP = mysql_query($qRP); $aRP = mysql_fetch_array($rRP); $REVENUE_PENDING = number_format($aRP['REVENUE_TAKEN'], 2); /*** * Top customers ***/ $qTO = "SELECT COUNT(DISTINCT(`CART_ID`)),`CUSTOMER_ID` FROM `fcp_orders_master_log` GROUP BY `CUSTOMER_ID` ORDER BY COUNT(DISTINCT(`CART_ID`)) DESC"; $rTO = mysql_query($qTO); $qTC = "SELECT CUSTOMER_ID, SUM(QUANTITY) AS `COUNT` FROM `fcp_orders_master_log` WHERE `PROCESSED`='Y' GROUP BY CUSTOMER_ID ORDER BY SUM(QUANTITY) DESC"; $rTC = mysql_query($qTC); ?> <div id="fcp-admin-content" align="center" /> <table align="center" class="fcp-heading-main" border="0" bordercolor="#0000000" width="500" cellpadding="2" cdellspacing="0" /> <tr> <td colspan="2" class="fcp-heading" align="left"><b>Site Statistics</b></td> </tr> <tr> <td colspan="2" class="fcp-heading" align="center"><b>Revenue</b></td> </tr> <tr> <td class="fcp-heading-body" align="left">Revenue Taken:</td><td class="fcp-heading-body" align="right"><?php print "£$REVENUE_TAKEN"; ?></td> </tr> <tr> <td class="fcp-heading-body" align="left">Revenue Pending:</td><td class="fcp-heading-body" align="right"><?php print "£$REVENUE_PENDING"; ?></td> </tr> <tr> <td colspan="2" class="fcp-heading" align="center"><b>Top Customers</b></td> </tr> <tr> <td class="fcp-heading" align="center"><b>Customer</b></td><td class="fcp-heading" align="center"><b>Number of Products Purchased</b></td> </tr> <?php while ($aTC = mysql_fetch_array($rTC)) { $cusCO = $aTC['COUNT']; $cusID = $aTC['CUSTOMER_ID']; /*** * Customers name ***/ $qC = "SELECT `first_name`,`last_name` FROM `fcp_customers` WHERE `id`='$cusID'"; $rC = mysql_query($qC); $aC = mysql_fetch_array($rC); $FN = $aC['first_name']; $LN = $aC['last_name']; print '<tr> <td class="fcp-heading-body" align="left">'.$FN.' '.$LN.'</td><td class="fcp-heading-body" align="center">'.$cusCO.'</td> </tr>'; } ?> <tr> <td colspan="2" class="fcp-heading" align="center"><b>Top Customers (in terms of orders)</b></td> </tr> <tr> <td class="fcp-heading" align="center"><b>Customer</b></td><td class="fcp-heading" align="center"><b>Number of Orders Placed</b></td> </tr> <?php while ($aTO = mysql_fetch_array($rTO)) { $cusOP = $aTO['CUSTOMER_ID']; //$t = $aTO['COUNT']; print '<tr> <td class="fcp-heading-body" align="left">'.$cusOP.'</td><td class="fcp-heading-body" align="center">'.$t.'</td> </tr>'; } ?> </table> </div> <?php include("inc/inc-footer-admin.php"); include("inc/inc-online.php"); ?> so ultimately it displays: ID Number of orders 35 10 122 8 kinda thing thanks for any help guys Graham
  22. Hi Mate, as far as i know you can't unhash the md5, what you need to do is generate the user a random password, then let them change it themselves when they log in Graham
  23. ah perfect, thanks guys Graham
  24. Hi Guys, i use this simple math to get a random 9 digits appended to my string: $uniqueID = rand(000000000, 999999999); $uniID = "FCP-$uniqueID"; but sometimes the random digit doesn't use all 9 characters e.g FCP-123456789 then some might be: FCP-12345678 i'm trying to consistantly make the random number 9 characters long, is there a way i can make sure the numeric number is 9 digits long and no less? thanks for any help 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.