mIRC auto connect script generator for PHP

By Luke on Jul 17, 2010

Screenshots

This is my fist hawkee upload!

This script generates an auto connect script for the popular IRC client mIRC.

Please feel free to make suggestions + comments on this.

<head>
<script language="javascript"> 

var y = document.getElementById("nextID");
var field = y.value;
y.value++;

function addInput() { 
document.getElementById('text').innerHTML += "#<input type='text' value='' name='field[]' /><br />"; 
 } 
 </script> 
</head>
<?php
//Please do not remove the next line
// Script by Luke - http://lukeg.me.uk/ 
if ($_POST['add']) {

$nick = $_POST['nick'];
$nickpass = $_POST['nickpass'];
$network = $_POST['network'];
$networkad = $_POST['networkad'];
$extra = $_POST['extra'];
if (!$nick || !$nickpass || !$network || !$networkad || !$_POST['field']) {
die ("<h3>You must fill in all the fields</h3>");
}
?>
<h3>Copy and paste the following script into a the remotes tab in the script editor(Alt + r)</h3>
<textarea rows='10' cols='120'>
on *:CONNECT: { 
  if ($network == <?php echo $network; ?>) { /nick <?php echo $nick; ?> | /ns identify <?php echo $nickpass; ?> | /join <?php foreach($_POST['field'] as $value) { echo "#".$value.","; } ?> <?php if($extra) { echo "&nbsp;|&nbsp;"; echo $extra; } ?> } 
}

on *:START: { 
  /server <?php echo $networkad; ?>
<?php echo "\r\n"; ?>}
</textarea>

<?php
}
if ($_POST['add'] == $null || $_POST['add-chan']) {
?>
<h2>Auto Connect Script Generator for mIRC</h2>
<form action='scriptirc.php' method='POST'>
 <table border='0'>
 <tr><td>Network Name:</td> <td>&nbsp;&nbsp;<input type='text' name='network' value="<?php echo $_POST['network']; ?>"></td></tr> 
 <tr><td>Network Address:</td> <td>&nbsp;&nbsp;<input type='text' name='networkad' value="<?php echo $_POST['networkad']; ?>"></td></tr> 
  <tr><td>Nick:</td> <td>&nbsp;&nbsp;<input type='text' name='nick' value="<?php echo $_POST['nick']; ?>"></td></tr> 
  <tr><td>Nickserv Password:</td> <td>&nbsp;&nbsp;<input type='password' name='nickpass' value="<?php echo $_POST['nickpass']; ?>"></td></tr> 
  <tr><td>Channels to Join (One in each box):</td><td>
  <?php  foreach($_POST['field'] as $value) { echo "#<input type='text' value='".$value."' name='field[]'><br>"; } ?>
  <div id="text"> </div> <br><input type="submit" onclick="addInput()" name="add-chan" value="Add another channel" />
 <input type="hidden" id="nextID" value="1" /></td></tr> 
  <tr><td>Extra Commands? (Separated by |): <br><small>Ex. /mode $me +x | /join #chan</small></td>
   <td>&nbsp; <textarea rows='6' cols='35' name='extra' value="<?php echo $_POST['extra']; ?>"></textarea></td></tr>
  <tr><td><input type="submit" name="add" value="Submit"></td></tr>
</form>
<?php
}
?>

Comments

Sign in to comment.
xplo   -  Nov 27, 2011

what if you want to add multiple networks ? :)
(an option to "add network" and "add channels to Network" and "add login infos to Network"..)

challenging :)

 Respond  
Luke   -  Apr 09, 2011

Finally got round to updating the script now keeps the all the data you have added already when you click the "Add another channel" button also added a simple check to see if all of the fields have data in them.

  • except the extra field
<head>
<script language="javascript"> 

var y = document.getElementById("nextID");
var field = y.value;
y.value++;

function addInput() { 
document.getElementById('text').innerHTML += "#<input type='text' value='' name='field[]' /><br />"; 
 } 
 </script> 
