ho due file in php, come faccio a passare le variabili da un php all'altro in automatico e senza farlo vedere all'utente?
grazie
ho due file in php, come faccio a passare le variabili da un php all'altro in automatico e senza farlo vedere all'utente?
grazie
------------------
georado
www.georado.it
devi usare le sessioni:
www.php.net/session_start
![]()
think simple think ringo
puoi farmi un esempio pratico?
cioè in effetti potresti postarmelo!
tipo primo file php------
variabile 1......
variabile 2......
secondo file php-----
prendi variabile 1.....
prendi variabile 2.....
------------------
georado
www.georado.it
File1.phpOriginariamente inviato da georado
puoi farmi un esempio pratico?
cioè in effetti potresti postarmelo!
tipo primo file php------
variabile 1......
variabile 2......
secondo file php-----
prendi variabile 1.....
prendi variabile 2.....
File2.phpcodice:session_start(); \\inizializza la sessione $_SESSION['chiave'] = 'testo'; //L'array di sessione è $_SESSION print "Avanti..."; //un semplice collegamento
Cerca tra le pillole del forum e sugli articoli di freephp.html.it e poi dai un'occhiata acodice:session_start(); \\Recupera le variabili di sessione o ne inizia una nuova print $_SESSION['chiave']; //stampa una variabile di sessione
http://www.php.net/session
![]()
ti posto i file in php perchè non so dove inserire
-----------------------------------------------
PRIMO FILE IN PHP
-----------------------------------------------
<?php
//VARIABILI DEL FORM
$dom = $_POST['dominio'];
$ext = $_POST['extension'];
if ($ext == 'com'){
$domname = "$dom.com";
$ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
$result = '';
while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
if (eregi('Can\'t get information',$result)) { available($domname); } else { unavailable($domname,'whois.opensrs.net'); }
}
if ($ext == 'net'){
$domname = "$dom.net";
$ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
$result = '';
while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
if (eregi('Can\'t get information',$result)) { available($domname); } else { unavailable($domname,'whois.opensrs.net'); }
}
if ($ext == 'org'){
$domname = "$dom.org";
$ns = fsockopen('whois.publicinterestregistry.com',43); fputs($ns,"$domname\r\n");
$result = '';
while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
if (eregi('NOT FOUND',$result)) { available($domname); } else { unavailable($domname,'whois.publicinterestregistry .com'); }
}
if ($ext == 'info'){
$domname = "$dom.info";
$ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
$result = '';
while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
if (eregi('Not found',$result)) { available($domname); } else { unavailable($domname,'whois.opensrs.net'); }
}
if ($ext == 'biz'){
$domname = "$dom.biz";
$ns = fsockopen('whois.nic.biz',43); fputs($ns,"$domname\r\n");
$result = '';
while(!feof($ns)) $result .= fgets($ns,128); fclose($ns);
if (eregi('Not found',$result)) { available($domname); } else { unavailable($domname,'whois.nic.biz'); }
}
function available($dominio){
?>
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" height="30" valign="middle" align="center" style="font-family: Verdana"><?php echo "Il dominio "$dominio" è DISPONIBILE."; echo $whois; ?></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" valign="middle" align="center" style="font-family: Verdana"><div
align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="300">
<tr>
<td width="50%" valign="middle" align="center" height="30"><input TYPE="button"
VALUE="Indietro" onClick="javascript:history.back(1)"
style="color:#000000;font:tahoma;font-size:10pt;width:100;height:20;border-color:F6E3AA;border-width:1;background-color:F8C838;cursor:hand"></td>
<td width="50%" valign="middle" align="center" height="30"><input TYPE="button"
VALUE="Acquista"
onClick="hosting=window.open('http://www.georado.it','hosting','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes ,resizable=no,left=0,top=0,width=516,height=500'); return false;"
style="color:#000000;font:tahoma;font-size:10pt;width:100;height:20;border-color:F6E3AA;border-width:1;background-color:F8C838;cursor:hand">
</td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</body>
</html>
<?php
exit();
}
function unavailable($dominio){
?>
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" height="30" valign="middle" align="center" style="font-family: Verdana"><?php echo "Il dominio "$dominio" non è Disponibile."; echo $whois; ?></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" valign="middle" align="center" style="font-family: Verdana"><div
align="center"><center><table border="0" cellpadding="0" cellspacing="0" width="300">
<tr>
<td width="50%" valign="middle" align="center" height="30"><input TYPE="button"
VALUE="Indietro" onClick="javascript:history.back(1)"
style="color:#000000;font:tahoma;font-size:10pt;width:100;height:20;border-color:F6E3AA;border-width:1;background-color:F8C838;cursor:hand"></td>
<td width="50%" valign="middle" align="center" height="30"><input TYPE="button"
VALUE="Whois"
onClick="dominio_whois=window.open('http://www.georado.it/whois/dominio_whois.php','dominio_whois','toolbar=no,loc ation=no,directories=no,status=no,menubar=no,scrol lbars=yes,resizable=no,left=0,top=0,width=400,heig ht=400'); return false;"
style="color:#000000;font:tahoma;font-size:10pt;width:100;height:20;border-color:F6E3AA;border-width:1;background-color:F8C838;cursor:hand">
</td>
</tr>
</table>
</center></div></td>
</tr>
</table>
</body>
</html>
<?php
exit();
}
?>
-------------------------------------------
SECONDO FILE IN PHP
--------------------------------------------
<?php
//VARIABILI DEL FORM
$dom = $_POST['dominio'];
$ext = $_POST['extension'];
if ($ext == 'com'){
$domname = "$dom.com";
echo "<pre>\n";
$ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
while(!feof($ns))
{
$result = fgets($ns,128);
echo $result;
}
fclose($ns);
echo "</pre>\n";
}
if ($ext == 'net'){
$domname = "$dom.net";
echo "<pre>\n";
$ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
while(!feof($ns))
{
$result = fgets($ns,128);
echo $result;
}
fclose($ns);
echo "</pre>\n";
}
if ($ext == 'org'){
$domname = "$dom.org";
echo "<pre>\n";
$ns = fsockopen('whois.publicinterestregistry.com',43); fputs($ns,"$domname\r\n");
while(!feof($ns))
{
$result = fgets($ns,128);
echo $result;
}
fclose($ns);
echo "</pre>\n";
}
if ($ext == 'info'){
$domname = "$dom.info";
echo "<pre>\n";
$ns = fsockopen('whois.opensrs.net',43); fputs($ns,"$domname\r\n");
while(!feof($ns))
{
$result = fgets($ns,128);
echo $result;
}
fclose($ns);
echo "</pre>\n";
}
if ($ext == 'biz'){
$domname = "$dom.biz";
echo "<pre>\n";
$ns = fsockopen('whois.nic.biz',43); fputs($ns,"$domname\r\n");
while(!feof($ns))
{
$result = fgets($ns,128);
echo $result;
}
fclose($ns);
echo "</pre>\n";
}
?>
-----------------------------------
devo passare inserire???
pagina html è questa
http://www.georado.it/whois/dominio_status.html
------------------
georado
www.georado.it
in quale punto devo inserire le variabili?
------------------
georado
www.georado.it