/[wopi]/make_poll.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /make_poll.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by dpavlin, Thu Apr 24 19:11:45 2003 UTC revision 1.7 by dpavlin, Thu Apr 24 19:39:14 2003 UTC
# Line 83  $out.=' Line 83  $out.='
83                  $sql="update '.$poll.' set '.join(",\n",@sql_update).',                  $sql="update '.$poll.' set '.join(",\n",@sql_update).',
84                          do_stranice=\'$PHP_SELF\'                          do_stranice=\'$PHP_SELF\'
85                          where id=$id";                          where id=$id";
86                  print "<pre>$sql</pre>";  #               print "<pre>$sql</pre>";
87                  $result=pg_Exec($conn,fix_sql($sql));                  $result=pg_Exec($conn,fix_sql($sql));
88          } elseif($do_stranice != $PHP_SELF && isset($do_uri) && isset($a)) {          } elseif($do_stranice != $PHP_SELF && isset($do_uri) && isset($a)) {
89                  Header("Location: $do_uri?a=$a");                  Header("Location: $do_uri?a=$a");
# Line 179  $p->parsefile($xmlfile); Line 179  $p->parsefile($xmlfile);
179  print "p[$page_nr] ";  print "p[$page_nr] ";
180    
181  open(PAGE, ">$poll/$last_fn") or die "Couldn't open $last_fn for writing:\n$!";  open(PAGE, ">$poll/$last_fn") or die "Couldn't open $last_fn for writing:\n$!";
 if ($page_nr <= 2) {  
         print PAGE php_new_poll();  
 }  
182  print PAGE php_header($page_nr,@prelast_sql_update);  print PAGE php_header($page_nr,@prelast_sql_update);
183  my $next_fn=sprintf("%02d.php",$page_nr);  my $next_fn=sprintf("%02d.php",$page_nr);
184  $last_page=~s/##NEXTPAGE##/$next_fn/;  $last_page=~s/##NEXTPAGE##/$next_fn/;
# Line 438  sub sgml_escape { Line 435  sub sgml_escape {
435  }  # End sgml_escape  }  # End sgml_escape
436    
437    
 sub php_new_poll {  
         return '<?php  
 include_once("common.php");  
 if (isset($do_stranice) && $do_stranice !="") {  
         Header("Location: $do_uri?a=$a");  
         exit;  
 }  
 $member_id=id_decode($a);  
 $sql="insert into '.$poll.' ( http_referer,remote_addr,user_agent, member_id ) values (\'$HTTP_REFERER\',\'$REMOTE_ADDR\',\'$HTTP_USER_AGENT\',$member_id)";  
   
 #       print "<pre>$sql</pre>";  
         $result=pg_Exec($conn,fix_sql($sql));  
         $lastoid=pg_getlastoid($result);  
         $result = pg_Exec($conn,fix_sql("select id from '.$poll.' where oid=$lastoid"));  
         $row=pg_fetch_row($result,0);  
         $id=$row[0];  
 ?>';  
 }  
   
438  ################################################################  ################################################################
439    
440  package Poll;  package Poll;
# Line 475  sub page { Line 453  sub page {
453    
454                          if (defined $last_fn) {                          if (defined $last_fn) {
455                                  open(PAGE, ">$poll/$last_fn") or die "Couldn't open $last_fn for writing:\n$!";                                  open(PAGE, ">$poll/$last_fn") or die "Couldn't open $last_fn for writing:\n$!";
456                                  if ($page_nr < 2) {                                  print PAGE php_header($page_nr,@prelast_sql_update);
                                         print PAGE php_new_poll();  
                                 } else {  
                                         print PAGE php_header($page_nr,@prelast_sql_update);  
                                 } # last_sql_update  
   
   
457                                  my $next_fn=sprintf("%02d.php",$page_nr);                                  my $next_fn=sprintf("%02d.php",$page_nr);
458                                  $last_page=~s/##NEXTPAGE##/$next_fn/;                                  $last_page=~s/##NEXTPAGE##/$next_fn/;
459                                  print PAGE $last_page;                                  print PAGE $last_page;

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26