Jump to content

lovephp

Members
  • Posts

    530
  • Joined

  • Last visited

Everything posted by lovephp

  1. How to do this like indeed.com etc sending new job alerts to users daily? Say there are 10 new job listing on the site how do i send it to all users in daily basis without cronjob? Maybe with a function but how will the query be?
  2. i get your point bro but ill once again try to explain this. all seems to be working ok but its the relative links on the particular article.php which is <?php $url = $_SERVER['REQUEST_URI']; $url = str_replace('/blog/', '', ucwords($url)); $stmt = $db->prepare("SELECT id,title,keyword,description,image,youtube,article,created,views FROM article WHERE url = :url"); $stmt->bindParam(':url', $url, PDO::PARAM_STR); $stmt->execute(); $row = $stmt->fetch(); $count = $stmt->rowCount(); if($count <1){ header("Location: ".$site_path."index.php"); exit(); } $qry = "UPDATE article SET views = views +1 WHERE url = :url"; $stm = $db->prepare($qry); $stm->bindParam(':url', $url, PDO::PARAM_STR); $stm->execute(); ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <?php echo "<a href="index.php">Home</a>"; echo "<a href="somepage.php">Home</a>"; ?> <body> </body> </html> if you see in the body i added some links in relative manner and what happens is that those links becomes like http://localhost/blog/article/10/index.php now the article/10 is something i store in db as whole along with the url for the topic like article/10/this-is-some-topic-for-post now why on earth and from where the article/10/ gets added every relative links i cannot figure out but if i add absolute links like http://localhost/blog/index.php then all seems ok
  3. Need a site developed in php pdo no framework etc and should be secured against all xss, injection 1. Registration + login with retrieve and account validation 2. Submit resumes select categories and job type 3. Post job offering to category company name and logo 3. Search job city and localities wise which will be provided 4. Featured Job option payment via credit or debit card via ccavenue or payu any will do out of these two gateways 5. Downadable resumes in PDF bulk option download by making payment via credit or debit card 6. Simple and attractive responsive layout 7. Administrator for basic management of site and keep payments track etc 8. Users account management 9. Also apply jobs while searching with filter option 10. Must be seo friendly links Indian developer only inbox with ur quotation
  4. friends so i created seo friendly blog works ok but i face a issue which is say i in menu put links like index.php | contact.php all these works find but in my article.php it don't work if i do not add full url like say http://localhost/blog/index.php hope you get what im trying to say? here is my article.php page $url = $_SERVER['REQUEST_URI']; $url = str_replace('/blog/', '', ucwords($url)); //$sql=mysql_query("SELECT id,title,keyword,description,image,youtube,article,created,views FROM article WHERE url='".$url1."'"); $stmt = $db->prepare("SELECT id,title,keyword,description,image,youtube,article,created,views FROM article WHERE url = :url"); $stmt->bindParam(':url', $url, PDO::PARAM_STR); $stmt->execute(); $row = $stmt->fetch(); $count = $stmt->rowCount(); //$count = mysql_num_rows($sql); if($count <1){ header("Location: ".$site_path."index.php"); exit(); } $qry = "UPDATE article SET views = views +1 WHERE url = :url"; $stm = $db->prepare($qry); $stm->bindParam(':url', $url, PDO::PARAM_STR); $stm->execute(); //mysql_query("UPDATE article SET views = views +1 WHERE url ='".$url."'"); //$row=mysql_fetch_array($sql); and my htaccess RewriteEngine On RewriteBase /blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\?*$ article.php?$1 [L,QSA] how do i like every other page use links like index.php etc without having to use http://localhost/blog/index.php in my article.php page please someone.
  5. ok i made this dropdown which auto populate, but supposing if i store some value in db how on earth i fetch that value matching with my following code? if db value is like year 1999 how do i get it to show in my current dropdown? <select name="reduyear5" required> <option value="" selected="selected" disabled="disabled">Select Passed Year</option> <option value="Persuing">Persuing</option> <?php $start_year = date('Y')-45; $end_year = $start_year+45; for($i=$start_year; $i<=$end_year; $i++){ echo '<option>'.$i.'</option>'; } ?> </select>
  6. ok i got members table now i need to add 3 plans 1month, 6month and 12month with different fees. my question is do i need to create different table for it on it has to be in members table in db? someone guide through it please also i need to check if users sebscription over then remove some privillages from the website accordingly matching with plan. thanks
  7. does the job bro thanks aton. i thought we had to get it done through php.
  8. i have the jquery show/hide tpggle coding and what im looking for is if i expand it the result stays same even if page is refreshed and if i hide also the result then stays same according to the action. how to get it done i surely am getting no idea so would appreciate someones input on this <html> <head> <style> .spacer { display:block; } .expshow, .expless { cursor:pointer; background:#eee; border:1px solid #000; border-radius:3px; padding:5px 8px; color:#FF3333; } .expless {margin-top:10px;display:inline-block;} .info p { margin-bottom:0; } </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(document).ready(function (){ $(".info").hide(); $(".expshow").click(function(event) { $(this).parent(".expToggle").children("div.info").slideToggle(300); $(this).text($(this).text() == '[+]' ? '[-]' : '[+]'); }); $(".expless").click(function(event) { $(this).parent(".info").slideToggle(300); $(".expshow").text("[+]"); }); }); </script> </head> <body> <div class="expToggle"> <span class="expshow">[+]</span> <div class="info"> <br/> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum <br/> <span class="expless">[-]</span> </div> </body> </html>
  9. please do not close phpfreaks again. i almost had a heartattack
  10. I did a xss test and it gets gives me error which is <h5>Check In</h5> <div class="date_img"> <input class="date" id="from" name="from" type="text" value=""><br /> </div> <h5>Check Out</h5> <div class="date_img"> <input class="date" id="to" name="to" type="text" value="`\'\"><b><script>alert(document.cookie)</script></b>"><br /> </div> <h5>Room</h5> <select id="room_type" name="room_type"> <option valur="" >Super Club </option> <option valur="" >Club Room </option> <option valur="" >Mini Suite </option> There is a JavaScript alert the checker put here, how do i make it secure someone can tell me? Thanks
  11. if there are any errors in any of my pages it redirects me automatically to article.php page on my root DIR. what is wrong in this code any one? how do i not make it not to redirect to article.php if any errors in any pages? here is the bit from my htaccess RewriteEngine On RewriteBase /webfiles/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\?*$ article.php?$1 [L,QSA]
  12. Could you please show me the correct way to do it? would really appreciate it. As its news to me im having hard time with mysql old way i could have solved it but with pdo im not understanding how to even escape strings.
  13. now i see one other issue that is if in the address bar in url i add a ' like this http://localhost/web/post-article.php?id=62' i get error on page Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1' does that mean my code is not secure? how would i hide such error from showing?
  14. it seem to have disappeared after usage of bindParam in all insert or update areas, dunno if i did it right or wrong but seems to be doing ok now seriously i thank all of you for motivating me to put my head into PDO in one of my topic im on it and i will learn it well
  15. yes bro figured that out now how to get rid of ' quote issue? whenever i try to add that i get syntax error
  16. fixed it had an unnecessary Bind $stmt->bindParam(':ne_url', $seturl); but the single quote issue still remains
  17. i corrected it bro still i get error $qry1 = "UPDATE article SET ne_title = :ne_title, ne_keyword = :ne_keyword, ne_description = :ne_description, ne_image = :ne_image, ne_youtube = :ne_youtube, ne_article = :ne_article WHERE id = :id"; $stmt = $db->prepare($qry1); $stmt->bindParam(':ne_title', $ne_title); $stmt->bindParam(':ne_keyword', $ne_keyword); $stmt->bindParam(':ne_description', $ne_description); $stmt->bindParam(':ne_image', $img); $stmt->bindParam(':ne_youtube', $ne_youtube); $stmt->bindParam(':ne_article', $ne_article); $stmt->bindParam(':ne_url', $seturl); $stmt->bindParam(':id', $_GET['id']); $stmt->execute(); // mysql_query("UPDATE article SET ne_url='news-events/".$_GET['id']."/".$url."' WHERE id ='".$_GET['id']."'"); $seturl = "news-events/".$_GET['id']."/".$url.""; $qry2 = "UPDATE article SET ne_url = :ne_url WHERE id = :id"; $statement = $db->prepare($qry2); $statement->bindParam(':ne_url', $seturl); $statement->bindParam(':id', $_GET['id']); $statement->execute(); the same error Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\wamp\www\web\post-article.php:74 Stack trace: #0 C:\wamp\www\web\post-article.php(74): PDOStatement->execute() #1 {main} thrown in C:\wamp\www\web\hms\post-article.php on line 74
  18. i get the following error Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\wamp\www\web\post-article.php:74 Stack trace: #0 C:\wamp\www\web\post-article.php(74): PDOStatement->execute() #1 {main} thrown in C:\wamp\www\web\hms\post-article.php on line 74 while im trying to update records $qry1 = "UPDATE article SET ne_title = :ne_title, ne_keyword = :ne_keyword, ne_description = :ne_description, ne_image =' :ne_image, ne_youtube = :ne_youtube, ne_article = :ne_article WHERE id ='".$_GET['id']."'"; $stmt = $db->prepare($qry1); $stmt->bindParam(':ne_title', $ne_title); $stmt->bindParam(':ne_keyword', $ne_keyword); $stmt->bindParam(':ne_description', $ne_description); $stmt->bindParam(':ne_image', $img); $stmt->bindParam(':ne_youtube', $ne_youtube); $stmt->bindParam(':ne_article', $ne_article); $stmt->bindParam(':ne_url', $seturl); $stmt->bindParam(':id', $_GET['id']); $stmt->execute(); This is line 74 // mysql_query("UPDATE article SET ne_url='news-events/".$_GET['id']."/".$url."' WHERE id ='".$_GET['id']."'"); $seturl = "news-events/".$_GET['id']."/".$url.""; $qry2 = "UPDATE article SET ne_url = :ne_url WHERE id = :id"; $statement = $db->prepare($qry2); $statement->bindParam(':ne_url', $seturl); $statement->bindParam(':id', $_GET['id']); $statement->execute(); echo ('<meta http-equiv="refresh" content="1;url=post-article.php?id='.$_GET['id'].'">'); } also if in if i try to write anything with a ' single quite i get error bro
  19. done PDO::PARAM_STR was the cure is that correct? but no it works only in my local not on webhost
  20. also if there are ' quotes in any of my fields i get error data don't get submitted
  21. got that but what is wrong with my code that nothing is getting inserted? the image gets uploaded but not getting inserted into db
×
×
  • 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.