Jump to content
vkg

Script php in HTML

Recommended Posts

Posted

Salut, am si eu un script , adica acesta:

<?php
$ftp_server = "Server";
$ftp_user_name = "User";
$ftp_user_pass = "Parola";

$last_modified = filemtime("/var/www/.....");
$now = strtotime("now");
$old = $now - $last_modified;
if($old > 3600)
{
$filename = "/var/www/.......";
unlink($filename);
$local_file = '/var/www/......';
$remote_file = '.................'; // aici pui toata adresa adica cand intrii pe ftp pana la server EX:client12/server12/samp/scriptfiles/loguri/nume.log
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
//echo "Successfully written to $local_file\n";
} else {
//echo "There was a problem\n";
}

ftp_close($conn_id);
}


echo "<table class='sample'><tr>
<td width='40px' class='title'>ID</td>
<td class='title' width='150px'>Admin</td>
<td width='200px' class='title'>Nume</td>
<td width='150px' class='title'>Motiv</td>
<td width='300px' class='title'>Data</td>
</tr>
";
$i=1;
if(!$file=fopen("var/www/..........","r")) die("Error reading housefile");
while (($data=fgetcsv($file,1024, ",")) !== FALSE)
{
$test = array(
"ID" => $i,
"Admin" => $data[0],
"Nume" => $data[1],
"Motiv" => $data[2],
"Data" => $data[3],
);
echo "<tr>";
foreach($test as $line => $v)
{
echo "<td><center><b><font size='1' face='Verdana' color='#ffffff'>" .$v. "</center></td>";
echo "</font></b>";
}
$i++;
echo "</tr>";
}
echo "
</table>";

?>

Este un cod pentru Ban List de la un server de samp, care sa arate un log pe o pagina HTML intr-un tabel, acum problema sta asa:

1. Cum pun acest script intr-o pagina HTML, sau cum fac cu rewrite incat sa aiva designul acela HTML si scriptul acesta.

2. Cum fac sa arate un .log in acel tabel, ce trebuie sa trec in loc de acele '...........' , nu prea ma pricep la PHP de aia am postat aici, astept sa vedem :) , cei care stiu FPT_GET mai bine, poate ma vor ajuta

Multumesc.

Posted

am si eu o problema cu o pagina html. este vorba despre o pagina a unui magazin de cumparaturi... vreau ca atunci cand , clientul apasa pe add to bag sa il redirectioneze pe o alta pagina pusa de mine . problema este ca in codul html al butonului add to bag nu exista href=".." . am incerat sa modific dar nu merge

ACESTA ESTE CODUL BUTONULUI : <ul class="form_navigation cf menu_inline">

<li><input id="btn_add_2_shop_cart" type="image" src="http://media.topman.com/wcsstore/ConsumerDirectStorefrontAssetStore/images/colors/color6/v2/btn_add_to_bag.gif" value="Add to shopping bag" /></li>

<li class="replace last">

<!-- ************** START ContinueShopping.jspf ************** --><a id="link_continue_shopping" class="rollover" href="http://www.topman.com/webapp/wcs/stores/servlet/CatalogNavigationSearchResultCmd?beginIndex=0&catalogId=33056&storeId=12555&langId=-1&viewAllFlag=false&sort_field=Relevance&categoryId=207200&parent_categoryId=207169&refinements=category~%5b207228%7c207200%5d&noOfRefinements=1&pageSize=20" title="Continue shopping">Continue shopping</a>

<!-- ************** END ContinueShopping.jspf ************** -->

</li>

</ul>

Posted
am si eu o problema cu o pagina html. este vorba despre o pagina a unui magazin de cumparaturi... vreau ca atunci cand , clientul apasa pe add to bag sa il redirectioneze pe o alta pagina pusa de mine . problema este ca in codul html al butonului add to bag nu exista href=".." . am incerat sa modific dar nu merge

ACESTA ESTE CODUL BUTONULUI : <ul class="form_navigation cf menu_inline">

