Tuesday, December 4, 2012

Post On Facebook From WebSite


<script>
        window.fbAsyncInit = function() {
          FB.init({
            appId      : 'YOUR_APP_ID', // App ID
            channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
            status     : true, // check login status
            cookie     : true, // enable cookies to allow the server to access the session
            xfbml      : true  // parse XFBML
          });
          FB.ui({ 
            method: 'feed' 
          });
        };
        // Load the SDK Asynchronously
        (function(d){
           var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
           if (d.getElementById(id)) {return;}
           js = d.createElement('script'); js.id = id; js.async = true;
           js.src = "//connect.facebook.net/en_US/all.js";
           ref.parentNode.insertBefore(js, ref);
         }(document));
      </script>

Wednesday, November 7, 2012

Thursday, October 25, 2012


Php Tutorials Working with Conditions.

    Working with Php is not as difficult as you might think. One way to think of it would be like making making a list of things to do. And with this list you may want to add more list. Now for a start you have two list. But one list you only want to show to you. And the second list you want everyone else to see. This would be called a Condition. A Conditional statement would be needed to only show your list to you, and only show everyone else the second list. This is what we call a Conditional Statement. Let us look at this example.

IF list one = you;
    {then show list 1} ELSE {show list 2} now this being our Condition.

Now lets see how it works with Php. We now have Objects that we need to assign a Variable to so Php knows what they are. Our Object Variables would be "$list_one" "$list_two" "$you" and "$everyone" . Php makes it simple because you can name your Variables what they represent and Php will store these values temporarily or permanently within the program where you may need them.

$you = 'Bob';
$everyone = 'everyone else !';
$list_one = 'This is your list !';
$list_two = 'This is everyone else's list !';  
IF $you == 'Bob';
    {ECHO "$list_one";} ELSE {ECHO "$list_two";}

Now for each Conditional Check we must have a Operator--
this would be our "= (equals to)"  "==(does equal)" and "!= (does not equal)".
In this case You = Bob so it will show only Your List_one.
You can reverse this also to where your Condition checks if you Does Not Equal or != Then show everyone elses list_two first. 

Wednesday, October 10, 2012

Php Request Handlers Ajax

This is similar to how facebook uses ajax. It is the closest i have got.
This is the ajax script. place it in head section or create a js. page for it and include it. index.php.

<html>
<head>
<script language="javascript"  type="text/javascript">
function doHttpRequest() {  // This function does the AJAX request
  http.open("GET", "http://127.0.0.1/ajaxer/formdata.php", true);
  http.onreadystatechange = getHttpRes;
  http.send(null);
}
function doHttpRequest2() {  // This function does the AJAX request
http.open("GET", "http://127.0.0.1/ajaxer/formrequest.php?txt1="+document.getElementById('txt1').value, true);
  http.onreadystatechange = getHttpRes;
  http.send(null);
}
function getHttpRes() {
  if (http.readyState == 4) {
        res = http.responseText;  // These following lines get the response and update the page
        document.getElementById('div1').innerHTML = res;
  }
}
function getXHTTP() {
  var xhttp;
   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
          xhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
          try {
                xhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e2) {
          // This block handles Mozilla/Firefox browsers...
          try {
                xhttp = new XMLHttpRequest();
          } catch (e3) {
                xhttp = false;
          }
          }
        }
  return xhttp; // Return the XMLHTTP object
}
var http = getXHTTP(); // This executes when the page first loads.
</script>
</head>
<body align="center">
<input align="center" type="button" value="Press for AJAX" name="btn" onClick="doHttpRequest();" >
<br><br>
<div align="center" id="div1"> <h3> Dynamic AJAX will be displayed here. </h3>  </div>   <!---this will be the dynamic div that does the majic. //--->
</body>
</html>

This is the form show method Page. formdata.php.



<h3 align="center">Here is an HTML Form, enter data, click submit…</h3>
<Form align="center" name="myform">
          Type text: <input align="center" type="text" size="15" id="txt1" >
  <br><br>
          <input align="center" type="button" value="Press to submit form" onClick="doHttpRequest2();">
</Form>

And this is the either recieve data request page or send data action page without page refresh. formrequest.php.



<HTML>
<body>
<h3 align="center">Here is the Form field text: <?php echo $_GET["txt1"]; ?></h3><br />
<p>Welcome to the most amazing site !</p>
</body>
</HTML>
Facebook uses everything but Php runs all the functions, classes, views, and validation and database scripts. Ajax Push and Pulls most of the Php page request, and handles all their Url Request, and Jquery handles the chat scrollers and C++ is used for parsing xhtml from outside sources, for your video-chat downloaded chat and, and lastly for the apps and game integration and application sharing API'S for all sites outside sourcing. .
You will want to sanitize the Txt1 Data when it gets retrieved by your action page !
Play with this for a while. I have already created a wall posting script identical to facebooks that im using in a business portal using this altered with the same req methods.. Enjoy. 

