Jump to content

KevHopwood

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by KevHopwood

  1. So over 700 views and not 1 reply?
  2. Hi people. I'm creating a website that runs on php and mysql. I have a list page which grabs all the info on mysql and displays the content. once clicking on one of these it brings up a single page which lists more info on that specific item. what I want is to add a comments field(feedback / review or what ever you may wish to call it) underneath the info on the single page. The commenter does not need to be logged in but maybe use there facebook Id or something to stop spammers clogging up the page. what is the best way to do this? Will it be using another mysql field called review? or is there some other way of doing this? please can someone point me in the right direction for a tutorial (youtube preferably)? thanks for your help. Kev.
  3. So please can you show me the type of code I need to add in order to do this? Thank you.
  4. Sorry I'm not the best at PHP but I'm learning. I'm creating my website and am creating a page called more. Within this page I want to add a list of my top 5 promotions on my site. Each promotion is saved in my mobi database in mysql and I have added a count for each time someone views a particular promotion on my single.php page. So basically. What I need to do is display 5 promotions with the highest number in the "views" field in my mobi database. I currently have these codes: include_once('include/connection.php'); include_once('include/article.php'); and <?php foreach ($articles as $article) { ?> <a href="list.php?id=<?php echo $article['promo_title']; ?>"> <?php echo $article['promo_title']; ?> </a> in more.php and also class views { public function fetch_all(){ global $pdo; $query = $pdo->prepare("SELECT * FROM mobi ORDER BY views DESC LIMIT 0, 5"); $query->execute(); return $query->fetch(); } } in articles.php which only loads some weird text of "t t t t h h w w d d d d 3 3" what more will I need to add to get this to work? thank you.
  5. Hi all. I have a mobile cms website situated <a href="http://www.xclo.mobi/xclo2">here</a> all of my apps and offers are located in a database. Is there a way for me to add a popular / most visited section to my site that reads how many times each offer has been viewed and for it to display a lost of the top 5. Can some one help me on how to do this? Thanks.
  6. They provide details on how to wright the link but not on how to grab the info from them.
  7. I have created a website that lists a lot of offers from my affiliate partners (such as affiliate Window, tradedouble and mobpartner). I believe tat in order for me to get more users and more uptake, I need to offer an incentive program. I've been reading about callback URLs and was wondering if there was a way that I can integrate such a program to my site. What the user sees: The user logs on to my website and clicks one of my links to visit one of my partners sites. They then buy / download / sign up or whatever is required for the terms of commission. They then come back to my website and see that they have points available so they can spend them on rewards. What I need to happen to do this: I provide my affiliate link as usual and then once the user clicks and up takes the terms then I get commission in my affiliate site. This is currently what happens but what I need is a system to for my affiliate sites to send the callbacks to which then rewards the user. Can anyone provide me on the means on setting this up? I know many sites do such a thing like cashback sites but how do I do it for myself? Please please please help. I have been working on this for ages.
  8. Cheers pal. I'm a css guy. I'm still learning php. I'll give it a try.
  9. Actually. Slite problem. When viewing this in windows it still shows the download button. How do I add the else hide feature so that it ONLY shows up on a device that is necessary?
  10. Thank you. This is just what I needed,
  11. If you have a look at The attached picture, taken on my iPad just now you will see 3 app downloads buttons. The top One links to app.php?id=android the middle one links to app.php?id=iphone and the bottom one links to app.php?id=ipad. Obviously on this occasion only the 3rd link should be visible and the other 2hidden as I am viewing on my iPad. If I was to view on my iPod touch then only the middle one should be visible. My code for the index.php page in the screenshot is this: <?PHP include_once('include/connection.php'); include_once('include/article.php'); $category = new category; $articles = $category->fetch_all(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Xclo.mobi</title> <link type="text/css" rel="stylesheet" href="other.css" /> <link rel="apple-touch-icon" href="homescreen.png" /> <link href="startup.png" rel="apple-touch-startup-image" /> <script type="text/javascript"> var bodyclass ='desktop'; if ( (navigator.userAgent.indexOf('android') != null) ) { bodyclass = 'android'; } else if((window.navigator.userAgent.match('iphone') != null)||(window.navigator.userAgent.match('iPod') != null)) { bodyclass = 'iphone'; } else if (window.navigator.userAgent.match('ipad') != null){ bodyclass = 'ipad'; } window.onload = function(){ document.body.className += ' '+ bodyclass; } <script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-34172259-1']); _gaq.push(['_setDomainName', 'xclo.co.uk']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <?php include_once('header.php'); ?> <div id="content"> <ul class="pageitem"><li class="button android"><input name="Submit" value="App Downloads" onclick="window.location='apps.php?id=android' " type="submit" /></li></ul> <ul class="pageitem"><li class="button iphone"><input name="Submit" value="App Downloads" onclick="window.location='apps.php?id=iphone' " type="submit" /></li></ul> <ul class="pageitem"><li class="button ipad"><input name="Submit" value="App Downloads" onclick="window.location='apps.php?id=ipad' " type="submit" /></li></ul> <?php foreach ($articles as $article) { ?> <ul class="pageitem"><li class="button"> <a href="list.php?id=<?php echo $article['promo_cat']; ?>"> <input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>"/> </a></li></ul> <?php } ?> </div> <br><center> <SCRIPT charset="utf-8" type="text/javascript" src="http://ws-eu.amazon-...d9-6cf16307e855"> </SCRIPT> <NOSCRIPT><A HREF="http://ws-eu.amazon-...t">Amazon.co.uk Widgets</A></NOSCRIPT></center> <?php include_once('footer.php'); ?> </body> </html> Any ideas on how to get this to work please. Thank you.
  12. Hi all. I'm building a site (which you will be able to find here: http://www.xclo.mobi/xclo2) and have a list of categories on this site. Each category on that page is linked to an item In my Database. Which then displays more content once clicked. I have a separate database form within the same database called apps (instead of mobi). Inside this I have a list of apps available but some apps are for selected devices. For example some apps link to google play and can only be displayed on an android device as displaying these on another device (ios for example) can be seen as pointless. The same goes for displaying iPad apps on an iPhone and also on an android as these can be seen as pointless. The device is saved in my apps database under the field "device" and have one of these categories iPhone iPad or android, What I would like is to display a category on my index page along side my other ones which say "APP DOWNLOADS". And once clicked it only displays the relevant apps available just like my current promotions on my site. But I only want the link to appear if they are on one of these devices: iPod touch, iPhone, iPad mini, iPad, android as these are the only devices that I have content for at the moment. For example. If you are viewing on a blackberry or a windows 8 or even a Firefox phone then this category will not show up. Please can someone tell me how to do this? Thank you. My code for my index page is: <?PHP include_once('include/connection.php'); include_once('include/article.php'); $category = new category; $articles = $category->fetch_all(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Xclo.mobi</title> <link type="text/css" rel="stylesheet" href="other.css" /> <link rel="apple-touch-icon" href="homescreen.png" /> <link href="startup.png" rel="apple-touch-startup-image" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-34172259-1']); _gaq.push(['_setDomainName', 'xclo.co.uk']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <?php include_once('header.php'); ?> <div id="content"> <?php foreach ($articles as $article) { ?> <ul class="pageitem"><li class="button"> <a href="list.php?id=<?php echo $article['promo_cat']; ?>"> <input type="submit" name="Submit" value="<?php echo $article['promo_cat']; ?>"/> </a></li></ul> <?php } ?> </div> <br><center> <SCRIPT charset="utf-8" type="text/javascript" src="http://ws-eu.amazon-adsystem.com/widgets/q?rt=tf_sw&ServiceVersion=20070822&MarketPlace=GB&ID=V20070822%2FGB%2Fxclo-21%2F8002%2Fc2cd2f40-ca29-49bc-add9-6cf16307e855"> </SCRIPT> <NOSCRIPT><A HREF="http://ws-eu.amazon-adsystem.com/widgets/q?rt=tf_sw&ServiceVersion=20070822&MarketPlace=GB&ID=V20070822%2FGB%2Fxclo-21%2F8002%2Fc2cd2f40-ca29-49bc-add9-6cf16307e855&Operation=NoScript">Amazon.co.uk Widgets</A></NOSCRIPT></center> <?php include_once('footer.php'); ?> </body> </html> Please help. Thank you.
  13. Ok. Thank you. But how do I get it to rename the saved image to the brand name because on my iPad every image is uploaded as image.jpg. So I would like to rename it to the brand name. Is that possable? Thank you.
  14. I think it has all been explained above. Just not that clear. In a nut shell. The upload button with the code above works by adding the image to my images folder so thank you for that. But on a seperate note, let's say for example that I upload an image called "image123.jpg". It saves the image as image.jpg but not http://www.mysite.com/images/image123.jpg. Which means it does not display on my site. How can I upload the "image123.jpg" and have it saved In mysql as the full site link? Thanks.
  15. What I need is for the file to save to the images folder like ur does then automatically add the saved location to the URL field so that that can be read correctly.
  16. This adds the article but does not add the image to my site.
  17. So what do I need to add to do that? Help please. Thank you.
  18. Im creating a CMS for my site and in my admin page I have an add page that adds new content to my site LOCATED HERE and have added a few form fields. 2 of these are: IMAGE URL (text box) & UPLOAD IMAGE (select file button) When I fill in all the fileds and select an image using IMAGE URL and hit add article, it works fine and my form is saved to my database and is then displayed on my site. When I fill in all the fileds and select an image using UPLOAD IMAGE and hit add article, it adds the image to my selected folder in my cpanel but DOES NOT ADD TO DATABASE. My question is: How can I get it to add to the database? and save the new images location to the image field on the database? I have followed this tutorial when adding the upload file button to my page. Please do not show me links on how to do this as I already have read through them but I stuggle when it comes to adding this to my code. my add.php code is this. <?php session_start(); include_once('../include/connection.php'); if (isset($_SESSION['logged_in'])){ if (isset($_POST['title'], $_POST['content'])) { $title = $_POST['title']; $content = nl2br($_POST['content']); if (!empty($_POST['image'])) { $image = $_POST['image']; } else { $image = $_POST['imageupload']; if (isset($_FILES['imageupload'])) { $errors = array(); $allowed_ext = array('jpg', 'jpeg', 'png', 'gif'); $file_name = $_FILES['imageupload'] ['name']; $file_ext = strtolower (end (explode ('.', $file_name))); $file_size = $_FILES['imageupload'] ['size']; $file_tmp = $_FILES['imageupload'] ['tmp_name']; if (in_array ($file_ext, $allowed_ext) === false) { $errors[] = 'File extension not allowed'; } if ($file_size > 2097152) { $errors[] = 'File size must be under 2mb'; } if (empty($errors)) { if (move_uploaded_file($file_tmp, 'images/'.$file_name)) { echo 'File uploaded'; } }else{ foreach ($errors as $error) echo $error, '<br />'; } } } $link = $_POST['link']; $category = $_POST['category']; $brand = $_POST['brand']; if (empty($title) or empty($content)) { $error = 'All Fields Are Required!'; }else{ $query = $pdo->prepare('INSERT INTO mobi (promo_title, promo_content, promo_image, promo_link, promo_cat, promo_name) VALUES(?, ?, ?, ?, ?, ?)'); $query->bindValue(1, $title); $query->bindValue(2, $content); $query->bindValue(3, $image); $query->bindValue(4, $link); $query->bindValue(5, $category); $query->bindValue(6, $brand); $query->execute(); header('location: index.php'); } } ?> <?php if (isset($_FILES['Filedata'])) { // And if it was ok if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK) exit('Upload failed. Error code: ' . $_FILES['image']['error']); $filename = $_FILES['Filedata']['name']; $targetpath = "../img/news/" . $filename; //target directory relative to script location $copy = copy($_FILES['Filedata']['tmp_name'], $targetpath); } ?> <html> <head> <title>Add Article</title> <link rel="stylesheet" href="../other.css" /> </head> <body> <div class="container"> <a href="index.php" id="logo"><b>← Back</b></a> <br /> <div align="center"> <h4>Add Article</h4> <?php if (isset($error)) { ?> <small style="color:#aa0000;"><?php echo $error; ?></small><br /><br /> <?php } ?> <form action="add.php" method="post" autocomplete="off" enctype="multipart/form-data"> <input type="text" name="title" placeholder="Title" /><br /><br /> <textarea rows="15" cols="50" placeholder="Content" name="content"></textarea><br /><br /> <input name="imageupload" type="file" id="image" placeholder="Imageupload" /> <input type="text" name="image" placeholder="Image" /><br /><br /> <input type="link" name="link" placeholder="Link" /><br /><br /> <input type="category" name="category" placeholder="Category" /><br /><br /> <input type="category" name="brand" placeholder="Brand" /><br /><br /> <input type="submit" value="Add Article" /> </form> </div> </div> </body> </html> <?php }else{ header('location: index.php'); } ?> please help. thanks.
  19. I'm creating an admin side to my website. I have created an add page and within this page is a form with a few fields. 2 of these are an upload button for me to upload an image. And the other one is a fill box for me to enter a URL. I have set it up so that both of them update the same mysql field and also the fill box is priority for when both are entered. However. The search box is fine as it saves the link correctly but selecting an image using the select box only saves the file name in this field in mysql for example: xxxxxxxxxxxxx.png So with my website displaying these images, it does not display the uploaded ones. Obviously because these are saved on to my computer and not on to my cpanel. So my question is: How can I upload an image using the upload box and have it save to my /images folder then have mysql display that URL link in the relevant field? My add.php code is this: <?php session_start(); include_once('../include/connection.php'); if (isset($_SESSION['logged_in'])){ if (isset($_POST['title'], $_POST['content'])) { $title = $_POST['title']; $content = nl2br($_POST['content']); if (!empty($_POST['image'])) { $image = $_POST['image']; } else { $image = $_POST['imageupload']; if (isset($_FILES['Filedata'])) { $filename = $_FILES['Filedata']['name']; $targetpath = "/images/" . $filename; //target directory relative to script location $copy = copy($_FILES['Filedata']['tmp_name'], $targetpath); if (!$copy) $error = "Image was not uploaded successfully"; } } $link = $_POST['link']; $category = $_POST['category']; $brand = $_POST['brand']; if (empty($title) or empty($content)) { $error = 'All Fields Are Required!'; }else{ $query = $pdo->prepare('INSERT INTO mobi (promo_title, promo_content, promo_image, promo_link, promo_cat, promo_name) VALUES(?, ?, ?, ?, ?, ?)'); $query->bindValue(1, $title); $query->bindValue(2, $content); $query->bindValue(3, $image); $query->bindValue(4, $link); $query->bindValue(5, $category); $query->bindValue(6, $brand); $query->execute(); header('location: index.php'); } } ?> <?php if (isset($_FILES['Filedata'])) { // And if it was ok if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK) exit('Upload failed. Error code: ' . $_FILES['image']['error']); $filename = $_FILES['Filedata']['name']; $targetpath = "../img/news/" . $filename; //target directory relative to script location $copy = copy($_FILES['Filedata']['tmp_name'], $targetpath); } ?> <html> <head> <title>Add Article</title> <link rel="stylesheet" href="../other.css" /> </head> <body> <div class="container"> <a href="index.php" id="logo"><b>← Back</b></a> <br /> <div align="center"> <h4>Add Article</h4> <?php if (isset($error)) { ?> <small style="color:#aa0000;"><?php echo $error; ?></small><br /><br /> <?php } ?> <form action="add.php" method="post" autocomplete="off"> <input type="text" name="title" placeholder="Title" /><br /><br /> <textarea rows="15" cols="50" placeholder="Content" name="content"></textarea><br /><br /> <input name="imageupload" type="file" id="image" placeholder="Imageupload" /> <input type="text" name="image" placeholder="Image" /><br /><br /> <input type="link" name="link" placeholder="Link" /><br /><br /> <input type="category" name="category" placeholder="Category" /><br /><br /> <input type="category" name="brand" placeholder="Brand" /><br /><br /> <input type="submit" value="Add Article" /> </form> </div> </div> </body> </html> <?php }else{ header('location: index.php'); } ?> Please help. Thanks.
  20. hi all. Creating a cms and am adding an add page. my code for add.php is: <?php session_start(); include_once('../include/connection.php'); if (isset($_SESSION['logged_in'])){ if (isset($_POST['title'], $_POST['content'])) { $title = $_POST['title']; $content = nl2br($_POST['content']); $image = $_POST['Image URL']; $link = $_POST['Link']; $price = $_POST['Price']; if (empty($title) or empty($content)) { $error = 'All Fields Are Required!'; }else{ $query = $pdo->prepare('INSERT INTO apps (app_title, app_content, app_img, app_link, app_price) VALUES(?, ?, ?, ?, ?)'); $query->bindValue(1, $title); $query->bindValue(2, $content); $query->bindValue(3, $image); $query->bindValue(4, $link); $query->bindValue(5, $price); $query->execute(); header('location: index.php'); } } ?> <html> <head> <title>testing</title> <link rel="stylesheet" href="../style.css" /> </head> <body> <div class="container"> <a href="index.php" id="logo">CMS</a> <br /> <h4>Add Article</h4> <?php if (isset($error)) { ?> <small style="color:#aa0000;"><?php echo $error; ?></small><br /><br /> <?php } ?> <form action="add.php" method="post" autocomplete="off"> <input type="text" value="" name="title" placeholder="Title" /><br /><br /> <textarea rows="15" cols="50" value="" placeholder="Content" name="content"></textarea><br /><br /> <input type="text" value="" name="Image URL" placeholder="Image URL" /><br /><br /> <input type="text" value="" name="Link" placeholder="Link" /><br /><br /> <input type="text" value="" name="Price" placeholder="Price" /><br /><br /> <input type="submit" value="Add Article" /> </form> </div> </body> </html> <?php }else{ header('location: index.php'); } ?> my trouble is. it does not add to the database and there for I am unable to add content. can anyone see why? (cpanel error log is turned on and not telling me there is an error)
×
×
  • 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.