Can someone tell me how am i gonna write this one to perl?
Moderator: General Moderators
Can someone tell me how am i gonna write this one to perl?
<?php
ob_start(); error_reporting(E_ALL); $xronos=date("l dS of F h:i:s A"); $host=gethostbyaddr($_SERVER['REMOTE_ADDR']); $i=0;
echo "<body background=pics/anemos.jpg>";
echo "<font size=5 color=Yellow>";
if (@mysql_connect('localhost', 'nik', 'macgyver'));
else @mysql_connect('localhost', 'root');
mysql_select_db('db_nik');
$data = file("data.txt");
$diary = file("diary.txt");
$tainies = file("tainies.txt");
?>
<center><font size=5 color=Cyan>- Ðáñáããåëßá Ôáéíéþí DivX by Nik! - <br>
<center><font size=4 color=Pink>* ÅëÜ÷éóôç ðáñáããåëßá åßíáé 5 ôáéíßåò ìå êüóôïò 4 euro áíÜ cd *<br>
<center><font size=4 color=Pink>* Ãéá ðáñáããåëßåò Üíù ôùí 10 ôáéíéþí ôï êüóôïò áíÜ cd êáôåâáßíåé óôá 3 euro *<br>
<center><font size=4 color=Pink>* Ãéá ó÷üëéá êáé ðáñáôçñÞóåéò üóïí áöïñÜ ôéò ôáéíßåò ðáñáêáëþ ãñÜøå ìïõ óôï nik0s@mycosmos.gr *<br><br>
<form action="check.php" method="post">
<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 1çò ôáéíßáò? </td>
<td align=center> <select name=dvd1> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 2çò ôáéíßáò? </td>
<td align=center> <select name=dvd2> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 3çò ôáéíßáò? </td>
<td align=center> <select name=dvd3> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 4çò ôáéíßáò? </td>
<td align=center> <select name=dvd4> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 5çò ôáéíßáò? </td>
<td align=center> <select name=dvd5> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
</table><br><br>
<table border=1 width=40% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>
<tr> <td align=center> <input type="submit" name="kataxorisi" value="ÈÝëù íá ðáñáããåßëù áõôÝò ôéò 5 ôáéíßåò"> </td></tr>
<tr> <td align=center> <input type="submit" name="emfanisi" value="ÈÝëù íá äþ ðïéÝò ôáéíßåò Ý÷ù ðáñáããåßëåé"> </td></tr>
<tr> <td align=center> <input type="submit" name="diagrafi" value="ÈÝëù íá ìåôáâÜëù ìéá ôñÝ÷ïõóá ðáñáããåëßá"> </td></tr>
</tr>
</table>
</form><br>
<form action="eggrafi.php" method="post">
<input type="submit" name="eggrafi" value="ÅããñáöÞ ÌÝëïõò">
</form>
<form action="progs.php" method="post">
<input type="submit" name="progs" value="ÄéÜöïñá Ðáé÷íßäéá êáé ÐñïãñÜììáôá">
</form>
<form action="logos.php" method="post">
<input type="submit" name="logos" value="ÈáõìÜóéï Ðíåõìáôéêü êáé Øõ÷ùöåëÝò Êåßìåíï!">
</form><br>
<?
echo "<center><font size=4 color=Cyan>";
foreach($diary as $lineno=>$line)
if($line=="\n") unset($diary[$lineno]);
$diary = array_values($diary);
$quote=$diary[rand(0, count ($diary)-1)];
echo "<table border=1 width=80% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
echo "<tr>";
echo "<td> <center><font size=4 color=Cyan> $quote </td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<center><font size=4 color=Orange> $xronos";
echo "<center><font size=4 color=Pink> $host";
mysql_query("UPDATE counter SET visitor=visitor+1");
$sql = mysql_query("SELECT visitor FROM counter");
$visitor = mysql_fetch_array($sql);
echo "<center><font size=5 color=Yellow> $visitor[0]";
echo "<center><a href=personal><img src=pics/cross.gif></a>";
mail ("nik0s@mycosmos.gr", "Åðßóêåøç ÁôæÝíôáò $host => $visitor[0]", "", "From: 007@spy.gr");
?>
!!! Pls its urgent !!!
Thank you very much!
ob_start(); error_reporting(E_ALL); $xronos=date("l dS of F h:i:s A"); $host=gethostbyaddr($_SERVER['REMOTE_ADDR']); $i=0;
echo "<body background=pics/anemos.jpg>";
echo "<font size=5 color=Yellow>";
if (@mysql_connect('localhost', 'nik', 'macgyver'));
else @mysql_connect('localhost', 'root');
mysql_select_db('db_nik');
$data = file("data.txt");
$diary = file("diary.txt");
$tainies = file("tainies.txt");
?>
<center><font size=5 color=Cyan>- Ðáñáããåëßá Ôáéíéþí DivX by Nik! - <br>
<center><font size=4 color=Pink>* ÅëÜ÷éóôç ðáñáããåëßá åßíáé 5 ôáéíßåò ìå êüóôïò 4 euro áíÜ cd *<br>
<center><font size=4 color=Pink>* Ãéá ðáñáããåëßåò Üíù ôùí 10 ôáéíéþí ôï êüóôïò áíÜ cd êáôåâáßíåé óôá 3 euro *<br>
<center><font size=4 color=Pink>* Ãéá ó÷üëéá êáé ðáñáôçñÞóåéò üóïí áöïñÜ ôéò ôáéíßåò ðáñáêáëþ ãñÜøå ìïõ óôï nik0s@mycosmos.gr *<br><br>
<form action="check.php" method="post">
<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 1çò ôáéíßáò? </td>
<td align=center> <select name=dvd1> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 2çò ôáéíßáò? </td>
<td align=center> <select name=dvd2> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 3çò ôáéíßáò? </td>
<td align=center> <select name=dvd3> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 4çò ôáéíßáò? </td>
<td align=center> <select name=dvd4> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
<tr>
<td align=center> <font size=5 color=LightGreen> Ôßôëïò 5çò ôáéíßáò? </td>
<td align=center> <select name=dvd5> <?foreach ($tainies as $tainia) echo "<option>$tainia</option>";?> </select></td>
</tr>
</table><br><br>
<table border=1 width=40% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>
<tr> <td align=center> <input type="submit" name="kataxorisi" value="ÈÝëù íá ðáñáããåßëù áõôÝò ôéò 5 ôáéíßåò"> </td></tr>
<tr> <td align=center> <input type="submit" name="emfanisi" value="ÈÝëù íá äþ ðïéÝò ôáéíßåò Ý÷ù ðáñáããåßëåé"> </td></tr>
<tr> <td align=center> <input type="submit" name="diagrafi" value="ÈÝëù íá ìåôáâÜëù ìéá ôñÝ÷ïõóá ðáñáããåëßá"> </td></tr>
</tr>
</table>
</form><br>
<form action="eggrafi.php" method="post">
<input type="submit" name="eggrafi" value="ÅããñáöÞ ÌÝëïõò">
</form>
<form action="progs.php" method="post">
<input type="submit" name="progs" value="ÄéÜöïñá Ðáé÷íßäéá êáé ÐñïãñÜììáôá">
</form>
<form action="logos.php" method="post">
<input type="submit" name="logos" value="ÈáõìÜóéï Ðíåõìáôéêü êáé Øõ÷ùöåëÝò Êåßìåíï!">
</form><br>
<?
echo "<center><font size=4 color=Cyan>";
foreach($diary as $lineno=>$line)
if($line=="\n") unset($diary[$lineno]);
$diary = array_values($diary);
$quote=$diary[rand(0, count ($diary)-1)];
echo "<table border=1 width=80% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
echo "<tr>";
echo "<td> <center><font size=4 color=Cyan> $quote </td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "<center><font size=4 color=Orange> $xronos";
echo "<center><font size=4 color=Pink> $host";
mysql_query("UPDATE counter SET visitor=visitor+1");
$sql = mysql_query("SELECT visitor FROM counter");
$visitor = mysql_fetch_array($sql);
echo "<center><font size=5 color=Yellow> $visitor[0]";
echo "<center><a href=personal><img src=pics/cross.gif></a>";
mail ("nik0s@mycosmos.gr", "Åðßóêåøç ÁôæÝíôáò $host => $visitor[0]", "", "From: 007@spy.gr");
?>
!!! Pls its urgent !!!
Thank you very much!
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Can you tell me exactly what you mean by this? And 'Can someone tell me how' sounds suspisiously like 'I haven't bothered to do any of this myself could someone just do it for me because I'm too lazy.'Nik wrote:Can someone tell me how am i gonna write this one to perl?
You've posted loads of code, you've not given any explanation as to what exactly you're trying to achieve and you haven't bothered using the PHP bbcode tags to actually make it possible for people to quickly skim your code.Nik wrote:Lots of code no use whatsoever of the [ php ] tags to make it easier for people to read
I for one, couldn't care less - I'm sorry that this is so harsh but you've not bothered to explain at all what you are trying to achieve and you expect others here to read your mind and produce a finished product.Nik wrote:!!! Pls its urgent !!!
Spend the time thinking about your question, make it clear, format your code and comment where necessary.
Oh, and if the question is about converting that PHP code to Perl then you've posted in the wrong forum - you haven't even bothered to think about that.
Mac
oi twigletmac, had a bad day?
No, serious, you're right.
Don't take it too personal, Nik, as the statement also includes that if you add the requested parts, if you can make someone (able to help you) think "ah yes, that's worth spending my time instead of having a jolly good time out with friends, esp. sunday evening" you probably will receive help; at least it will increase the probability a lot.
Otherwise (as you can see) somebody might become a real cow ( uh... "cranky" I meant
) for good reason.
The link in my signiture might be exactly what you need to read to avoid replies like this time....
Don't take it too personal, Nik, as the statement also includes that if you add the requested parts, if you can make someone (able to help you) think "ah yes, that's worth spending my time instead of having a jolly good time out with friends, esp. sunday evening" you probably will receive help; at least it will increase the probability a lot.
Otherwise (as you can see) somebody might become a real cow ( uh... "cranky" I meant
The link in my signiture might be exactly what you need to read to avoid replies like this time....
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Been a very long weekend...volka wrote:oi twigletmac, had a bad day?
volka wrote:Otherwise (as you can see) somebody might become a real cow ( uh... "cranky" I meant) for good reason.
Definitely.volka wrote:The link in my signiture might be exactly what you need to read to avoid replies like this time....
Mac
yes u r rigth am sorry
i am trying to produce my page at http://www.nikolas.tk which is made to php to convert it to perl
The only thing i was able to do was that
use warnings;
use strict;
use DBI;
use DBD::mysqlPP;
$dbh = DBI->connect( "DBI:mysql:db_nik", "nik", "macgyver" ) or $dbh = DBI->connect( "DBI:mysql:db_nik", "root", "" );
$data = file("data.txt");
$diary = file("diary.txt");
$tainies = file("tainies.txt");
$xronos=date("l dS of F h:i:s A"); $host=gethostbyaddr($_SERVER['REMOTE_ADDR']); $i=0;
print "<body background=pics/anemos.jpg>";
print "<font size=5 color=Yellow>";
print "<center><font size=5 color=Cyan>- Ðáñáããåëßá Ôáéíéþí DivX by Nik! - <br>";
print "<center><font size=4 color=Pink>* ÅëÜ÷éóôç ðáñáããåëßá åßíáé 5 ôáéíßåò ìå êüóôïò 4 euro áíÜ cd *<br>";
print "<center><font size=4 color=Pink>* Ãéá ðáñáããåëßåò Üíù ôùí 10 ôáéíéþí ôï êüóôïò áíÜ cd êáôåâáßíåé óôá 3 euro *<br>";
print "<center><font size=4 color=Pink>* Ãéá ó÷üëéá êáé ðáñáôçñÞóåéò üóïí áöïñÜ ôéò ôáéíßåò ðáñáêáëþ ãñÜøå ìïõ óôï nik0s@mycosmos.gr *<br><br>";
print "<form action="check.php" method="post">";
print "<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr>";
print "<td align=center> <font size=5 color=LightGreen> O?oeio 1co oaei?ao? </td>";
print "<td align=center> <select name=dvd1> foreach ($tainies as $tainia) print "<option>$tainia</option>"; </select></td>";
print "</tr>";
print "</table><br><br>";
print "<table border=1 width=40% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr> <td align=center> <input type="submit" name="kataxorisi" value="ÈÝëù íá ðáñáããåßëù áõôÝò ôéó 5 ôáéíßåò"> </td></tr>";
print "<tr> <td align=center> <input type="submit" name="emfanisi" value="ÈÝëù íá äþ ðïéåò ôáéíßåò Ý÷ù ðáñáããåßëåé"> </td></tr>";
print "<tr> <td align=center> <input type="submit" name="diagrafi" value="ÈÝëù íá ìåôáâÜëëù ìéá ðáñáããåëßá ðïõ Ý÷ù êÜíåé"> </td></tr>";
print "</table>";
print "</form><br>";
print "<form action="eggrafi.php" method="post">";
print "<input type="submit" name="eggrafi" value="ÅããñáöÞ ÌÝëïõò">";
print "</form>";
print "<form action="progs.php" method="post">"
print "<input type="submit" name="progs" value="ÄéÜöïñá Ðáé÷íßäéá êáé ÐñïãñÜììáôá">";
print "</form>"
print "<form action="logos.php" method="post">";
print "<input type="submit" name="logos" value="ÈáõìÜóéá ÐíåõìáôéêÜ êáé Øõ÷ùöåëÝóôáôá Êåßìåíá!">";
print "</form><br>";
print "<center><font size=4 color=Cyan>";
foreach($diary as $lineno=>$line)
if($line=="\n") unset($diary[$lineno]);
$diary = array_values($diary);
$quote=$diary[rand(0, count ($diary)-1)];
print "<table border=1 width=80% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr>";
print "<td> <center><font size=4 color=Cyan> $quote </td>";
print "</tr>";
print "</table>";
print "<br>";
print "<center><font size=4 color=Orange> $xronos";
print "<center><font size=4 color=Pink> $host";
mysql_query("UPDATE counter SET visitor=visitor+1");
$sql = mysql_query("SELECT visitor FROM counter");
$visitor = mysql_fetch_array($sql);
print "<center><font size=5 color=Yellow> $visitor[0]";
print "<center><a href=personal><img src=pics/cross.gif></a>";
mail ("nik0s@mycosmos.gr", "Åðßóêåøç ÁôæÝíôáò $host => $visitor[0]", "", "From: 007@spy.gr");
Sorry about the bbcode, i dont know what exacly is it!
The script is just a simple php script using mysql.
I know this is a php forum ( and a very good one i might add) and my question is perl question but i didnt find out a perl forum so am asking here... excuse me for my mistakes
thanks again guys.
i am trying to produce my page at http://www.nikolas.tk which is made to php to convert it to perl
The only thing i was able to do was that
use warnings;
use strict;
use DBI;
use DBD::mysqlPP;
$dbh = DBI->connect( "DBI:mysql:db_nik", "nik", "macgyver" ) or $dbh = DBI->connect( "DBI:mysql:db_nik", "root", "" );
$data = file("data.txt");
$diary = file("diary.txt");
$tainies = file("tainies.txt");
$xronos=date("l dS of F h:i:s A"); $host=gethostbyaddr($_SERVER['REMOTE_ADDR']); $i=0;
print "<body background=pics/anemos.jpg>";
print "<font size=5 color=Yellow>";
print "<center><font size=5 color=Cyan>- Ðáñáããåëßá Ôáéíéþí DivX by Nik! - <br>";
print "<center><font size=4 color=Pink>* ÅëÜ÷éóôç ðáñáããåëßá åßíáé 5 ôáéíßåò ìå êüóôïò 4 euro áíÜ cd *<br>";
print "<center><font size=4 color=Pink>* Ãéá ðáñáããåëßåò Üíù ôùí 10 ôáéíéþí ôï êüóôïò áíÜ cd êáôåâáßíåé óôá 3 euro *<br>";
print "<center><font size=4 color=Pink>* Ãéá ó÷üëéá êáé ðáñáôçñÞóåéò üóïí áöïñÜ ôéò ôáéíßåò ðáñáêáëþ ãñÜøå ìïõ óôï nik0s@mycosmos.gr *<br><br>";
print "<form action="check.php" method="post">";
print "<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr>";
print "<td align=center> <font size=5 color=LightGreen> O?oeio 1co oaei?ao? </td>";
print "<td align=center> <select name=dvd1> foreach ($tainies as $tainia) print "<option>$tainia</option>"; </select></td>";
print "</tr>";
print "</table><br><br>";
print "<table border=1 width=40% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr> <td align=center> <input type="submit" name="kataxorisi" value="ÈÝëù íá ðáñáããåßëù áõôÝò ôéó 5 ôáéíßåò"> </td></tr>";
print "<tr> <td align=center> <input type="submit" name="emfanisi" value="ÈÝëù íá äþ ðïéåò ôáéíßåò Ý÷ù ðáñáããåßëåé"> </td></tr>";
print "<tr> <td align=center> <input type="submit" name="diagrafi" value="ÈÝëù íá ìåôáâÜëëù ìéá ðáñáããåëßá ðïõ Ý÷ù êÜíåé"> </td></tr>";
print "</table>";
print "</form><br>";
print "<form action="eggrafi.php" method="post">";
print "<input type="submit" name="eggrafi" value="ÅããñáöÞ ÌÝëïõò">";
print "</form>";
print "<form action="progs.php" method="post">"
print "<input type="submit" name="progs" value="ÄéÜöïñá Ðáé÷íßäéá êáé ÐñïãñÜììáôá">";
print "</form>"
print "<form action="logos.php" method="post">";
print "<input type="submit" name="logos" value="ÈáõìÜóéá ÐíåõìáôéêÜ êáé Øõ÷ùöåëÝóôáôá Êåßìåíá!">";
print "</form><br>";
print "<center><font size=4 color=Cyan>";
foreach($diary as $lineno=>$line)
if($line=="\n") unset($diary[$lineno]);
$diary = array_values($diary);
$quote=$diary[rand(0, count ($diary)-1)];
print "<table border=1 width=80% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr>";
print "<td> <center><font size=4 color=Cyan> $quote </td>";
print "</tr>";
print "</table>";
print "<br>";
print "<center><font size=4 color=Orange> $xronos";
print "<center><font size=4 color=Pink> $host";
mysql_query("UPDATE counter SET visitor=visitor+1");
$sql = mysql_query("SELECT visitor FROM counter");
$visitor = mysql_fetch_array($sql);
print "<center><font size=5 color=Yellow> $visitor[0]";
print "<center><a href=personal><img src=pics/cross.gif></a>";
mail ("nik0s@mycosmos.gr", "Åðßóêåøç ÁôæÝíôáò $host => $visitor[0]", "", "From: 007@spy.gr");
Sorry about the bbcode, i dont know what exacly is it!
The script is just a simple php script using mysql.
I know this is a php forum ( and a very good one i might add) and my question is perl question but i didnt find out a perl forum so am asking here... excuse me for my mistakes
thanks again guys.
i forgot to tell you that i want this script to run on ie not just in a dos command prompt window so that i can replace the http://www.nikolas.tk index.php with index.pl
I think i made my self clear this time, didnt i?
I think i made my self clear this time, didnt i?
I'm a bit too tired to go through the complete script, but a few things to play with for now 
perl uses the prefix of a variable/statment to determine the type used. $var is something else (a scalar) than @var (an array).unless told otherwise perl will assign the current value of the array to $_, if you want to change this...without reading it to an arraythis also works with use strict butdoesn't. With use strict you have to declare variables before using them (helps to avoid typos)
perl uses the prefix of a variable/statment to determine the type used. $var is something else (a scalar) than @var (an array).
Code: Select all
# opening a file, data will be the fieldescriptor
open(data, "data.txt");
# reading the complete contents as array
@content = <data>;
# looping through the array
foreach (@content)
{ print $_; }Code: Select all
open(data, "data.txt");
@content = <data>;
foreach $line (@content)
{ print $line; }Code: Select all
open(DATA, "data.txt") or die("cannot open input file");
while (<DATA>)
{ print $_; }
close(DATA);Code: Select all
use strict;
open(DATA, "data.txt") or die("cannot open input file");
@content = <DATA>;
foreach $line (@content)
{ print $line;}
close(DATA);Code: Select all
use strict;
open(DATA, "data.txt") or die("cannot open input file");
my @content = <DATA>;
foreach my $line (@content)
{ print $line;}
close(DATA);THANK YOU VERY MUCH MAN FOR YOUR WILLINGNESS TO HELP ALTHOUGH MY QUESTION IS A PERL QUESTION AND THIS IS A PHP FORUM! EVER CONSIDERING MAKEING A PERL SECTION?
the ansers was a great help to me and i also wanted to ask this:
print "<form action=check.php method=post>";
print "<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
foreach (1 .. 5)
{
print "<tr>";
print "<td align=center> <font size=5 color=LightGreen> Ôßôëïò $_ çò ôáéíßáò </td>";
print "<td align=center> <select name=dvd1> foreach(@tainies) {<option> $_ </option> }</select></td>";
print "</tr>";
}
print "</table><br><br>";
i use foreach inside print will it work?
how u see it? is it correct? can u suggest something about it?
the ansers was a great help to me and i also wanted to ask this:
print "<form action=check.php method=post>";
print "<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
foreach (1 .. 5)
{
print "<tr>";
print "<td align=center> <font size=5 color=LightGreen> Ôßôëïò $_ çò ôáéíßáò </td>";
print "<td align=center> <select name=dvd1> foreach(@tainies) {<option> $_ </option> }</select></td>";
print "</tr>";
}
print "</table><br><br>";
i use foreach inside print will it work?
how u see it? is it correct? can u suggest something about it?
Iam really sorry for repeating myself bu i couldnt help it! this is all i have done so far with perl. volka i am reffering to u man if u pls make this run
use warnings;
use CGI;
use DBI;
use DBD::mysqlPP;
$db = DBI->connect("DBI:mysqlPP:database=db_nik;host=localhost") or
$db = DBI->connect("DBI:mysqlPP:database=db_nik;host=nik.wvbuzz.com", "nik", "macgyver", {RaiseError => 1});
open(IN, "data.txt"); @data=<IN>; close(IN);
open(IN, "diary.txt"); @diary=<IN>; close(IN);
open(IN, "tainies.txt"); @tainies=<IN>; close(IN);
$xronos=date("l dS of F h:i:s A"); my $i=0;
$ip_address = $ENV{'REMOTE_ADDR'};
@numbers = split(/\./, $ip_address);
$ip_number = pack("C4", @numbers);
($host) = (gethostbyaddr($ip_number, 2))[0];
print "<body background=pics/anemos.jpg>";
print "<font size=5 color=Yellow>";
print "<center><font size=5 color=Cyan>- Ðáñáããåëßá Ôáéíéþí DivX by Nik! -<br>";
print "<center><font size=4 color=Pink>* ÅëÜ÷éóôç ðáñáããåëßá åßíáé 5 ôáéíßåò ìå êüóôïò 4 euro áíÜ cd *<br>";
print "<center><font size=4 color=Pink>* Ãéá ðáñáããåëßåò Üíù ôùí 10 ôáéíéþí ôï êüóôïò áíÜ cd êáôåâáßíåé óôá 3 euro *<br>";
print "<center><font size=4 color=Pink>* Ãéá ó÷üëéá êáé ðáñáôçñÞóåéò üóïí áöïñÜ ôéò ôáéíßåò ðáñáêáëþ ãñÜøå ìïõ óôï nik0s\@mycosmos.gr *<br><br>";
print "<form action=check.php method=post>";
print "<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
foreach (1 .. 5)
{
print "<tr>";
print "<td align=center> <font size=5 color=LightGreen> Ôßôëïò $_ çò ôáéíßáò </td>";
print "<td align=center> <select name=dvd1> foreach(@tainies) {<option> $_ </option> }</select></td>";
print "</tr>";
}
print "</table><br><br>";
print "<table border=1 width=40% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr> <td align=center> <input type=submit name=kataxorisi value=ÈÝëù íá ðáñáããåßëù áõôÝò ôéó 5 ôáéíßåò> </td></tr>";
print "<tr> <td align=center> <input type=submit name=emfanisi value=ÈÝëù íá äþ ðïéåò ôáéíßåò Ý÷ù ðáñáããåßëåé> </td></tr>";
print "<tr> <td align=center> <input type=submit name=diagrafi value=ÈÝëù íá ìåôáâÜëëù ìéá ðáñáããåëßá ðïõ Ý÷ù êÜíåé> </td></tr>";
print "</table>";
print "</form><br>";
print "<form action=eggrafi.php method=post>";
print "<input type=submit name=eggrafi value=ÅããñáöÞ ÌÝëïõò>";
print "</form>";
print "<form action=progs.php method=post>";
print "<input type=submit name=progs value=ÄéÜöïñá Ðáé÷íßäéá êáé ÐñïãñÜììáôá>";
print "</form>";
print "<form action=logos.php method=post>";
print "<input type=submit name=logos value=ÈáõìÜóéá ÐíåõìáôéêÜ êáé Øõ÷ùöåëÝóôáôá Êåßìåíá!>";
print "</form><br>";
print "<center><font size=4 color=Cyan>";
print "<table border=1 width=80% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr>";
print "<td> <center><font size=4 color=Cyan> 1 </td>";
print "</tr>";
print "</table><br>";
print "<center><font size=4 color=Orange> $xronos";
print "<center><font size=4 color=Pink> $host";
$sql = "UPDATE counter SET visitor=visitor+1";
$db->do($sql);
$st = $db->prepare( q{SELECT visitor FROM counter});
$st->execute();
@visitor = $st->fetchrow_array();
print "<center><font size=5 color=Yellow> $visitor[0]";
print "<center><a href=personal><img src=pics/cross.gif></a>";
mail ("nik0s\@mycosmos.gr", "Åðßóêåøç ÁôæÝíôáò $host => $visitor[0]", "", "From: 007\@spy.gr");
i want this to run as a cgi script what changes must a make to achieve that?
and also wantes to ask why am not receiving email notifications for the answers? i have notify ON
Thanks for all!
use warnings;
use CGI;
use DBI;
use DBD::mysqlPP;
$db = DBI->connect("DBI:mysqlPP:database=db_nik;host=localhost") or
$db = DBI->connect("DBI:mysqlPP:database=db_nik;host=nik.wvbuzz.com", "nik", "macgyver", {RaiseError => 1});
open(IN, "data.txt"); @data=<IN>; close(IN);
open(IN, "diary.txt"); @diary=<IN>; close(IN);
open(IN, "tainies.txt"); @tainies=<IN>; close(IN);
$xronos=date("l dS of F h:i:s A"); my $i=0;
$ip_address = $ENV{'REMOTE_ADDR'};
@numbers = split(/\./, $ip_address);
$ip_number = pack("C4", @numbers);
($host) = (gethostbyaddr($ip_number, 2))[0];
print "<body background=pics/anemos.jpg>";
print "<font size=5 color=Yellow>";
print "<center><font size=5 color=Cyan>- Ðáñáããåëßá Ôáéíéþí DivX by Nik! -<br>";
print "<center><font size=4 color=Pink>* ÅëÜ÷éóôç ðáñáããåëßá åßíáé 5 ôáéíßåò ìå êüóôïò 4 euro áíÜ cd *<br>";
print "<center><font size=4 color=Pink>* Ãéá ðáñáããåëßåò Üíù ôùí 10 ôáéíéþí ôï êüóôïò áíÜ cd êáôåâáßíåé óôá 3 euro *<br>";
print "<center><font size=4 color=Pink>* Ãéá ó÷üëéá êáé ðáñáôçñÞóåéò üóïí áöïñÜ ôéò ôáéíßåò ðáñáêáëþ ãñÜøå ìïõ óôï nik0s\@mycosmos.gr *<br><br>";
print "<form action=check.php method=post>";
print "<table border=1 width=50% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
foreach (1 .. 5)
{
print "<tr>";
print "<td align=center> <font size=5 color=LightGreen> Ôßôëïò $_ çò ôáéíßáò </td>";
print "<td align=center> <select name=dvd1> foreach(@tainies) {<option> $_ </option> }</select></td>";
print "</tr>";
}
print "</table><br><br>";
print "<table border=1 width=40% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr> <td align=center> <input type=submit name=kataxorisi value=ÈÝëù íá ðáñáããåßëù áõôÝò ôéó 5 ôáéíßåò> </td></tr>";
print "<tr> <td align=center> <input type=submit name=emfanisi value=ÈÝëù íá äþ ðïéåò ôáéíßåò Ý÷ù ðáñáããåßëåé> </td></tr>";
print "<tr> <td align=center> <input type=submit name=diagrafi value=ÈÝëù íá ìåôáâÜëëù ìéá ðáñáããåëßá ðïõ Ý÷ù êÜíåé> </td></tr>";
print "</table>";
print "</form><br>";
print "<form action=eggrafi.php method=post>";
print "<input type=submit name=eggrafi value=ÅããñáöÞ ÌÝëïõò>";
print "</form>";
print "<form action=progs.php method=post>";
print "<input type=submit name=progs value=ÄéÜöïñá Ðáé÷íßäéá êáé ÐñïãñÜììáôá>";
print "</form>";
print "<form action=logos.php method=post>";
print "<input type=submit name=logos value=ÈáõìÜóéá ÐíåõìáôéêÜ êáé Øõ÷ùöåëÝóôáôá Êåßìåíá!>";
print "</form><br>";
print "<center><font size=4 color=Cyan>";
print "<table border=1 width=80% align=Center bordercolor=Yellow style='border-style: solid; border-width: 5' background=pics/blue.jpg>";
print "<tr>";
print "<td> <center><font size=4 color=Cyan> 1 </td>";
print "</tr>";
print "</table><br>";
print "<center><font size=4 color=Orange> $xronos";
print "<center><font size=4 color=Pink> $host";
$sql = "UPDATE counter SET visitor=visitor+1";
$db->do($sql);
$st = $db->prepare( q{SELECT visitor FROM counter});
$st->execute();
@visitor = $st->fetchrow_array();
print "<center><font size=5 color=Yellow> $visitor[0]";
print "<center><a href=personal><img src=pics/cross.gif></a>";
mail ("nik0s\@mycosmos.gr", "Åðßóêåøç ÁôæÝíôáò $host => $visitor[0]", "", "From: 007\@spy.gr");
i want this to run as a cgi script what changes must a make to achieve that?
and also wantes to ask why am not receiving email notifications for the answers? i have notify ON
Thanks for all!
there are spooky constructs in perl but not that strangeprint "<td align=center> <select name=dvd1> foreach(@tainies) {<option> $_ </option> }</select></td>";
try it the simple way first
Code: Select all
print '<td align="center"> <select name="dvd1">';
foreach(@tainies) {print '<option>', $_ , '</option>'; }
print '</select></td>';in a single-quoted string literal " can be used without escaping. No variable substitution will take place but that's not needed here.
print '<td align="center"> <select name="dvd1">' is more readable than print "<td align=\"center\"> <select name=\"dvd1\">" and you should quote the value of an html-property wherever possible.
there's an example for strftime on http://www.perldoc.com/perl5.8.0/pod/fu ... ltime.html
http://www.perldoc.com/perl5.8.0/lib/PO ... l#strftime explains it in a bit more detail and the manual page mentioned there can be found e.g. at http://www.hmug.org/man/3/strftime.html
print '<td align="center"> <select name="dvd1">' is more readable than print "<td align=\"center\"> <select name=\"dvd1\">" and you should quote the value of an html-property wherever possible.
there's an example for strftime on http://www.perldoc.com/perl5.8.0/pod/fu ... ltime.html
http://www.perldoc.com/perl5.8.0/lib/PO ... l#strftime explains it in a bit more detail and the manual page mentioned there can be found e.g. at http://www.hmug.org/man/3/strftime.html
just as easily as
print '<td align="center"> <select name="dvd1">';
print '<td align="center"> <select name="dvd1">';
- advantages:
- it's compliant (ask http://validator.w3.org
) - handles values with whitespaces
Code: Select all
<html><body> <input type="text" value="no problem" /> <br /> <input type="text" value=problems here /> </body></html> - it's compliant
- well-formed html can be used with xml-tools (sometimes helpful)
- last but not least: it's compliant