Jump to content
php.lv forumi

Vote script


Snaip3Rs

Recommended Posts

Es zinu ka vote skripts nav nemaz tik viegls, bet vai jūs varētu lūdzu man palīdzēt un parādīt kā jaliek kautkāds balsošanas skripts piemēram vote poga un katrs nospiežot nobalso par savu iemīļoto dziesmu un saglabājās ar IP lai nākošs reiz nevarētu balsot un cik nobalsojuši tur skaits rādās piemēram 34 citai tur 4 vēl citai 153. Lūdzu izpalīdziet.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>    
<title>Dziesmu Tops</title>
</head>
<body>

<table border=1>
 <tr>
  <th>Nr</th>
  <th>Albums</th>
  <th>Izpilditajs</th>
  <th>Dziesma</th>
 </tr>

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }

mysql_select_db("top", $con);
//Izveido query
$query = mysql_query("select * from top");

//dabu visus datus no db 
while ($row = mysql_fetch_array($query)){

$id = $row['id'];
$albums = $row['albums'];
$izpilditajs = $row['izpilditajs'];
$dziesma = $row['dziesma'];

?>

 <tr>
  <th><?php echo $id;?></th>
  <th><?php echo $albums;?></th>
  <th><?php echo $izpilditajs;?></th>
  <th><?php echo $dziesma;?></th>
 </tr>

<?php } //If beigu zime ?>
<FORM>
<INPUT TYPE="BUTTON" VALUE="Pievienot dziesmu" ONCLICK="window.location.href='http://localhost/Top/pievienot.php'">
</FORM>
</table>
</body>
</html>

Link to comment
Share on other sites

Kas par modi konektēties datubāzei katru reizi pa jaunam :@

 

Nav vieglāk configā piekonektēties un par to vairs nesatraukties??

Edited by emsy
Link to comment
Share on other sites

yo, wtf?

using a MAC address will be impossible unless you're on a LAN. Even on a LAN, you couldn't do this from php without jumping through hoops.

drīzak

If you are not on a LAN you may not be able to get the MAC since MACs are not part of the TCP/IP.

Čakars daudzreiz lielāks

EDIT, EDIT, EDIT:

function returnMacAddress() {
// This code is under the GNU Public Licence
// Written by michael_stankiewicz {don't spam} at yahoo {no spam} dot com
// Tested only on linux, please report bugs

// WARNING: the commands 'which' and 'arp' should be executable
// by the apache user; on most linux boxes the default configuration
// should work fine

// Get the arp executable path
$location = `which arp`;
// Execute the arp command and store the output in $arpTable
$arpTable = `$location`;
// Split the output so every line is an entry of the $arpSplitted array
$arpSplitted = split("\n",$arpTable);
// Get the remote ip address (the ip address of the client, the browser)
$remoteIp = $GLOBALS['REMOTE_ADDR'];
// Cicle the array to find the match with the remote ip address
foreach ($arpSplitted as $value) {
// Split every arp line, this is done in case the format of the arp
// command output is a bit different than expected
$valueSplitted = split(" ",$value);
foreach ($valueSplitted as $spLine) {
if (preg_match("/$remoteIp/",$spLine)) {
$ipFound = true;
}
// The ip address has been found, now rescan all the string
// to get the mac address
if ($ipFound) {
// Rescan all the string, in case the mac address, in the string
// returned by arp, comes before the ip address
// (you know, Murphy's laws)
reset($valueSplitted);
foreach ($valueSplitted as $spLine) {
if (preg_match("/[0-9a-f][0-9a-f][:-]".
"[0-9a-f][0-9a-f][:-]".
"[0-9a-f][0-9a-f][:-]".
"[0-9a-f][0-9a-f][:-]".
"[0-9a-f][0-9a-f][:-]".
"[0-9a-f][0-9a-f]/i",$spLine)) {
return $spLine;
}
}
}
$ipFound = false;
}
}
return false;
}

Edited by anonīms
Link to comment
Share on other sites

lai ari chakars lielaks toties atkrit iespeja ka lietotaja IP (kurs jau ir nobalsojis) nenonak pie cita kurs grib balsot bet nevar jo ta IP jau ir blacklistee....

 

Tad jau tomēr labāk IP :D

jo kāds biedrs bobsters nezin kā darbojas webi un tīkli.

 

 

Labi ka tu mums tāds izglītots un visu māki un zini....

Edited by bobsters
Link to comment
Share on other sites

Ko jūs te pīpējat? Nevar dabūt MAC adresi. Piemēram, man rūteris ir tā nokonfigurēts, ka tu nemaz nezini, cik datori aiz viņa sēž, viņš simulē vienu datoru ar konkrētu MAC adresi.

 

Nav ko iespringt par šīm lietām, ja gribēs, tāpat nobalsos vairākkārt caur prokšiem...

Link to comment
Share on other sites

Es skatos jūs baigi te aizrāvaties! :D BEt lūdzu simple vote skript varat iedot kur nospiežot nobalsojās un nevajag nekādas zvaigznes neko citu! pas pats apmēram kas click counter tikai viens un tas pats IP nevar balsot un saglabājās DB pēc ID

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...