Thursday, October 4, 2012

Php Functions !

Below is a simple Function set up for Users. You can change this to whatever you like. The idea here is to get used to how they work. And later we will combine them into Classes.



function myFunction()        //WE NAME OUR FUNCTION// CAN BE      " select_user() "  //
{
  global $database_name, $link;     //THESE CAN BE BROUGHT IN BY INCLUDES WITHOUT//
  $retArr = array();

  mysql_select_db($database_name, $link);   //THIS CAN BE BROUGHT IN WITH INCLUDES ALSO/
  $query_queryLookup = "SELECT userId, userName, userFirst, userLast, userPw FROM users WHERE userId = '$id'";                    //AND HERE YOU MAY WANT TO USE $_SESSIONUSERID ETC///
  $queryLookup = mysql_query($query_queryLookup, $link) or die(__FUNCTION__.': '.mysql_error($link));
  $row_queryLookup = mysql_fetch_assoc($queryLookup);
  $totalRows_queryLookup = mysql_num_rows($queryLookup);

  if($totalRows_queryLookup>0)
  {
    do {
      array_push($retArr,$row_queryLookup);
    } while ($row_queryLookup = mysql_fetch_assoc($queryLookup));
  }

  mysql_free_result($queryLookup);

  return $retArr;                                             //OUR RETURNED VARIABLE//

} // end function myFunction()


Thursday, September 27, 2012

Php using page partitions.

When writing scripts in php a good way to handle mapping a site is by establishing Page Partitions. Page parts will allow you to not have to keep re-writing headers, menus, contents, footers and sections repeatedly throughout all your sites pages. And then you can call them in using Php when and where you need them.
 The idea behind this is to have a MVC type plan to not repeat anything over and over again.
    Create your sites first page. Then break it up into sections. Then Place these sections copied into a page named after them like--header.php, content.php, leftmenu.php, rightmenu,php, footer,php. Things that normally will not change. Next we will call them into our programmed pages as we need them using the Includes Function. Below we show you how this is done.

Do code

Do code

?php

incude('header.php');
?

Show html and other code sections etc.


?php

include('leftmenu.php');
?

Show html and other code sections etc.


?php

include('content.php');
?

Show html and other code sections etc.


?php

include('footer');
?

Show etc.




 

Wednesday, September 26, 2012

codesneekers blog: Php Create a Members List Page And Users Page.

codesneekers blog: Php Create a Members List Page And Users Page.: When deciding how to develop Members Areas on your Site. It is always a chore to remember how to pass the users data from Page To Page. The ...

Tuesday, September 25, 2012

Php Create a Members List Page And Users Page.

When deciding how to develop Members Areas on your Site. It is always a chore to remember how to pass the users data from Page To Page. The Script Below will help.

FIRST PAGE --------WE SHOW ALL MEMBERS

<?php

  $res = mysql_query('select id, username, email, mempic, date from users desc');
  if(mysql_num_rows($res)>0)
  {
    $result = mysql_fetch_array($res);
    }
?>
//MAY SHOW CERTAIN HTML PAGE PARTS HERE//
<?php
}
else
{
echo "No users data found";  //PLACE ERROR HERE
}
?>
SHOW OUR DATA----


<ul><h3>Members List</h3></ul>
<ul>
    <li>User/Id</li>
    <li>Image/Path</li>  // OR USERS URL PATH TO IMAGE change img tag path below&page-2 ! //
    <li>User/Name</li>
    <li>Email</li>
    <li>Date/Joined</li>
</ul>
<ul>    // NEXT WE PARSE THE USERS ID VALUE USING THE LINK
    <li><a href="profile.php?id=<?php echo $result['id']; ?>">View User</li>
    <li><?php echo $result['mempic']; ?></li>
    <li><?php echo $result['username']; ?></li>
    <li><?php echo $result['email']; ?></li>
    <li><?php echo $result['date']; ?></li>
</ul>

<p>Scripts By Robin Deatherage  about2mount@gmail.com</p>

SECOND PAGE   SINGLE MEMBERS PAGE

<?php
if(isset($_GET['id']))  //FIRST WE GET THE ID OF USER FROM FIRST PAGE//
{
  $id = intval($_GET['id']);  // WE ASSIGN A VARIABLE//
  $dn = mysql_query('select id, username, email, mempic, date from users where id="'.$id.'"');
  if(mysql_num_rows($dn)>0)
  {
    $dnn = mysql_fetch_array($dn);
    }


//MAY SHOW CERTAIN HTML PAGE PARTS HERE//
<?php
}
else
{
echo "No user data found";  //PLACE ERROR HERE//
}
?>

