image counter
Moderator: General Moderators
image counter
I have created an image counter in php extension page I will like to give this counter to friends who would like to copy and paste the counter into their html extension pages. I have tried using javascript to search for my php file but on their pages nothing prints out.
image counter
I really need help and I am asking a question
feyd | Please use
This one of my friends html extension pages
What I want is one the friend view his page in a browser he would see my counter on his page.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is my php filesCode: Select all
<?php // db.php
//session_start();
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'admin';
function dbConnect($db='') {
global $dbhost, $dbuser, $dbpass;
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die('The site database appears to be down.');
if ($db!='' and !@mysql_select_db($db))
die('The site database is unavailable.');
return $dbcnx;
}
?>
<?php
include 'db.php';
?>
<?php
dbConnect('mydatabase');
$name = "$SCRIPT_NAME";
$result = MYSQL_QUERY("SELECT * FROM counter WHERE (name = '$name')") or die
("Bad query: ".mysql_error());
$row = mysql_fetch_array($result);
if($row){
MYSQL_QUERY("UPDATE counter SET count = count+1 WHERE (name = '$name')") or die
("Bad query: ".mysql_error());
$count = $row['count'];
}else{
MYSQL_QUERY("INSERT INTO counter VALUES ('', '$name', '2')") or die("Bad
query: ".mysql_error());
$count = '1';
}
//echo $count;
$path = 'C:/wamp/images/';
$url = '/images/';
$ending = '.gif';
$style = 'SBGS';
$default_style = 'black';
$style = ($style)?$style:$default_style;
$size = GetImageSize($path. '1'.$style.$ending);
for ($i = 0; $i < strlen($count); $i++) {
echo "<img src="$url$count[$i]$style$ending" $size[3]>";
}
?>This one of my friends html extension pages
Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.mydash1 {
border-bottom-width: thin;
border-bottom-style: dashed;
border-bottom-color: #CCCCCC;
}
.mydash2 {
border-right-width: thin;
border-right-style: dashed;
border-right-color: #CCCCCC;
position: static;
}
-->
</style>
<style type="text/css">
<!--
.myTable {
font-family: "Trebuchet MS", "Times New Roman";
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: lighter;
font-variant: normal;
text-transform: capitalize;
text-align: justify;
text-indent: 10px;
display: block;
position: static;
height: auto;
width: auto;
left: auto;
top: auto;
text-decoration: none;
}
.mylink {
text-decoration: none;
}
.myTop1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: xx-large;
font-style: normal;
line-height: normal;
font-weight: bolder;
font-variant: normal;
text-transform: none;
color: #99CCFF;
border-bottom-width: thin;
border-bottom-style: none;
border-bottom-color: #CCCCCC;
}
-->
</style>
<style type="text/css">
<!--
.myMid1 {
font-family: "Trebuchet MS", "Times New Roman";
font-size: 12px;
text-align: left;
text-indent: 5pt;
vertical-align: text-top;
display: inline;
color: #999999;
}
-->
</style>
</head>
<body>
<table width="770" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr align="center" valign="middle">
<td class="myTop1" height="54" colspan="2">All Medical Supply</td>
</tr>
<tr>
<td height="13" colspan="2" valign="top" class="mydash1"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td class="mydash2" width="163" height="466" valign="middle"> <table class="myTable" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="myTable"><a class="mylink" href="index.html" target="_parent">Home</a></td>
</tr>
<tr>
<td class="myTable"> </td>
</tr>
<tr>
<td class="myTable"><a class="mylink" href="count3.php" target="_parent">Install</a></td>
</tr>
<tr>
<td class="myTable"> </td>
</tr>
<tr>
<td class="myTable"><a class="myTable" href="contact%20us.php" target="_parent">Contact
us</a></td>
</tr>
<tr>
<td class="myTable"> </td>
</tr>
</table></td>
<td width="607" valign="middle" >
</tr>
</table>
<script type="text/javascript" src="myCount.php"></script>
</div>
</body>
</html>[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Have your script output only the counter image, with correct header info.Nanaosei wrote:How would you suggust I do this with changing my friend page extension to php.
Then your friend could insert the counter with a simple image tag.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
The image tag I am echoing I save in a variable and echo a javascript of this variable like this: but it does not
work on the inex.html page.
Code: Select all
echo "document.write($myDisplay)";work on the inex.html page.