Can you help please? Php file
         
               Posted on 
16th Feb 2014 07:03 pm by  
admin
        
        I have to write this php file to allow users to register their nicknames on nickserv
For an IRC server, however it worked fine for a couple of years, I then upgraded from Php4 to Php5 and suddenly nothing works.
If I use "register_global" on it still works but if I turn the RG off I get either a blank page or if I add the following line to show me what the error is:
Code: error_reporting(E_ALL);
ini_set('display_errors', 'On');
I get 4 Undefined variables.
And If I define the variables at the beginning of the script, I get the blank page again.
Here is the script, and I hope somebody can give me some clues on what I should do.
Thanks
Code: <?php 
error_reporting(E_ALL);
ini_set('display_errors', 'On');
// Adresse de Connexion du Serveur 
$serv="irc.someserver.org"; 
// Port du Serveur 
$port="6667"; 
// Pseudo de NickServ 
$nickserv="NickServ"; 
// Message de quit 
$messquit="Enregistrement sous $nickserv Ok !!!"; 
if($create) 
    { 
    $pseudo1=stripslashes($pseudo); 
    $motpass1=stripslashes($motpass); 
    $email1=stripslashes($email); 
    $fp=fsockopen("$serv","$port"); 
    fputs($fp,"USER $pseudo1 $pseudo1 $pseudo1 :$pseudo1 rn"); 
    fputs($fp,"NICK $pseudo1 rn"); 
    //while($data=fgets($fp,1024)) 
     while($data=fgets($fp,2046))
        { 
        if(ereg("PING",$data)) 
            { 
            $ping = explode(":",$data); 
            $reply = $ping[1]; 
            fputs($fp,"PONG $replynr"); 
            } 
        elseif(ereg("433",$data)) 
            { 
            fputs($fp,"QUIT : Pseudo used rn"); 
            header("location:nickserv.php?used=1&pseudo=$pseudo1"); 
            } 
        elseif(ereg("MODE",$data)) 
            { 
            fputs($fp,"PRIVMSG $nickserv : register $motpass1 $email1 rn"); 
            fputs($fp,"QUIT : $messquit rn"); 
            header("location:nickserv.php?result=1&pseudo=$pseudo1&motpass=$motpass1&email=$email1"); 
            } 
        } 
    } 
print("<html><head><title>Register nickname with $nickserv</title></head><body>");     
// 
// Verification du formulaire 
//
print("<script language="javascript">n"); 
print("function verife()n"); 
print("{n"); 
print("if (document.formu.pseudo.value.length == 0)n"); 
print("{n"); 
print("alert("Votre Pseudo...");n"); 
print("return false;n"); 
print("}n"); 
print("if (document.formu.motpass.value.length == 0)n"); 
print("{n"); 
print("alert("Votre Mot de Passe...");n"); 
print("return false;n"); 
print("}n"); 
print("if (document.formu.email.value.length == 0)n"); 
print("{n"); 
print("alert("Votre E-mail...");n"); 
print("return false;n"); 
print("}n"); 
print("return true;n"); 
print("}n"); 
print("</script>n"); 
if($debut == 1) 
    { 
    print("<center>Enregistrement de votre pseudo sous $nickserv
"); 
    print("<form name="formu" OnSubmit="return verife()" action="nickserv.php?create=1" method="post">"); 
    print("Votre Pseudo
<input type="text" name="pseudo" size="30" maxlength="30">
"); 
    print("Your Password ( min : 5 letters ) 
<input type="text" name="motpass" size="30" maxlength="30">
"); 
    print("Votre E-mail
<input type="text" name="email" size="30" maxlength="30">
"); 
    print("<input type="submit" value="Enregistrer">"); 
    print("</form></center>"); 
    } 
if($result== 1) 
    { 
    $ps=stripslashes($pseudo); 
    $ps=htmlspecialchars("$ps", ENT_QUOTES); 
    $pa=stripslashes($motpass); 
    $pa=htmlspecialchars("$pa", ENT_QUOTES); 
    $em=stripslashes($email); 
    $em=htmlspecialchars("$em", ENT_QUOTES); 
    print("<center>Votre Pseudo a bien ete enregistre.
"); 
    print("Pseudo : $ps
"); 
    print("Mot de Passe : $pa
"); 
    print("E-mail : $em
<a href="nickserv.php?debut=1">Retour...</a></center>"); 
    } 
if($used== 1) 
    { 
    $ps=stripslashes($pseudo); 
    $ps=htmlspecialchars("$ps", ENT_QUOTES); 
    print("<center>$ps est online sur le serveur.
<a href="nickserv.php?debut=1">Retour...</a></center>"); 
    } 
print("</body></html>"); 
?> 
If anyone can give some answers, I would really appreciate it, I promise you I have tried almost anything you can think of, remember this script did work for nearly 3 years without a problem.
Thank you       
      
       
		No comments posted yet	
	Your Answer:
	        Login to answer
        
288  
 50 
 
    
    
 
Other forums
Basic Forum Tutorial 
Hi, I'm new to PHP.  I want to build a basic forum for my site using PHP and MySQL.  I've searched t
Operating System 
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate, 
script is pulling more then they have.... 
I have this script for my game where they can change there race. This will cost them 2,500 points. H
Help with PHP Email Script 
Hi guys,
I'm a newbie to php and need help with the script below:
At the moment when I
php is not recognized as an internal or external command 
Hello,
I am trying to bake the code in CakePHP through my console.
I have changed my Path 
PHP header help! 
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48
Retrieving the 25 most recently added entries from all tables in a MySQL databas 
Hello,
The code below works great. It creates a table that shows the 25 most recently added t
urldecode question 
How would I format this line of code properly?
<?php echo urldecode($_GET['Title']); ?
php forms and database navigatio 
Hello,
I'm new to php and i'd like to post the following.
I have written code to get records f
License Issue - service type user 
Hi,
I would like to understand the following issue regarding sap license.
I wish to