<li><input id="btn_add_2_shop_cart" type="image" src="http://media.topman.com/wcsstore/ConsumerDirectStorefrontAssetStore/images/colors/color6/v2/btn_add_to_bag.gif" value="Add to shopping bag" /></li>

<li class="replace last">

<!-- ************** START ContinueShopping.jspf ************** --><a id="link_continue_shopping" class="rollover" href="http://www.topman.com/webapp/wcs/stores/servlet/CatalogNavigationSearchResultCmd?beginIndex=0&catalogId=33056&storeId=12555&langId=-1&viewAllFlag=false&sort_field=Relevance&categoryId=207200&parent_categoryId=207169&refinements=category~[207228|207200]&noOfRefinements=1&pageSize=20" title="Continue shopping">Continue shopping</a>

<!-- ************** END ContinueShopping.jspf ************** -->

</li>

</ul>

Butonul nu e prins intr-un <form > ?

Posted

Vreau sa te ajut, dar nu vreau sa ma chinui sa inteleg ce vrei sa faci. Fii mai explicit si o sa-ti ofer solutia.

Salut, am si eu un script , adica acesta:

<?php
$ftp_server = "Server";
$ftp_user_name = "User";
$ftp_user_pass = "Parola";

$last_modified = filemtime("/var/www/.....");
$now = strtotime("now");
$old = $now - $last_modified;
if($old > 3600)
{
$filename = "/var/www/.......";
unlink($filename);
$local_file = '/var/www/......';
$remote_file = '.................'; // aici pui toata adresa adica cand intrii pe ftp pana la server EX:client12/server12/samp/scriptfiles/loguri/nume.log
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
//echo "Successfully written to $local_file\n";
} else {
//echo "There was a problem\n";
}

ftp_close($conn_id);
}


echo "<table class='sample'><tr>
<td width='40px' class='title'>ID</td>
<td class='title' width='150px'>Admin</td>
<td width='200px' class='title'>Nume</td>
<td width='150px' class='title'>Motiv</td>
<td width='300px' class='title'>Data</td>
</tr>
";
$i=1;
if(!$file=fopen("var/www/..........","r")) die("Error reading housefile");
while (($data=fgetcsv($file,1024, ",")) !== FALSE)
{
$test = array(
"ID" => $i,
"Admin" => $data[0],
"Nume" => $data[1],
"Motiv" => $data[2],
"Data" => $data[3],
);
echo "<tr>";
foreach($test as $line => $v)
{
echo "<td><center><b><font size='1' face='Verdana' color='#ffffff'>" .$v. "</center></td>";
echo "</font></b>";
}
$i++;
echo "</tr>";
}
echo "
</table>";

?>

Este un cod pentru Ban List de la un server de samp, care sa arate un log pe o pagina HTML intr-un tabel, acum problema sta asa:

1. Cum pun acest script intr-o pagina HTML, sau cum fac cu rewrite incat sa aiva designul acela HTML si scriptul acesta.

2. Cum fac sa arate un .log in acel tabel, ce trebuie sa trec in loc de acele '...........' , nu prea ma pricep la PHP de aia am postat aici, astept sa vedem :) , cei care stiu FPT_GET mai bine, poate ma vor ajuta

Multumesc.

Posted

imi poti da ia id-ul tau pe pm ? ca sa iti dau pagina completa poate iti dai seama ? te rog frumos

cam asa ar arata tot codul : <script type="text/javascript"><!--

s.events="prodView,event2"

--></script>

<ul class="form_navigation cf menu_inline">

<li><input id="btn_add_2_shop_cart" type="image" src="http://media.topman.com/wcsstore/ConsumerDirectStorefrontAssetStore/images/colors/color6/v2/btn_add_to_bag.gif" value="Add to shopping bag" /></li>

<li class="replace last">

