Jump to content

lovephp

Members
  • Posts

    530
  • Joined

  • Last visited

Everything posted by lovephp

  1. ok i got it wroking on wamp server but now that i try it on my webhost one a subfolder as /blog i am getting 404 page not found error :-( here is the rewrite rule in .htaccess file RewriteEngine On RewriteRule ^blog/([a-zA-Z0-9-/]+)$ article.php?$1 RewriteRule ^blog/([a-zA-Z0-9-/]+)$ article.php?$1 in my root folder i also have another .htaccess file which is as follow RewriteEngine On DirectoryIndex index.php ErrorDocument 404 http://www.site.com ErrorDocument 403 http://www.site.com RewriteCond %{HTTP_HOST} ^site\.com$ [NC] RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L] <IfModule mod_deflate.c> <FilesMatch "\.(css|x?html?|php)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> <IfModule mod_expires.c> ExpiresActive On ExpiresByType text/css A100 ExpiresByType text/html A100 </IfModule> what is wrong here? the url is as following http://www.site.com/blog/ID1/2015/06/22/neque-porro-quisquam-est-qui-dolorem-ipsum-quia-dolor-sit-. and in article.php this is how i am fetching the results <?php session_start(); require_once("dbcontroller.php"); $db_handle = new DBController(); include("log.php"); $url = mysql_real_escape_string($_SERVER['REQUEST_URI']); $url = str_replace('/blog/', '', ucwords($url)); $sql=mysql_query("SELECT id,blog_title,blog_image,blog_youtube,blog_article,created,views FROM article WHERE blog_url='".$url."'"); mysql_query("UPDATE article SET views = views +1 WHERE blog_url ='".$url."'"); $count = mysql_num_rows($sql); $row=mysql_fetch_array($sql); if($count <1){ header("ERROR: 404"); exit(); } ?>
  2. Create a function function Sendemail(){ Query and stuff here } Then include it on ur config file etc
  3. Ok so I created this blog and also managed to successfully store the title of the topic as blog_url now how on earth I fetch it on browser to display as www.mysite.com/TOPICID1/2015/06/20/my-topic-for-the-blog.php Help out from here please in a secure way. Regards
  4. hey all, what am i doing wrong here that on android device when i try to upload a file the session gets lost while browsing through files on the phone. on PC and on latest android devices it seems ok but on some im facing this issue. how could i keep the session active for a month if the user does not logout? my login.php codes are session_start(); function get_client_ip() { $ipaddress = ''; if ($_SERVER['HTTP_CLIENT_IP']) $ipaddress = $_SERVER['HTTP_CLIENT_IP']; else if($_SERVER['HTTP_X_FORWARDED_FOR']) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR']; else if($_SERVER['HTTP_X_FORWARDED']) $ipaddress = $_SERVER['HTTP_X_FORWARDED']; else if($_SERVER['HTTP_FORWARDED_FOR']) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR']; else if($_SERVER['HTTP_FORWARDED']) $ipaddress = $_SERVER['HTTP_FORWARDED']; else if($_SERVER['REMOTE_ADDR']) $ipaddress = $_SERVER['REMOTE_ADDR']; else $ipaddress = 'UNKNOWN'; return $ipaddress; } if(isset($_SESSION['LOGGED_IN']) && trim($_SESSION['LOGGED_IN']) == true) { header("Location: index.php"); } if(isset($_POST["submit"])) { $email = mysql_real_escape_string(trim(strip_tags($_POST['email']))); $password = mysql_real_escape_string(trim(strip_tags($_POST['password']))); $rs = mysql_query("select userID from users where user_email='$email'"); $duplicates = mysql_num_rows($rs); $rs1 = mysql_query("select userID,user_email,user_password from users where user_email='$email' AND user_password='".sha1($password)."'"); $maychpass = mysql_num_rows($rs1); $error = ''; if($email == "") { $error = 'E-mail address is required.'; }elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ $error = 'E-mail address is invalid.'; }elseif ($duplicates < 1){ $error = 'E-mail address not found.'; } elseif($password == "") { $error = 'Password is required.'; }elseif(strlen($password) < 6){ $error = 'Password is too short.<small>(Min 6 Chars)</small>'; }elseif ($maychpass < 1){ $error = 'Wrong password.'; } else{ $qry="select userID,user_full_name,user_email,user_password from users where user_email='$email' AND user_password='".sha1($password)."'"; $result=mysql_query($qry); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $user = mysql_fetch_assoc($result); $_SESSION['LOGGED_IN'] = true; $_SESSION['MAT_USER_ID'] = $user['userID']; $_SESSION['MAT_USER_FULL_NAME'] = $user['user_full_name']; $_SESSION['MAT_USER_EMAIL'] = $user['user_email']; $_SESSION['MAT_USER_IP'] = get_client_ip(); setcookie("matLogged", "".$_SESSION['MAT_USER_EMAIL'].""); setcookie("matLogged", "".$_SESSION['MAT_USER_EMAIL']."", time()+43200); $ip = get_client_ip(); session_write_close(); echo("<p align='center'><font color='green' size='5'>Success:</font> Login successful, redirecting to members page.<br/><img src='img/loader.gif' alt='Loader'></p>"); mysql_query("UPDATE users SET ip = '".$ip."' WHERE userID = '".$user['userID']."'"); echo ('<meta http-equiv="refresh" content="5;url=index.php">'); exit(); }else { //Login failed echo("<p align='center'><font color='red' size='5'>Error:</font> Something went wrong, redirecting to login page.<br/><img src='img/loader.gif' alt='Loader'></p>"); echo ('<meta http-equiv="refresh" content="5;url=login.php">'); exit(); } } } } would really appreciate your help and time
  5. thanks alot bro..
  6. got it i added unset($_SESSION['criteria']); this works
  7. got it, actually there was issues with the names of fields in search.php but facing another issue if there isnt any search query the sesseion still displays results from more.php thought i added unset($criteria); if(isset($_POST['page'])): $paged=mysql_real_escape_string($_POST['page']); if(isset($_SESSION['criteria']) && !empty($_SESSION['criteria'])) { //assign to local var if available $criteria = $_SESSION['criteria']; $sql="SELECT * FROM profiles WHERE " . implode(' AND ', $criteria)." ORDER BY UserID DESC"; if($paged>0){ $page_limit=$resultsPerPage*($paged-1); $pagination_sql=" LIMIT $page_limit, $resultsPerPage"; } else{ $pagination_sql=" LIMIT 0 , $resultsPerPage"; } $result=mysql_query($sql.$pagination_sql); $num_rows = mysql_num_rows($result); if($num_rows>0){ while($data=mysql_fetch_array($result)){ $fname=$data['dob']; $lname=$data['Lname']; echo "<table border='0'> <tr> <td width='20%'> <img src='uploads/profiles/1432715714.jpg' class='loadimg'> </td> <td width='80%'> <h3>Balaswami Surraminiam</h3> <b>Age:</b> 60 <br/> <b>Caste:</b> $fname <br/> <b>Height:</b> 4' 5'' <br/> <b>Profession:</b> Chartered Accountant <br/> <b>Location:</b> Badarpur Rly Township <br/> <a href='#'>view profile</a> </td> </tr> </table>"; } } if($num_rows == $resultsPerPage){?> <li class="loadbutton"><button class="loadmore" data-page="<?php echo $paged+1 ;?>">More. </button></li> <?php }else{ echo "<li class='loadbutton'><span class='endload'> No more. </span></li>"; unset($criteria); } } endif; ?>
  8. im trying to set the $criteria to session but when i print only the $criteria[] = "Employment = '".$employment."'"; and $criteria[] = "YEAR(FROM_DAYS(DATEDIFF(CURDATE(), dob))) BETWEEN '".$agefrom."' AND '".$ageto."'"; are getting the values of print_r($criteria); Array ( [0] => Employment = 'Employed' [1] => YEAR(FROM_DAYS(DATEDIFF(CURDATE(), dob))) BETWEEN '18' AND '25' ) if(isset($_POST['submit'])){ $employment = mysql_real_escape_string($_POST['employment']); $mstatus = mysql_real_escape_string($_POST['mstatus']); $agefrom = mysql_real_escape_string($_POST['agefrom']); $ageto = mysql_real_escape_string($_POST['ageto']); $criteria = array(); if($employment !='') { $criteria[] = "Employment = '".$employment."'"; } if($mstatus !='') { $criteria[] = "Maritalstatus = '".$mstatus."'"; } if($agefrom !='' && $ageto !='') { $criteria[] = "YEAR(FROM_DAYS(DATEDIFF(CURDATE(), dob))) BETWEEN '".$agefrom."' AND '".$ageto."'"; } $_SESSION['criteria'] = $criteria; } print_r($criteria);
×
×
  • 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.