Contact Us 2.0. with HTML Page and Pop Up Frame

Featured

This is the same Contact Us 2.0. that is in this forum, But I have added more options to this script and a html page with a very nice pop Up frame that DONT get block by any pop Up software.
Many websites use this type of script to bypass the blocking…

New Options added to the original Contact Us 2.0.

- HTML contact page
- Button to click and open the Contact Us 2.0. form
- Gray Box Frame pop Up
- Address Input to the original Script
- Phone Number Input on original Script

Download

Discussion

Block Visitors From Specific IP Address

Learn How To Restrict Users From Different IP Addresses.

.htaccess

order allow,deny
deny from 69.64.240.42
deny from 70.89.104.61
deny from 46.17.100.138
deny from 67.228.55.48
deny from 176.14.135.159
allow from all

php

<?php
$ip=$_SERVER['REMOTE_ADDR'];
if($ip == '66.230.230.230'){
die();
}
if($ip == '87.118.104.203'){
die();
}
if($ip == '74.208.243.167'){
die();
}
?>

PHP Enter Timeline Module

PHP Enter Timeline Module

Download: PHP Enter Timeline Module (1189)

Licence: GNU GPL

Installation:

1.Point your browser to admin/install_timeline.php.

2.Open link.php and insert immediately after Code:

<input type="submit" style="color:#ffffff;border:1px solid #ffffff;background:#A5C6EC" value="<?php echo
    $lang['LINKSUB']; ?>" name="query" class="incbtn" />
</form>
<?php
}
?>
</div>

Insert Code:

<br />
<div style="width:463px;padding:8px;border:1px solid #dddddd";>
<div id="blockhead">Bookmarklets</div>
Bookmarklets (Buttons) are links you add to your browser's Bookmarks Toolbar.<br />
To install the bookmarklet in your browser just drag and drop the link below to your bookmarks.<br />
<a href="javascript:(function(){f='http://<?php echo $path ?>/bookmark.php?urld='+encodeURIComponent(window.location.href.replace(/http?:\/\//i, '').replace(/https?:\/\//i, ''))+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','enter','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()">Save on <?php echo $title ?></a>
</div>
</div>

3.Open maindir.php, subdir.php and insert immediately after Code:

