php include file-dem-code



PHP include file-dem-code


<?php
include "include/connection.php";
 include "include/functions.php";

?>


----------------------------->
<?php
 session_start();

/* if(@$_REQUEST['userId']!='')
 {
 $_SESSION['showUserId'] = $_REQUEST['userId'];   
 header("Location:showUserProfile.php");   
 }*/
 if(@$_SESSION['userId']=='')
 {
 header("Location:index.php");   
 }
 include "include/connection.php";
 include "include/functions.php";
 $msg='';
// $userId=$_SESSION['showUserId'];
 $userId=$_SESSION['userId'];
 $sql_prof="select * from `user_profile` where `userId`='$userId' ";
 $res_prof=mysql_query($sql_prof);
 $count=mysql_num_rows($res_prof);
 $r_prof=mysql_fetch_array($res_prof);

 if($count < 1){
  header("Location:index.php");   
 }

 ?>
Related Posts:
  • Opening a Remote File You want to open a file that's accessible to you via HTTP or FTP. Pass the file's URL to fopen( ):  $fh = fopen('http://www.example.com/robots.txt','r') or die($php_errormsg);     When fopen( ) is passed … Read More
  • Turning an Array into a String convert it into a  formatted string. Use join( ): // make a comma delimited list $string = join(',', $array); Or loop yourself: $string = ''; foreach ($array as $key => $value) { $string .= ",$value"; } $str… Read More
  • Changing File Permissions by php Use chmod( ) to change the permissions of a file:  chmod('/home/user/secrets.txt',0400);   Use chown( ) to change a file's owner and chgrp( ) to change a file's group: <?php chown('/tmp/myfile.txt','skla… Read More
  • Control Structures if else elseif/else if Alternative syntax for control structures while do-while for foreach break continue switch declare return require include require_ once include_ once goto … Read More
  • PHP Redirect - Redirect Script? PHP Redirect Function header('Location: destination.php'); exit();   ou need the Location: part so the browser knows what header it's  receiving. Also, don't forget to  do an exit() or die() right after… Read More
  • XML file using the DOM API //Use PHP's DOM XML extension. Here's how to read XML from a file: $dom = domxml_open_file('books.xml'); //Here's how to read XML from a variable: $dom = domxml_open_mem($books); //You can also get just a single node. H… Read More
  • You want to extract part of a string, starting at a particular place in the string Use substr( ) to select your substrings: $substring = substr($string,$start,$length); $username = substr($_REQUEST['username'],0,8); … Read More
  • Setting Environment Variables Setting environment variables in your server configuration on a host-by-host basis allows you to configure virtual hosts differently. <?php putenv('ORACLE_SID=ORACLE'); // configure oci extension ?>   Adjusting… Read More
  • Reading DOC file in php   read PDF and DOC files using PHP Reading PDF Files   $content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -');     Reading DOC Files  $content = shell_exec('/usr/local/bin/antiword '.$fi… Read More
  • Extracting Substrings You want to extract part of a string, starting at a particular place in the string. For example, you want the first eight characters of a username entered into a form.  Extracting a substring with substr( ) &l… Read More
  • Php get_meta_tags-Extracts all meta tag content attributes get_meta_tags — Extracts all meta tag content attributes from a file and returns an array <?php// Assuming the above tags are at www.example.com$tags = get_meta_tags('htt… Read More
  • Checking if a Host Is Alive Use PEAR's Net_Ping package: require 'Net/Ping.php'; $ping = new Net_Ping; if ($ping->checkhost('www.oreilly.com')) { print 'Reachable'; } else { print 'Unreachable'; } $data = $ping->ping('www.oreilly.com… Read More
  • Finding the Position of a Value in an Array Use array_search( ) . It returns the key of the found value. If the value is not in the array, it returns false:   $position = array_search($value, $array); if ($position !== false) { // the element in position&n… Read More
  • convert time in php <?php $thishour = time() + (4*60*60); $newTime = date("d m Y H:i:s",$thishour); echo $newTime; ?>); … Read More
  • Setting Default Values for Function Parameters Assign the default value to the parameters inside the function prototype: function wrap_html_tag($string, $tag = 'b') { return "<$tag>$string</$tag>"; }     The example in the Solution sets the… Read More