<!-- ************** START ContinueShopping.jspf ************** --><a id="link_continue_shopping" class="rollover" href="http://www.topman.com/webapp/wcs/stores/servlet/CatalogNavigationSearchResultCmd?beginIndex=0&catalogId=33056&storeId=12555&langId=-1&viewAllFlag=false&sort_field=Relevance&categoryId=207200&parent_categoryId=207169&refinements=category~%5b207228%7c207200%5d&noOfRefinements=1&pageSize=20" title="Continue shopping">Continue shopping</a>

<!-- ************** END ContinueShopping.jspf ************** -->

</li>

</ul>

<!-- Schway start --><!-- Schway End--><!-- End - JSP File Name: NewProductDisplaySizeQuantity.jsp -->

</form>

Posted

Bun am revenit cu inca 2 'probleme' ca nu sunt chiar niste probleme, mai mult niste idei, am si eu scriptul de mai sus, adica acesta:

<?php 
$ftp_server = "Server";
$ftp_user_name = "User";
$ftp_user_pass = "Parola";

$last_modified = filemtime("/var/www/.....");
$now = strtotime("now");
$old = $now - $last_modified;
if($old > 3600)
{
$filename = "/var/www/.......";
unlink($filename);
$local_file = '/var/www/......';
$remote_file = '.................'; // aici pui toata adresa adica cand intrii pe ftp pana la server EX:client12/server12/samp/scriptfiles/loguri/nume.log
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
//echo "Successfully written to $local_file\n";
} else {
//echo "There was a problem\n";
}

ftp_close($conn_id);
}


echo "<table class='sample'><tr>
<td width='40px' class='title'>ID</td>
<td class='title' width='150px'>Admin</td>
<td width='200px' class='title'>Nume</td>
<td width='150px' class='title'>Motiv</td>
<td width='300px' class='title'>Data</td>
</tr>
";
$i=1;
if(!$file=fopen("..........","r")) die("Error reading housefile");
while (($data=fgetcsv($file,1024, ",")) !== FALSE)
{
$test = array(
"ID" => $i,
"Admin" => $data[0],
"Nume" => $data[1],
"Motiv" => $data[2],
"Data" => $data[3],
);
echo "<tr>";
foreach($test as $line => $v)
{
echo "<td><center><b><font size='1' face='Verdana' color='#ffffff'>" .$v. "</center></td>";
echo "</font></b>";
}
$i++;
echo "</tr>";
}
echo "
</table>";

?>

Toate bune si frumoase, merge perfect, dupa cateva ore, chiar zile de munca, am reusit sa il fac sa il aranjez si sa il pun in functiune, ok, acum am si eu 2 nelamuriri ca sa zic asa:

1. Deci scriptul acesta face defapt sa ia datele dintr-un fisier de pe un Game Host (Samp mai precis) si sa le aduca pe alt fisier (Numit de mine) pe un Webhost , de aici datele sunt aratate pe un site intr-un tabel, ce vreau eu sa fac defapt ? Pai as vrea ca datele care le extrage din acel fisier sa nu le arate in tabel cum sunt in fisier (de sus in jos) as vrea sa le ia invers adica cele mai noi date sus si cele mai vechi jos, sper ca m-ati inteles

2. Vreau sa pun un script de paginare care la anumite randuri in tabelul acela sa se creeze o noua pagina (Automat bineinteles) sa nu fie fisiere diferite, doar ceva simplu care sa nu treaca dintr-un fisier in altul...

  • Moderators
Posted

Pentru prima chestie

<?php 
$ftp_server = "Server";
$ftp_user_name = "User";
$ftp_user_pass = "Parola";

$last_modified = filemtime("/var/www/.....");
$now = strtotime("now");
$old = $now - $last_modified;
if($old > 3600)
{
$filename = "/var/www/.......";
unlink($filename);
$local_file = '/var/www/......';
$remote_file = '.................'; // aici pui toata adresa adica cand intrii pe ftp pana la server EX:client12/server12/samp/scriptfiles/loguri/nume.log
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
//echo "Successfully written to $local_file\n";
} else {
//echo "There was a problem\n";
}

ftp_close($conn_id);
}


