Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-21-2003, 03:50 AM   PM User | #1
Golden_Eagle
Regular Coder

 
Join Date: Jul 2002
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Golden_Eagle is an unknown quantity at this point
Voting Gateway removal?

Hi. I hope this is the right place?

I am trying to make my toplist automatically add votes to the list as soon as the link is clicked.

Maybe forwarding or something.

However, some of the coding is in PHP. (I have tried the PHP forum, but was told it was the wrong place!)

The form just includes an input button.

Does anyone know how I can change this button's code directly to a meta tag forwarding link?

Code:
<form action="in.php" method="post">
<INPUT TYPE="SUBMIT" class="button" value="'.$_VoteFor_.$web->web.'"> 
</table></form>
I was thinking along the lines of -
It did'nt work though!

Please help.

Last edited by Golden_Eagle; 04-21-2003 at 03:53 AM..
Golden_Eagle is offline   Reply With Quote
Old 04-21-2003, 08:25 AM   PM User | #2
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
Well, whoever told you that was wrong. Anyway, my php is rusty...but I think you make it the name of the input:

<input type="submit" name="'.$_VoteFor_.$web->web.'" value="Vote!" class="button">

See if that works...If it doesn't, go back to the php forum and ask again.
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">

Last edited by zoobie; 04-21-2003 at 08:31 AM..
zoobie is offline   Reply With Quote
Old 04-21-2003, 09:23 AM   PM User | #3
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
If I understand correctly, that wont work...

<input type="submit" name="<?php echo $_VoteFor_.$web->web; ?>" value="Vote!" class="button">

Edit:
I just thought, If you were going to print it to the page:

echo '<input type="submit" name="'.$_VoteFor_.$web->web.'" value="Vote!" class="button">';

then that would be correct.
missing-score is offline   Reply With Quote
Old 04-21-2003, 09:38 AM   PM User | #4
Mhtml
Senior Coder

 
Mhtml's Avatar
 
Join Date: Jun 2002
Location: Sydney, Australia
Posts: 3,531
Thanks: 0
Thanked 1 Time in 1 Post
Mhtml is an unknown quantity at this point
well the problem is that the script is most likely waiting for a post so you can't do a get ...

You can do <a href="somewhere.com" onClick="form.submit()"> though so it's no problem.
__________________
Omnis mico antequam dominus Spookster!
Mhtml is offline   Reply With Quote
Old 04-22-2003, 11:28 AM   PM User | #5
Golden_Eagle
Regular Coder

 
Join Date: Jul 2002
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Golden_Eagle is an unknown quantity at this point
It seems like I may have mislead you all here!

I know that I could add a button to the page. (Which I have already got!)

This is a current voting page for the site -

http://www.font-factory.com/toplist/...050010645.4508

As you can see. The button is already there, built by PHP. I know (I think) how I can change what the PHP builds on the page.

So what I'm looking for is a way that, maybe as soon as the page with the information the button sends, can be automatically sent once the page loads.

Hence killing the need to click the button.

My toplist only updates hits that are sent through this button. I want to change it so that the hit is counted when the page loads.

Can this be done? If so, how?
Golden_Eagle is offline   Reply With Quote
Old 04-22-2003, 12:51 PM   PM User | #6
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Javascript:

document.formname.submit();

Isnt that all you need? then window.location ?

Last edited by missing-score; 04-22-2003 at 01:00 PM..
missing-score is offline   Reply With Quote
Old 04-22-2003, 01:28 PM   PM User | #7
Golden_Eagle
Regular Coder

 
Join Date: Jul 2002
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Golden_Eagle is an unknown quantity at this point
It looks like we may be getting towards it with that.

I'll post all the scripts and try to detail what I'm trying to do here.

First of all the toplist is written all in PHP and does not require MySQL. All details are stored into DAT files.

This is the file created for one of the members.

Code:
<?php
if(stristr($PHP_SELF,'1050010645.4508.php')) {
	die("<script>window.location.href=\"../in.php?ID=1050010645.4508\";</script>");
}
$this->pass='******';
$this->email='your@email.com';
$this->web='Abstract Fonts';
$this->webURL='http://www.abstractfonts.com/fonts/';
$this->bannerURL[0]='http://www.font-factory.com/images/AFIL/11.gif';
$this->descripcion='The Biggest In The WORLD!!! CATEGORIES: Archive,18+,3D,Bloody,Cartoon,Decorative,Dingbats,Distorted, Famous,Futuristic,Graffiti,Handwriting, Holidays,LED,Old English + 10 more';
$this->pais='ca';
?>
This file is loaded at
http://www.font-factory.com/toplist/...050010645.4508

It then loads this page -
Code:
<?php
//
//  in.php
//  rev005
//
include('data/inc_config.php');
include('code/inc_funciones.php');
include('lang/'.$gIdioma.'.php');
include('code/class_db_'.$gTipoDB.'.php');
include('code/class_topo.php');
include('code/class_misc.php');
$tiempo_usado=ej3Time();

if(!isset($ID)) {
	if(isset($id)) $ID=$id;
	if(isset($Id)) $ID=$Id;
}

$cookies=new Cookies;
$web=new SitioWebAvanzado($ID);
$index=new Index;

if(!$index->Existe($ID)) {
	echo '<script>window.location.href="index.php";</script>';
	exit();
}


$irIndex=0;
if($HTTP_REFERER==$gTopURL.'in.php?ID='.$ID) $irIndex=1;
//$path=explode('in.php','http://'.$SERVER_NAME.$REQUEST_URI);
//$topURL2=$path[0];
//if($HTTP_REFERER==$topURL2.'in.php?ID='.$ID) $goindex=1;
//if($HTTP_REFERER==$topURL2.'in.php?site='.$ID) $goindex=1;

$ilegal1=$ilegal2=0;
if($gAntitrampaCookies) {
	if($tiempo=$cookies->webUltIN($ID)) {
		if($tiempo > abs(time()-$gTiempoVoto)) $ilegal1=1;
	}
}
if($gAntitrampaIPs) {
	if($tiempo=$web->ipsExiste(capturarIP())) {
		if($tiempo > abs(time()-$gTiempoVoto)) $ilegal2=1;
	}
}

if($irIndex) { //Llamada desde el propio script
    if($ilegal1==0 AND $ilegal2==0) {
		$web->IN(capturarIP(),time()-$gTiempoVoto);
		$cookies->webActualizar($ID,'IN');
	}
    $HTML.='<table align="center" border="0" class="0" cellspacing="1" cellpadding="5">';
    $HTML.='<tr><td colspan="0" align="center" class="title">'.$gTopNombre.'</td></tr>';
    $HTML.='<tr class="1"><td align="center" valign="middle" class="text">'.$_VoteCount_.'</td></tr>';
    $HTML.='<tr class="2"><td align="center" valign="middle" class="minititle">'.$_Entering_.'</td></tr>';
    $HTML.='</table>';
	//Mostramos todas o sólo una categoria.
	if($gTipoTop) {
		$HTML.='<script>window.location.href="index.php?c='.$index->Leer($ID,1).'";</script>';
	} else {
		$HTML.='<script>window.location.href="index.php";</script>';
	}
} else {    //Llamada desde un servidor externo
    if($ilegal1 OR $ilegal2) {
        //Voto NO válido
        $HTML.='<table align="center" border="0" class="0" cellspacing="1" cellpadding="5">';
        $HTML.='<tr><td colspan="2" align="center" class="title">'.$gTopNombre.'</td></tr>';
        $HTML.='<tr class="0"><td align="center" valign="middle" class="minititle">'.$_InvalidVote_.'</td></tr>';
        $HTML.='<tr class="1"><td align="center" valign="middle" class="text"><br><a href="'.$web->webURL.'" target="_blank">'.$web->web.'</a><br><div id="cont"> </div><br></td></tr>';
        $HTML.='<tr class="2"><td align="center" valign="middle" class="text"><a href="index.php">'.$_WithoutVote_.'</a></td></tr>';
        $HTML.='</table>';
        $HTML.='<script>reloj=new Reloj('.abs($tiempo-time()+$gTiempoVoto).',\'cont\',\''.$_WhenVote_.'\',1); setInterval(\'reloj.Atras()\',1000);</script>';
    } else {
        //Vote Valid
        $HTML.='<form action="in.php" method="post">';
        $HTML.='<table align="center" border="0" class="0" cellspacing="1" cellpadding="5">';
        $HTML.='<INPUT TYPE="SUBMIT" class="button" value="'.$web->web.'"><br>&nbsp;</td></tr>';
        $HTML.='<INPUT TYPE="HIDDEN" name="ID" value="'.$ID.'">';
        $HTML.='</table></form>';
    }
}

include('code/inc_header.php');
echo $HTML;
The piece of code I have been cocerntrating on is near the end -
Code:
//Vote Valid
        $HTML.='<form action="in.php" method="post">';
        $HTML.='<table align="center" border="0" class="0" cellspacing="1" cellpadding="5">';
        $HTML.='<INPUT TYPE="SUBMIT" class="button" value="'.$web->web.'"><br>&nbsp;</td></tr>';
        $HTML.='<INPUT TYPE="HIDDEN" name="ID" value="'.$ID.'">';
        $HTML.='</table></form>';
    }
}
This is the part that contains the voting button with the hidden ID field.
In order for the button to be automatically clicked - which part would I need to change to enable the it to do it automatically?

I gather Javascript is the way to go with this.
The form currently does not have a form name, but I guess that could be changed.

Can the document.formname.submit() command be run automatically from with the script?

If so, what do I need to change?

BTW I love this site!
Without it - Webmasters are nothing!

Kindest regards
Golden Eagle
Font-Factory.com


?>
Golden_Eagle is offline   Reply With Quote
Old 04-22-2003, 01:44 PM   PM User | #8
Golden_Eagle
Regular Coder

 
Join Date: Jul 2002
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Golden_Eagle is an unknown quantity at this point
Solved it!

Mind you lots of redirecting involved! LOL

http://www.font-factory.com/toplist/...10645.4508.php

Thanks 4 All your help!

Long Live CF!
Nice one Missing-Score.
Golden_Eagle is offline   Reply With Quote
Old 04-22-2003, 01:45 PM   PM User | #9
missing-score
Senior Coder


 
missing-score's Avatar
 
Join Date: Jan 2003
Location: UK
Posts: 2,194
Thanks: 0
Thanked 0 Times in 0 Posts
missing-score is on a distinguished road
Just add:

<script type="text/javascript">
<!--
document.formname.submit();
//-->
</script>

After the form.
missing-score is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:54 PM.


Advertisement
Log in to turn off these ads.