NOW SHOW THE USERS DATA.
// NEXT WE PARSE THE the single users data
<h3>Profile Page</h3>
<h4>Welcome: <?php echo $dnn['username']; ?>
<p><img src="<?php echo $dnn['mempic']; ?>"></p>


<ul>  
    <li><a href="profile.php?id=<?php echo $dnn['id']; ?>">View User</li>
    <li><?php echo $dnn['username']; ?></li>
    <li><?php echo $dnn['email']; ?></li>
    <li><?php echo $dnn['date']; ?></li>
</ul>

GO DOWN HERE AND IF YOU WANT CREATE A ANOTHER PAGE FOR WHATEVER YOU WANT USING THE SECRETS ABOVE !       ENJOY !

Member Switch Profile Image To Avatar Script.

This conditional "IF" statement can become very usefull for you blog creators out there who want to build on your members resources.
    First we want to check if the member has uploaded a PROFILE-IMAGE and IF they have not, then we will show our own in house AVATAR-IMAGE.


<?php
  if($result['mempic']!=' ')  //THE DATA OF IMAGE PATH STORED IN YOUR DB//
  {
    echo '<img src="'.htmlentities($result['mempic'], ENT_QUOTES, 'UTF-8'),'"alt="Avatar" style="max-width:100px;max-height:100px;" />';
  }
  else
  {                                //ALTERNATE AVATAR-IMAGE PATH HERE//
    echo '<img src="img/avatar.png" alt="Avatar" style="max-width:100px;max-height:100px;" />';
  }
     ?>

 THE     (  !=  ) IS  IF MEMPIC  (does-not-  "!"  equal  "="   'emty'     "  '  '  "
       {
     SHOW THE MEMBERS PIC.
       }
     ELSE
       {
     SHOW AVATAR AS REPLACEMENT.
       }
?>
CONTINUE WITH SCRIPTS---->

Monday, September 3, 2012

Php Tutorial

We have the power to learn. Yes learning to program using php is really not as hard as people think. The only hard thing about it is remembering where you place everything. Php and Html work very good together. Especially if you use PageParts. PageParts are partial page pieces that you can add into certain pages as needed or use on every page. A good page part would be the Head section of your site. Along with the horizontal page menu. So by using the INCLUDES function, we can do wonders with PageParts. Now to help us out mentally we call these PageParts MODULES. Easy to remember and now you understand the basic concept of Modules and php. You may have several modules to create. Examples would be Header's, Menu's, Content's, Script's, Views, Functions, Configs, Footers, and Images. Now we know that Modules can be everything broken down into Views, Scripts, and Configs. A Config File is a page you would want to declare certain Variables that allows you to change things like page-names or Url Paths and Links without having to change these on every single page. Example of these might be     $url_home="index.php"; which allows you to change the index.php to another page named home.php without having to enter it into all your sites pages because on all the pages the link is shown as <a href="<?php $url_home; ?>">Home</a>  Here it calls the data from your config file and automatically tells the link to go to the Value of $url_home,,,which equals index.php and can be any page you choose. like change it in the config.php file and it will change that page on all your sites pages. Another good use would be assigning your database config. $db_name="database-name, $db_user="database-user-name", $db_password="password here". Place Admin and Editor Variables as well here to,     $admin="your private admin login name here";     and $editor="editors name here";    Now you have a config.php file that you can add alot of things to later.

Amelia's Floating Plane !

Amelia ! The search continues ! It is always something to think about. The thing that is fact with Amelia and Fred's disappearance is the fact that Her plane was buoyant to the tune of 1500 pounds. Which meant her plane would have stayed afloat. And would have floated anywhere. With 1500 pounds of buoyancy the plane would have probably been half submerged or more with only the tail and part of the roof showing, but with a silver finish would have been impossible to see from overhead search planes. In them days in 1930's through the 40's. Safety colored vest and brightley colored rafts did not exist. Sad to think about but one can imagine several planes flying right over Them but never being seen. The only chance they had of being found would have been a flare fired at night. But if out of distance to-shay. Truth is Her Plane could have drifted for thousands of miles before sinking and sank in a spot that may never be found. Not to mention the fact that most of the Pacific is over 17,000 feet deep which is over three miles deep. One mile deeper than the Titanic. Maybe someday a sonar somewhere out there will kick back The Lost Electra and the Amelia Mystery can be solved.