Jump to content

Albos

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

About Albos

  • Birthday 12/16/1986

Profile Information

  • Gender
    Male
  • Location
    UK - Newcastle Upon Tyne

Albos's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You will need to create a page with some validation on, so when you press submit say for example the page goes to memberspage.php Then in members page you will need something to check if this person has entered the correct login information: <?php if($_POST["username"] == "admin" && $_GET["password"] == "password"){ // Have some member information in here that needs viewing // You could maybe set a cookie for the user so they dont have to keep logging in setcookie("memberlogin", "loggedin", time() + 3600); }else{ // Redirect the user to the login page as authentication failed. header("Location: loginpage.php"); } ?> This is very basic and you would need to put some sort of validation in to check for people trying to hack your site or anything. Hope this helps, if you need more information on the cookie side check this out http://php.net/manual/en/function.setcookie.php Regards Albos
  2. Hi, It sounds like your server does not want to send the email and probably has nothing to do with the database/php code. I would first make sure to see if you are allowed to use SMTP on your web server, if you are make sure that there is nothing blocking the emails being sent. I know some servers will limit to say 10 emails within a set amount of time so you are not using your server to send mass spam emails. Worth checking both. Hope this Helps Regards Albos
  3. Very nice indeed. Only problems i see is you have no validation checks in place maybe consider using striptags, also you have no checks in place to make sure its a correct email address either so consider using regex or something for that. Apart from that its great well done!
  4. Do not get me wrong, i mean its not intentional spam in the slightest but i would class this as spam non the less. If you need any help give me a shout, its a really nice project you got going here! Regards Albos
  5. For example, if a viewer of the site was to click on the link in google, then go back click again i presume this would then send 2 emails within a few seconds repeating this 100 times or so over a minute would then send 100 emails to the site owner which i would class as spam. Hoping you see what i mean. As a suggestion maybe in the script as soon as the user is logged coming from google onto your site assign a cookie and then when someone comes from google, see if the user has been logged in the last hour by checking if the cookie exsists. If not then log it as a visit and send an email then assign the cookie. Hope i explained this alright. Regards Albos
  6. Yes i get the right results, i have added a rand() which works but i am still getting the current product i am looking at, but WHERE id != '$productid' The rest of the LIKE statements are in the foreach loop which cycles through each keyword. The only problem i am having now is to not display the current product you are viewing in the results that get thrown out <?php $keywords = explode(", ", $keywords); $str = "SELECT * FROM tbl_products WHERE id != '$productid' AND keywords LIKE '%fubar%' "; $strend = " ORDER BY RAND() LIMIT 3"; foreach($keywords as $v){ $wstr = @$wstr."OR "; $wstr = $wstr."keywords LIKE '%$v%' "; } return $str.$wstr.$strend; ?>
  7. Hello all, I am currently pulling my hair out about this and looking at it i can not really see what i am doing wrong, i think mainly i have been looking at this too long and it may help to have a fresh pair of eyes to look over it. This code should pull out 3 products that have similar keywords to the current product you are looking at, this works without any major errors but its not working as i had hoped it would. It pulls out the first 3 results from the database that it finds and 9 times out of 10 will always display the current product that you are viewing which is not what i had wanted. My end result would need be 3 random results from the database that have similar keywords to the current product being viewed (preferred if it pulled maybe 3 random results each time you view the page). Also would need to block pulling the currently viewed product as well. I have tried WHERE id != '$productid'.... but this does not seem to work and ends up blocking a lot of results coming out for some reason, i am not sure where this would have be in my SQL statement. I tried to use the shuffle function on my PDO query but this throws an error, i could not find any predefined PDO functions to shuffle results, would anyone know how to do this at all? Many Thanks and Regards Albos <?php /** * Create a PDO Connection */ $dbh = new PDO(PDO Connection Information); /** * Set the error reporting attributes */ $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $similarsql = $this->generateSimilarSQL($keywords, $productid); $sql = ("$similarsql"); $query = $dbh->query($sql); /** * Cycle through the results and print each one out */ foreach ($query as $row ){ $filext = $this->fileTypeConvert($row["filetype"]); echo '<div class="simthumbs"> <a href="viewproduct.php?id='.$row["id"].'" title="" alt=""><img src="products/thumbnails/'.$row["id"].'_thumb.'.$filext.'" alt="" title="" /></a><br /> <span class="title">'.$row["code"].' '.$row["title"].'</span><br /> </div>'; } ?> <?php protected function generateSimilarSQL($keywords, $productid){ $keywords = explode(", ", $keywords); $str = "SELECT * FROM tbl_products WHERE keywords LIKE '%fubar%' "; $strend = " LIMIT 3"; foreach($keywords as $v){ $wstr = @$wstr."OR "; $wstr = $wstr."keywords LIKE '%$v%' "; } return $str.$wstr.$strend; } ?>
  8. Love the idea, can't really say anything about the code, all looks good to me. One thing i may add though is would it not be best to add the information to a database so the site admin could then see the information in the admin panel or something instead of emailing each time a new visitor arrives. Also maybe put a time limit on getting the data (1 hour or so) as this has the potential to be spammed quite easily. Just my thoughts but good luck with this, has some great potential
×
×
  • 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.