Lissa Explains it All:  Web Design Forums  

Go Back   Lissa Explains it All: Web Design Forums > LEIA Archives > Web Site Help > Advanced Programming

Notices

 
 
Thread Tools Display Modes
  #1  
Old 12-24-2004, 05:29 PM
insanetaffy insanetaffy is offline
n00bzilla
 
Join Date: Dec 2004
Posts: 5
insanetaffy is an unknown quantity at this point
Plugboard not showing new plugs...

I followed the tutorials on the download site, and I changed it to allow more plugs, but nother shows up, and it just redirects to the index page, and nothing happens.

Code:
<?
//#########################
//SETTINGS
//#########################
$font = "verdana";         //Font used to display plugs.
$fontsize = "1";           //Font size used to display plugs.
$fontcolor = "000000";     //Font color used to display plugs.
$bgcolor = "ffffff";       //Background color.
$bordercolor = "4F001E";   //Bordercolor of the input boxes and button.
$tablewidth = "378";       //Width of the plugboard's table.
$maxdata = "29";           //Maximum plugs to show on the list at one time -1 (If you want it to display 5 buttons but 4 here).
$maxchars = "300";          //Maximum number of characters a person is allowed to use for their button url.
$blocked = Array('http://domain.com','http://www.domain.com'); // These URLS are not allowed.
//##############################################################################
//SETTINGS END. DO NOT EDIT BELOW THIS LINE UNLESS YOU HAVE PHP SKILLS!
//##############################################################################
if($action == "plug")
 {
//SAVE PLUG
  if ($url == "" || $url == "http://" || $sitename == "sitename" || $sitename == ""){die("<font face=$font><center>Error: one of the fields you submitted are invalid, please hit your back button and try again</center>");}
if(in_array($url, $blocked)) 
{die("<font face=$font><center>Domain not allowed.</center>");}
  $savefile = "plug.db.php";
  if (!file_exists($savefile))
   {
    $newfile = fopen($savefile,"w+");
    fclose($newfile);
   }
  $ip = gethostbyname($REMOTE_ADDR);
  $url = ereg_replace('<([^>]|\n)*>', '', $url);
  $sitename = ereg_replace('<([^>]|\n)*>', '...', $sitename);
  $lines = file("$savefile");
  $add = "<?die ('Access unempowered')?>|$url|$sitename|$ip|";
  $openfile = fopen("$savefile","w");
  fwrite($openfile, "$add\n");
   for ($i = 0; $i < $maxdata; $i++)
    {
     @fwrite($openfile, "$lines[$i]");
    }
  fclose($openfile);
  echo "<script language=\"JavaScript\">window.location='index.php'</script>";
 }
  else
 {
//SHOW PLUGS
echo 
<<<HTML
<table width=$tablewidth cellspacing=0 cellpadding=0 style="border: none #$bordercolor; background-color: #$bgcolor;" >
<td align="center">
HTML;
  $openfile = file("plug/plug.db.php");			
  $total = count($openfile);
  for ($i=0; $i<$total; $i++):
  list($UNEMPOWERED,$url,$sitename,$ip) = explode('|',chop($openfile[$i]));
  $url = str_replace("http://","",$url);
  $sitename = str_replace("=","",$sitename);
  echo "<a href=http://$url target=_new title=$url><img src=$sitename border=0 width=88 height=31></a>\n";
  endfor; 
echo <<<HTML
<form method='post' action='plug.php?action=plug' name='plug'><input maxlength='$maxchars' value='Button' type='text' name='sitename' size='20' style='font-family: $font; color: #$fontcolor; font-size: 7pt; background-color: #eeeeee; font-weight: none; border: 1px solid #$bordercolor'>
<input value='http://' type='text' name='url' size='20' style='font-family: $font; color: #$fontcolor; font-size: 7pt; background-color: #eeeeee; font-weight: none; border: 1px solid #$bordercolor'>
<input type='submit' size='30' value='plug' style='background-color: #eeeeee; font-family: $font; color: #$fontcolor; font-size: 7pt; border: 1px solid #$bordercolor'></form></td><tr></tr>
<td align="center" style="border-top: 1px solid #$bordercolor"></td></table>
HTML;
 }
?>
  #2  
Old 12-24-2004, 06:45 PM
Chris's Avatar
Chris Chris is offline
The one.
 
Join Date: Mar 2003
Location: Scotland, UK
Posts: 4,451
Chris is a jewel in the roughChris is a jewel in the roughChris is a jewel in the rough
Have you set the file permissions correctly for the files?

If you have, then this is the code I am using for my working plugboard. I changed the parts at the top to suit you:

PHP Code:
<?
//#########################  
//SETTINGS
//#########################  
$font "verdana";         //Font used to display plugs.
$fontsize "1";           //Font size used to display plugs.
$fontcolor "000000";     //Font color used to display plugs.
$bgcolor "ffffff";       //Background color.
$bordercolor "4F001E";   //Bordercolor of the input boxes and button.
$tablewidth "378";       //Width of the plugboard's table.
$maxdata "29";           //Maximum plugs to show on the list at one time -1 (If you want it to display 5 buttons but 4 here).
$maxchars "300";          //Maximum number of characters a person is allowed to use for their button url.
$blocked = Array('http://domain.com','http://www.domain.com'); // These URLS are not allowed.
//#########################  #########################  #########################  ###
//SETTINGS END. DO NOT EDIT BELOW THIS LINE UNLESS YOU HAVE PHP SKILLS!
//#########################  #########################  #########################  ###
if($action == "plug")
 {
//SAVE PLUG
  
if ($url == "" || $url == "http://" || $sitename == "sitename" || $sitename == ""){die("<font face=$font><center>Error: one of the fields you submitted are invalid, please hit your back button and try again</center>");}
if(
in_array($url$blocked)) 
{die(
"<font face=$font><center>Domain not allowed.</center>");}
  
$savefile "plug.db.php";
  if (!
file_exists($savefile))
   {
    
$newfile fopen($savefile,"w+");
    
fclose($newfile);
   }
  
$ip gethostbyname($REMOTE_ADDR);
  
$url ereg_replace('<([^>]|\n)*>'''$url);
  
$sitename ereg_replace('<([^>]|\n)*>''...'$sitename);
  
$lines file("$savefile");
  
$add "<?die ('Access unempowered')?>|$url|$sitename|$ip|";
  
$openfile fopen("$savefile","w");
  
fwrite($openfile"$add\n");
   for (
$i 0$i $maxdata$i++)
    {
     @
fwrite($openfile"$lines[$i]");
    }
  
fclose($openfile);
  echo 
"<script language=\"JavaScript\">window.location='index.php'</script>";
 }
  else
 {
//SHOW PLUGS
echo 
<<<HTML
<table width=$tablewidth cellspacing=0 cellpadding=0 style="border: none #$bordercolor; background-color: #$bgcolor;" >
<td>
HTML;
  
$openfile file("plug.db.php");            
  
$total count($openfile);
  for (
$i=0$i<$total$i++):
  list(
$UNEMPOWERED,$url,$sitename,$ip) = explode('|',chop($openfile[$i]));
  
$url str_replace("http://","",$url);
  
$sitename str_replace("=","",$sitename);
  echo 
"<a href=http://$url target=_new title=$url><img src=$sitename border=0 width=88 height=31></a>\n";
  endfor; 
echo <<<HTML
<form method='post' action='plug.php?action=plug' name='plug'>
<input maxlength='$maxchars' value='Button' type='text' name='sitename' size="30" style='font-family: $font; color: #$fontcolor; font-size: 7pt; background-color: #EB0056; font-weight: none; border: 1px solid #$bordercolor' margin-top:0;>
<input value='http://' type='text' name='url' size="30" style='font-family: $font; color: #$fontcolor; font-size: 7pt; background-color: #EB0056; font-weight: none; border: 1px solid #$bordercolor'>
<input type='submit' size='15' value='plug' style='background-color: #EB0056; font-family: $font; color: #$fontcolor; font-size: 7pt; border: 1px solid #$bordercolor; margin-top: 1px;'></form></td><tr></tr>
</td></table>
HTML;
 }
?>
Thanks,
Chris
__________________
by Christopher
  #3  
Old 12-24-2004, 07:46 PM
insanetaffy insanetaffy is offline
n00bzilla
 
Join Date: Dec 2004
Posts: 5
insanetaffy is an unknown quantity at this point
Well, I am pretty sure I did(set plug.db to 666, right?)

I'll try that code out.
  #4  
Old 12-28-2004, 07:12 AM
insanetaffy insanetaffy is offline
n00bzilla
 
Join Date: Dec 2004
Posts: 5
insanetaffy is an unknown quantity at this point
Quote:
Originally Posted by insanetaffy
Well, I am pretty sure I did(set plug.db to 666, right?)

I'll try that code out.

Ok, I tried that code...and it made my site have this error.

Parse error: parse error, unexpected T_STRING in /home/hinotama/public_html/rose/plug/plug.php on line 29

I checked on line 29 and that is

$ip = gethostbyname($REMOTE_ADD R);

And I am pretty sure thats nothing I did...
  #5  
Old 12-28-2004, 11:17 AM
Chris's Avatar
Chris Chris is offline
The one.
 
Join Date: Mar 2003
Location: Scotland, UK
Posts: 4,451
Chris is a jewel in the roughChris is a jewel in the roughChris is a jewel in the rough
I don't see how that is possible, seeing as there is no "T_STRING" in the code...

Starlet will be the best person to help you with this, so trying PMing her.

Sorry I couldn't help
Thanks,
Chris
__________________
by Christopher
  #6  
Old 12-29-2004, 10:45 PM
insanetaffy insanetaffy is offline
n00bzilla
 
Join Date: Dec 2004
Posts: 5
insanetaffy is an unknown quantity at this point
Quote:
Originally Posted by chrisdb89
I don't see how that is possible, seeing as there is no "T_STRING" in the code...

Starlet will be the best person to help you with this, so trying PMing her.

Sorry I couldn't help
Thanks,
Chris

Alright, thank you for trying though!
  #7  
Old 12-30-2004, 12:17 PM
Chris's Avatar
Chris Chris is offline
The one.
 
Join Date: Mar 2003
Location: Scotland, UK
Posts: 4,451
Chris is a jewel in the roughChris is a jewel in the roughChris is a jewel in the rough
Your welcome

Thanks,
Chris
__________________
by Christopher
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:07 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.