echo "<table class='sample'><tr>
<td width='40px' class='title'>ID</td>
<td class='title' width='150px'>Admin</td>
<td width='200px' class='title'>Nume</td>
<td width='150px' class='title'>Motiv</td>
<td width='300px' class='title'>Data</td>
</tr>
";
$i=1;
if(!$file=fopen("..........","r")) die("Error reading housefile");
$strings = "";
while (($data=fgetcsv($file,1024, ",")) !== FALSE)
{
$test = array(
"ID" => $i,
"Admin" => $data[0],
"Nume" => $data[1],
"Motiv" => $data[2],
"Data" => $data[3],
);
$stringv = "<tr>";
foreach($test as $line => $v)
{

$stringv = $stringv . "<td><center><b><font size='1' face='Verdana' color='#ffffff'>" .$v. "</font></b></center></td>";
}
$i++;
$stringv = $stringv . "</tr>\n";
$strings = $stringv . $strings;
}
echo $strings . "
</table>";

?>

Posted
Pentru prima chestie

<?php 
$ftp_server = "Server";
$ftp_user_name = "User";
$ftp_user_pass = "Parola";

$last_modified = filemtime("/var/www/.....");
$now = strtotime("now");
$old = $now - $last_modified;
if($old > 3600)
{
$filename = "/var/www/.......";
unlink($filename);
$local_file = '/var/www/......';
$remote_file = '.................'; // aici pui toata adresa adica cand intrii pe ftp pana la server EX:client12/server12/samp/scriptfiles/loguri/nume.log
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
//echo "Successfully written to $local_file\n";
} else {
//echo "There was a problem\n";
}

ftp_close($conn_id);
}


echo "<table class='sample'><tr>
<td width='40px' class='title'>ID</td>
<td class='title' width='150px'>Admin</td>
<td width='200px' class='title'>Nume</td>
<td width='150px' class='title'>Motiv</td>
<td width='300px' class='title'>Data</td>
</tr>
";
$i=1;
if(!$file=fopen("..........","r")) die("Error reading housefile");
$strings = "";
while (($data=fgetcsv($file,1024, ",")) !== FALSE)
{
$test = array(
"ID" => $i,
"Admin" => $data[0],
"Nume" => $data[1],
"Motiv" => $data[2],
"Data" => $data[3],
);
$stringv = "<tr>";
foreach($test as $line => $v)
{

$stringv = $stringv . "<td><center><b><font size='1' face='Verdana' color='#ffffff'>" .$v. "</font></b></center></td>";
}
$i++;
$stringv = $stringv . "</tr>\n";
$strings = $stringv . $strings;
}
echo $strings . "
</table>";

?>

daca tot ai pus o parte a tabelului pe $strings de ce nu ai pus si prima parte? e un output in plus primul echo + partea cu atribuire $stringv cu tr (use ' '), partea cu fondurile nu are ce cauta se face css

Posted

Mersi frumos, merge, dar acum as vrea sa stiu cum fac sa arate ID normal, adica acum arata id-urile asa:

98

97

96

95

etc

Vreau sa le arate normal

1

2

3

4

5

etc ..

  • Moderators
Posted (edited)
Mersi frumos, merge, dar acum as vrea sa stiu cum fac sa arate ID normal, adica acum arata id-urile asa:

98

97

96

95

etc

Vreau sa le arate normal

1

2

3

4

5

etc ..

Se face cu salvarea intr-un vector cu array_push a liniilor cu <td></td> de la Admin, Nume, Motiv, Data si apoi, cu un for $i de la 0 la count($vector) - 1, se afiseaza $i+1 si $vector[$i] .

Paginatia o poti face cu o sesiuni.

Edited by Dragos
Posted

<?php
$array = array(52=>"php",97=>"c/c++",2=>"python",123=>"perl");
print_r($array);
// va afisa:
//Array ( [52] => php [97] => c/c++ [2] => python [123] => perl )
$new_array = array_values($array);
print_r($new_array);
// va afisa
//Array ( [0] => php [1] => c/c++ [2] => python [3] => perl )
?>

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.



×
×
  • Create New...