</head>
<?php
//Please do not remove the next line
// Script by Luke - http://lukeg.me.uk/ 
if ($_POST['add']) {

$nick = $_POST['nick'];
$nickpass = $_POST['nickpass'];
$network = $_POST['network'];
$networkad = $_POST['networkad'];
$extra = $_POST['extra'];
if (!$nick || !$nickpass || !$network || !$networkad || !$_POST['field']) {
die ("<h3>You must fill in all the fields</h3>");
}
?>
<h3>Copy and paste the following script into a the remotes tab in the script editor(Alt + r)</h3>
<textarea rows='10' cols='120'>
on *:CONNECT: { 
  if ($network == <?php echo $network; ?>) { /nick <?php echo $nick; ?> | /ns identify <?php echo $nickpass; ?> | /join <?php foreach($_POST['field'] as $value) { echo "#".$value.","; } ?> <?php if($extra) { echo "&nbsp;|&nbsp;"; echo $extra; } ?> } 
}

on *:START: { 
  /server <?php echo $networkad; ?>
<?php echo "\r\n"; ?>}
</textarea>

<?php
}
if ($_POST['add'] == $null || $_POST['add-chan']) {
?>
<h2>Auto Connect Script Generator for mIRC</h2>
<form action='scriptirc.php' method='POST'>
 <table border='0'>
 <tr><td>Network Name:</td> <td>&nbsp;&nbsp;<input type='text' name='network' value="<?php echo $_POST['network']; ?>"></td></tr> 
 <tr><td>Network Address:</td> <td>&nbsp;&nbsp;<input type='text' name='networkad' value="<?php echo $_POST['networkad']; ?>"></td></tr> 
  <tr><td>Nick:</td> <td>&nbsp;&nbsp;<input type='text' name='nick' value="<?php echo $_POST['nick']; ?>"></td></tr> 
  <tr><td>Nickserv Password:</td> <td>&nbsp;&nbsp;<input type='password' name='nickpass' value="<?php echo $_POST['nickpass']; ?>"></td></tr> 
  <tr><td>Channels to Join (One in each box):</td><td>
  <?php  foreach($_POST['field'] as $value) { echo "#<input type='text' value='".$value."' name='field[]'><br>"; } ?>
  <div id="text"> </div> <br><input type="submit" onclick="addInput()" name="add-chan" value="Add another channel" />
 <input type="hidden" id="nextID" value="1" /></td></tr> 
  <tr><td>Extra Commands? (Separated by |): <br><small>Ex. /mode $me +x | /join #chan</small></td>
   <td>&nbsp; <textarea rows='6' cols='35' name='extra' value="<?php echo $_POST['extra']; ?>"></textarea></td></tr>
  <tr><td><input type="submit" name="add" value="Submit"></td></tr>
</form>
<?php
}
?>
 Respond  
F*U*R*B*Y*   -  Sep 26, 2010

on *:CONNECT: {
if ($network == ) { /nick | /ns identify | /join #,#,#,#,#,#,#,#, }
}

on *:START: {
/server
}

think you need to check to make sure boxes are entered with data.

 Respond  
Jonesy44   -  Jul 19, 2010

I suppose the patch to that would be to round up the current entered inputs into an array. create the new box and pop them all back in. Quick update though, nice one.

 Respond  
Luke   -  Jul 19, 2010

Well, I have edited again, the only thing I'm struggling on is if you press add channel button all the information you have added in other channel boxes are lost

Here is the updated code, I will also update it at the top

<head>
<script language="javascript"> 

var y = document.getElementById("nextID");
var field = y.value;
y.value++;

function addInput() { 
document.getElementById('text').innerHTML += "#<input type='text' value='' name='field[]' /><br />"; 
 } 
 </script> 
</head>
<?php
//Please do not remove the next line
// Script by Luke - http://lukeg.me.uk/ 
if ($_POST['add']) {
$nick = $_POST['nick'];
$nickpass = $_POST['nickpass'];
$network = $_POST['network'];
$networkad = $_POST['networkad'];
$chan1 = $_POST['chan1'];
$chan2 = $_POST['chan2'];
$chan3 = $_POST['chan3'];
$chan4 = $_POST['chan4'];
$chan5 = $_POST['chan5'];
$extra = $_POST['extra'];
?>
<h3>Copy and paste the following script into a the remotes tab in the script editor(Alt + r)</h3>
<textarea rows='10' cols='120'>
on *:CONNECT: { 
  if ($network == <?php echo $network; ?>) { /nick <?php echo $nick; ?> | /ns identify <?php echo $nickpass; ?> | /join <?php foreach($_POST['field'] as $value) { echo "#".$value.","; } ?> <?php if($extra) { echo "&nbsp;|&nbsp;"; echo $extra; } ?> } 
}

on *:START: { 
  /server <?php echo $networkad; ?>
<?php echo "\r\n"; ?>}
</textarea>

<?php
}
if ($_POST['add'] == $null) {
?>
<h2>Auto Connect Script Generator for mIRC</h2>
<form action='index.php' method='POST'>
 <table border='0'>
 <tr><td>Network Name:</td> <td>&nbsp;&nbsp;<input type='text' name='network'></td></tr> 
 <tr><td>Network Address:</td> <td>&nbsp;&nbsp;<input type='text' name='networkad'></td></tr> 
  <tr><td>Nick:</td> <td>&nbsp;&nbsp;<input type='text' name='nick'></td></tr> 
  <tr><td>Nickserv Password:</td> <td>&nbsp;&nbsp;<input type='password' name='nickpass'></td></tr> 
  <tr><td>Channels to Join (One in each box):</td><td> <div id="text"> </div> <br><input type="button" onclick="addInput()" name="add" value="Add another channel" /> (You will loose all current channels added sofar) 
 <input type="hidden" id="nextID" value="1" /></td></tr> 
  <tr><td>Extra Commands? (Separated by |): <br><small>Ex. /mode $me +x | /join #chan</small></td>
   <td>&nbsp; <textarea rows='6' cols='35' name='extra'></textarea></td></tr>
  <tr><td><input type="submit" name="add" value="Submit"></td></tr>
</form>
<?php
}
?>
 Respond  
Jonesy44   -  Jul 18, 2010

Sorry, right what i mean is, perhaps this will be a better way

on *:CONNECT: { 
  if ($network == irc.jonesy44.com) { /nick Jonesy44 | /ns identify pass | /join #1,#2,#3,#5,#5  | /msg TestBot hello } 
}

on *:START: { 
  /server J44}

you need to change the php so it will make

on *:CONNECT: { 
  if ($network == irc.jonesy44.com) { /nick Jonesy44 | /ns identify pass | /join #1,#2,#3,#5,#5  | /msg TestBot hello } 
}

on *:START: { 
  /server J44
}

"\r\n" is new line-feed that is, new line.

for the + box, i suppose you'd need javascript. If you're not comfortable with that no worries. or you could just have 1 box and say comma seperate them.

 Respond  
Luke   -  Jul 18, 2010

Thanks for the comment. I don't get what you mean about "And the on start cmd needs to have a new line \r\n in the php code so it works." Could you please give me an example of this and also of the + button for a new box.

 Respond  
Jonesy44   -  Jul 18, 2010

You also need a space between the "|" delimiter and extra commands. And the on start cmd needs to have a new line \r\n in the php code so it works.

 Respond  
Jonesy44   -  Jul 18, 2010

Aha nice idea. Not bad. You should perhaps think about making it like more.. general so you can have say unlimited channels with a + button for a new box.. that kinda thing.

 Respond  
Luke   -  Jul 18, 2010

Oh yes thanks for that, forgot to change the form to post to index.php, try again now

 Respond  
ChanZin   -  Jul 17, 2010

Not Found

The requested URL /autocongen/scriptirc.php was not found on this server.

xD

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.