SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    cd /pub; more beer diacono's Avatar
    Join Date
    Dec 2000
    Location
    Horsham, West Sussex, UK
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <hey!>
    evilwalrus.com has got some usefull php stuff for ignorants like me who like to cut and paste. i got this from there:

    Code:
    <?
    
    function check_stat($uin) {
    	 $arr = @file("http://wwp.icq.com/scripts/online.dll?icq=$uin&img=1");
    	 $len = strlen($arr[1]);
    	 if ($len == "") return "1";
    	 if ($len == 96) return "2";
    	 if ($len == 83) return "3";
    	 if ($len == 1) return "4";
    }
    
    switch ($task) {
    
    case 'lookup':
    	if (check_stat($uin)=="1" OR "2"){
    	?>
    		<form action="<? print $PHP_SELF ?>" method="post">
    
    		<b>The ICQ Online-Message Panel</b><br><br>
    
    		<b>Sender Name</b> (optional):<br>
    		<input type="text" name="from" value="" size=15 maxlength=40><br>
    		<b>Sender EMail</b> (optional):<br>
    		<input type="text" name="fromemail" value="" size=15 maxlength=40><br>
    		
    		<input type="hidden" name="subject" value="PHP ICQ Jobbler!">
    		
    		Message:<br>
    		<textarea name="body" rows="3" cols="30" wrap="Virtual"></textarea>
    
    		<input type="hidden" name="to" value="<? print $uin; ?>">
    		<input type="hidden" name="task" value="send">
    		<input type="submit" name="Send" value="Send Message">  
    		<input type="reset" value="Clear">
    		</form>
    	<?} else {
    	?>
    		Moose!	
    	<?}
    break;
    
    case 'send':
    	mail($to . "@pager.icq.com", "$subject", "$body", "Return-path:$fromemail\nFrom: $from");
    	print "emailto:" . $to . "@pager.icq.com<br><br>\n\n";
    	print "subject:" . $subject . "<br><br>\n\n";
    	print "body:" . $body . "<br><br>\n\n";
    break;
    
    default:
    ?>
    
    <h1>ICQ Jobbler!</h1>
    <form method="post" action="<? print $PHP_SELF; ?>">
    <input type="text" name="uin">
    
    <input type="hidden" name="task" value="lookup">
    <input type="submit" value="Check that number!">
    </form>
    
    <?
    break;
    }
    but is'nt there something missing on the end?
    is it meant to end with a }?? or is the whole thing incomplete?

    let me know, i'm getting confused.

    <ahh!> last thing... do i just put my icq uin# stright into the code?

    nice one.

  2. #2
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code is complete.

    It's using a switch, which is similar to a if statement, just slightly different format:

    switch ($task)
    { // start of task

    case 'lookup':
    blah blah;
    break;

    } // end of task

    The two brackets tells it where the switch starts and finish, and for the cases, instead of brackets, it uses the :, and the break; instead.

    If it was a if statement, it'll look like:

    if ($lookup)
    {
    blah blah;
    }

    Alternatively, the if statement could also be written as the following, and it'll still work:

    if ($lookup):
    blah blah;
    endif;

    And for the uin, you'll just add $uin="[your ICQ number here]"

  3. #3
    cd /pub; more beer diacono's Avatar
    Join Date
    Dec 2000
    Location
    Horsham, West Sussex, UK
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice one Robo...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •