Jump to content
php.lv forumi

balsošanas administrēšana


keissfootball

Recommended Posts

tu domā tajos divos kurus pieprasa tijpa require?

 

require 'settings.php'; tjipa setingos ir (ŠEIT NAV NEVIENA OUTPUTA)

 

<?php
// Password for the administration interface
$PASSWORD = 'parole';

// Path to the directory containing the data files
$DATAPATH = '';

// Domain (without www)
$DOMAIN = 'domens.lv';
?>

 

 

 

require 'pollcode.php'; pollcodaa ir: (ŠEIT ARĪ NAV OUTPUTU)

 

<?php

require 'settings.php';

function ReadPollData() {
$filename = $DATAPATH . 'poll.txt';
$fp = fopen($filename, "r");
$fc = fread($fp,filesize($filename)-1);
fclose($fp);

$elements = explode(":", $fc);
$h = (count($elements)-1) / 2;
$question = stripslashes($elements[0]);
$i = 0;
while ($h > $i) {
 $item[$i] = $elements[(2*$i+1)];
 $votes[$i] = $elements[(2*$i+2)];
 $i++;
}
return array ($item, $votes, $question);
}

function ReadLogFile() {
$filename = $DATAPATH . 'iplog.txt';
$fp = fopen($filename, "r");
$fc = fread($fp,filesize($filename));
fclose($fp);

$elements = explode(":", $fc);
return $elements;
}
?>

Edited by keissfootball
Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

varbū tā:

 

require 'settings.php';
require 'pollcode.php';

function checkAuth() {
    if (!$_COOKIE["USER_AUTH"]["auth"]=='1') {
        header("Location: admin.php");
    }
}

ob_start();
if (!isset($_GET["action"])) {
    $action = $_POST["action"];
} else {
    $action = $_GET["action"];
}

if(!isset($action)) { 
 // ########## Login form ##########
?>

<html>
<head>
..
</head>
<body>
    <h2>Logins</h2> 
..

 

?

Edited by php_Stopp
Link to comment
Share on other sites

khem.. ja tu palaidi tik tiešām to kodu, uz ko iedevi linku, tad tādu kļūdu nevajadzētu izmest. bet mazliet par citu kļūdu - 1.-13. rindā tev ir OUTPUTS, un 56. rindiņā tiek izsaukta funkcija checkAuth, kurā savukārt ir norādīts, ka noteiktā gadījumā ir notiek pārnešana ar HEADERI, pirms kura jau ir bijis OUTPUTS. kā mēs labi zinam, pirms headriem outputi nedrīkst būt.

tas tā, tīri informācijai ;)

Link to comment
Share on other sites

aa tomeer ir veel 1 probleema. man visi balsošanu darbinošie faili stāv ftp serverī direktorijā /usr/home/lfka-ftp/poll/, bet php fails (balsošana) /usr/home/lfka-ftp/, php fails izskatās šādi:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257">
</head>

<body>
<?php include 'poll.php' ?>
</body>
</html>

 

bet tad man viņš nerādās, ja ielikts atsevišķi, savukārt rādās, ja ielieku to php failu poll direktorijā. man vajadzētu, lai viss tā paliktu, tikai php skriptā kaut kas laikam jāmaina???

Edited by keissfootball
Link to comment
Share on other sites

jau mēģināju poll/poll.php, bet neiet

 

ja to pielieku, tad rāda:

 

Warning: main(): Unable to access settings.php in /usr/home/lfka-ftp/poll/poll.php on line 14

 

Warning: main(settings.php): failed to open stream: No such file or directory in /usr/home/lfka-ftp/poll/poll.php on line 14

 

Warning: main(): Failed opening 'settings.php' for inclusion (include_path='') in /usr/home/lfka-ftp/poll/poll.php on line 14

 

Warning: main(): Unable to access pollcode.php in /usr/home/lfka-ftp/poll/poll.php on line 15

 

Warning: main(pollcode.php): failed to open stream: No such file or directory in /usr/home/lfka-ftp/poll/poll.php on line 15

 

Warning: main(): Failed opening 'pollcode.php' for inclusion (include_path='') in /usr/home/lfka-ftp/poll/poll.php on line 15

 

Fatal error: Call to undefined function: readpolldata() in /usr/home/lfka-ftp/poll/poll.php on line 16

 

a kods ir tāds:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257">
</head>

<body>
<?php include ('poll/poll.php'); ?>
</body>
</html>

Edited by keissfootball
Link to comment
Share on other sites

pag pag.. teu fails poll.php atrodas mapē usr/kautkastur/poll/ ja ? un tu gribi to poll.php failu izsaukt failā, kurš atrodas mapē usr/kautkastur/ ?

 

jau mēģināju poll/poll.php, bet neiet

 

ja to pielieku, tad rāda:

 

Warning: main(): Unable to access settings.php in /usr/home/lfka-ftp/poll/poll.php on line 14

 

Warning: main(settings.php): failed to open stream: No such file or directory in /usr/home/lfka-ftp/poll/poll.php on line 14

 

Warning: main(): Failed opening 'settings.php' for inclusion (include_path='') in /usr/home/lfka-ftp/poll/poll.php on line 14

 

Warning: main(): Unable to access pollcode.php in /usr/home/lfka-ftp/poll/poll.php on line 15

 

Warning: main(pollcode.php): failed to open stream: No such file or directory in /usr/home/lfka-ftp/poll/poll.php on line 15

 

Warning: main(): Failed opening 'pollcode.php' for inclusion (include_path='') in /usr/home/lfka-ftp/poll/poll.php on line 15

 

Fatal error: Call to undefined function: readpolldata() in /usr/home/lfka-ftp/poll/poll.php on line 16

 

a kods ir tāds:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1257">
</head>

<body>
<?php include ('poll/poll.php'); ?>
</body>
</html>

25898[/snapback]

 

šīm kļūdām nav nekāda sakara ar faila poll.php lokāciju (khem, atrašanās vietu). tas include ir izdarīts pareizi, kļūdas ir poll.php failā.

Edited by php_Stopp
Link to comment
Share on other sites


×
×
  • Create New...