<li><a href="toprated.php">{#rated#}</a></li>

Insert Code:

<li><a href="timeline.php">Public Timeline</a></li>

Support Forum

Screenshot:

Fwrite with file-get-contents

file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.

Example:

<?php
$fileToWrite = 'newtextfile.txt';
$fileGet = file_get_contents ('text.txt');
$a = fopen($fileToWrite, 'w');
fwrite($a,$fileGet);
fclose($a);
?>

Inserting form data in MySql table

MySql Insert

Inserting form data in MySql table – tutorial

<?php
include ('db_connect.php');
if(isset($_POST['submit']))  
{  
$data1 = $_POST['data1'];  
$data2 = $_POST['data2'];
if (get_magic_quotes_gpc()) {
$data1 = stripslashes($data1);
$data2 = stripslashes($data2);
}
$data1 = mysql_real_escape_string($data1);
$data2 = mysql_real_escape_string($data2);
//This function is used to create a legal SQL string that you can use in an SQL statement. The given string is //encoded to an escaped SQL string, taking into account the current character set of the connection.
$result = mysql_query("INSERT INTO data (data1,data2)
VALUES ('$data1','data2')"
)
or die(mysql_error());  
echo $data1 . ' - ' . $data2 . ' Ok';  
}else{  
?>  
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">  
<input type="text" name="data1">  
<input type="text" name="data2">  
<input type="submit" name="submit" value="Submit">  
</form>  
<?php } ?>

Smarty Paginate – Smarty Pagination with PHP

Smarty Paginate Example, Smarty Pagination with PHP

SmartyPaginate: a class/plugin for data set pagination within the Smarty
template environment.

Download

search.php

function get_db_results()
  {
      $id = $_GET['id'];
      if (preg_match('#[^A-Za-z0-9]#', $id)) {
          echo "<center><font style=\"font-family:tahoma;\">...should be between 4 and 40 letters and numbers only. <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
          die();
      }
      if (strlen($id) < 4) {
          echo "<center><font style=\"font-family:tahoma;\">Field must be at least 4 characters long:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>"
;
          die();
      }
      if (strlen($id) > 40) {
          echo "<center><font style=\"font-family:tahoma;\">Field Max Characters: 40
<a href=\"javascript:history.go(-1)\">Go Back</a></center>"
;
          die();
      }
      $_query = sprintf("SELECT SQL_CALC_FOUND_ROWS * FROM links WHERE linkname LIKE '%%$id%%' LIMIT %d,%d", SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
      $_result = mysql_query($_query);
      while ($_row = mysql_fetch_array($_result, MYSQL_ASSOC)) {
          $_data[] = $_row;
      }
      $_query = "SELECT FOUND_ROWS() as total";
      $_result = mysql_query($_query);
      $_row = mysql_fetch_array($_result, MYSQL_ASSOC);
      SmartyPaginate::setTotal($_row['total']);
      mysql_free_result($_result);
      return @$_data;
  }

require ('libs/SmartyPaginate.class.php');
SmartyPaginate::connect();
SmartyPaginate::setLimit(10);
SmartyPaginate::setUrl('search.php');

$smarty->assign('results', get_db_results());
SmartyPaginate::assign($smarty);
$smarty->display('search.php');

search.php(template file)

 {section name="results" loop=$results}
 {$results[results].linkname}<br />
 {/section}

  Links {$paginate.first}-{$paginate.last} of {$paginate.total}.
  {paginate_prev} {paginate_next}

Prevent the error loading XML – libxml_use_internal_errors

Prevent the error loading XML – Example
libxml_use_internal_errors() allows you to disable standard libxml errors and enable user error handling.

libxml_use_internal_errors(true);
//allows you to disable standard libxml errors and enable user error handling
$load = simplexml_load_string($res);
if (!$load) {
    echo "Failed loading document";
    foreach(libxml_get_errors() as $error) {
        echo "<pre>" . $error->message . "</pre>";
    }

}else{
$load = new SimpleXmlElement($res);
}

PHP Enter – CMS for News Publishing or Citizen Journalism

PHP Enter

PHP Enter is An online news publishing system that features easy installation, user submission, and an admin panel for adding, editing, and removing categories and news. PHP Enter also can be use for citizen journalism.

Licence: GNU General Public License.
Requirements – PHP, MySQL, GD Library
Features: Search engine friendly urls (mod_rewrite is required), Smarty Template System

Demo

Download

Smarty MySQL Query

Smarty MySQL Query Example

index.php

$tmp = mysql_query("SELECT * FROM base ORDER BY id desc");
while ($row = mysql_fetch_assoc($tmp)) {
      $ccval[] = $row;
  }
$smarty->assign('categories', $ccval);
$smarty->display('index.tpl');

index.tpl

{section name=categories loop=$categories}
<a href="categories.php?id={$categories[categories].id}">{$categories[categories].name}</a>
{/if}

How to check if radio button is selected using PHP

Example

<?php
if(isset($_POST['query']))
{
$radioButton = $_POST['radioButton'];
if (strlen($radioButton) == 0) {
echo "<center>False - <a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}else{
echo "<center>True - <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
}  
}else{
?>
<form method="post" action="index.php">
<input type="radio" name="radioButton" value="1">1
<input type="radio" name="radioButton" value="2">2
<input type="submit" name="query" value="submit">
</form>
<?php
}
?>

Shoutbox for phpBB3

1. Unzip
2. Upload shoutbox folder

http://yoursite.com/shoutbox/

3. Upload file shout.php

http://yoursite.com/shout.php

4. Follow the instructions

http://yoursite.com/shoutbox/menage/install.php

5. PHP Code to display shoutbox (index_body.html):

<iframe style="border:2px solid #0076B1;;" src="../../../../shoutbox/code.php" width="230" height="502"></iframe>

Download
Licence: GNU

Switch Statement

The switch statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for.

<?php
$random = rand (0,3) ;
switch ($random)
{
case 0:
echo 'random case 0';
break;
case 1:
echo 'random case 1';
break;
case 2:
echo 'random case 2';
break;
case 3:
echo 'random case 3';
break;
}
?>