You are not logged in.

wcf.regNote.message

Gareth

Beginner

  • "Gareth" started this thread

Posts: 3

Location: Rhede

  • Send private message

1

Thursday, August 11th 2005, 8:38am

ein problem mit einem vergleich !

HUHU

also das wird nun ein riesiges posting aber ich weis nicht mehr weiter und brauch hilfe ;)

folgendes problem habe ich :) ich möchte ein bestimmtes bild einer bestimmten person durch eine abfrage eines bestimmten feldes in einem bestimmten block anzeigen.

dazu brauche ich drei dateien die ich euchhier posten werde.

datei nummer eins :

das ist die shoutcastinfo.php sie befindet sich in meinem protal in dem include ordner dort werden die abfragen geregelt aus dem shoutcast modul



um nun das zu erreichen was ich will muss ich das feld aim abfragen

also werde ich nunhier posten die schoutcastinfo.php die ist für diese abfragen zuständig:

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<?php
/***************************************************************************
 *                            ShoutcastInfo Class
 *                            -------------------
 *   begin                : Wednesday, Aug 18, 2004 - 4:12
 *   copyright            : (C) 2004 Florian Breit
 *   email                : support@mcb.cc - MCB.CC - Free and Open Sources
 *   last modified        : 18/08/04 - 06:26 - MC Breit
 *   version              : 0.0.2
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

//
// Begin ShoutcastInfo class.
//


class ShoutcastInfo
{

  //
  // Begin of class variables
  //

  /*****
  * @var $sock
  * contains the socket handler.
  */
  var $sock FALSE;
  
  /*****
  * @var $error
  * saves errorstr and numbers as array(no,str)
  */
  var $error = array(NULLNULL);
  
  /*****
  * @var $host
  * contains the hostname for shoutcast server
  */
  var $hostname NULL;
  
  /*****
  * @var $port
  * contains the port used for connection
  */
  var $port NULL;
  
  /*****
  * @var $timeout
  * the timeout for connection
  */
  var $timeout NULL;
  
  /*****
  * @var $parsed
  * is true when datas where parsed
  */
  var $parsed FALSE;
  
  /****
  * @var $datas
  * contains the unparsed datas
  */
  var $datas NULL;
  
  /*****
  * @var $pdatas
  * assitioative array of parsed datas
  */
  var $pdatas NULL;
  
  //
  // Begin of class functions
  //
  
  /*****
  * object ShoutcastInfo(string hostname [, int port [, int timeout])
  * Crates an new Shoutcast Object. (Is the Class Creator)
  */
  function ShoutcastInfo($hostname$port=8888$timeout=30)
  {
    $this->hostname $hostname;
    $this->port $port;
    $this->timeout $timeout;
  } // ShoutcastInfo()
  
  //
  // Begin of socket and connection functions
  //
  
  /*****
  * bool connect( void )
  * creates server connection, returns true on success, else retruns false.
  */
  function connect()
  {
    if( !$this->sock )
    {
      //Connect
      $this->sock fsockopen($this->hostname$this->port$this->error[0] , $this->error[1], $this->timeout);
    }
    
    //Check connection
    if( $this->sock )
    {
      return TRUE;
    }
    else
    {
      return FALSE;
    }
  } // connect()
  
  /*****
  * bool close( void )
  * closes current connection
  */
  function close()
  {
    if( $this->sock )
    {
      fclose($this->sock);
    }
  } // close()
  
  /*****
  * bool refresh( void )
  * closes connection and opens it again to get new datas.
  * parsed datas will not replaced, but parsing will be
  * able again.
  */
  function refresh()
  {
    $this->close();
    $this->sock NULL;
    if( !$this->connect() )
    {
      return FALSE;
    }
    $this->parsed FALSE;
    $this->send();
    return TRUE;
  } // refresh()
  
  /*****
  * void send( void )
  * Sends http header and recives datas from server
  */
  function send()
  {
    if( $this->sock )
    {
      //Send HTTP Header
      fputs($this->sock"GET / HTTP/1.0\r\n"
                        ."Host: 127.0.0.1\r\n"
                        ."User-Agent: Mozilla/4.0 (compatible; ShoutCastInfoClass/0.0.2; ".PHP_OS.")\r\n"
                        ."\r\n"
           );
           
      //Get datas
      $this->datas NULL;
      while( !feof($this->sock) )
      {
          $this->datas .= fgets($this->sock128);
      }
    }
  } // send()
  
  /*****
  * mixed error( [bool return])
  * if return is true it will return a error message,
  * else it will print it out (HTML Formatted!).
  */
  function error($return=FALSE)
  {
    if( $return == FALSE )
    {
      print "<br><b>Error:</b> {$this->error[1]} (<i>{$this->error[0]}</i>)<br>";
      return;
    }
    return "{$this->error[1]} ({$this->error[0]})";
  }
  
  //
  // Begin of public functions
  //
  
  /*****
  * bool get_stat( void )
  * Checks that stream will be up and private/public. 
  */
  function get_stat()
  {
    if( strstr($this->datas'Server is currently up and') )
    {
      $this->pdatas['status'] = 1;
      return TRUE;
    }
    else
    {
      $this->pdatas['status'] = 0;
      return FALSE;
    }
  } // get_stat()
  
  /*****
  * integer get_listener( void )
  * returns and resets the number of accutal listener.
  */
  function get_listener()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['listener'] = 0;
      return 0;
    }
    
    $this->pdatas['listener_max'] = explode('kbps with <B>'$this->datas);
    $this->pdatas['listener'] = explode(' of '$this->pdatas['listener_max'][1]);
    $this->pdatas['listener_max'] = $this->pdatas['listener'][1];
    $this->pdatas['listener'] = $this->pdatas['listener'][0];
    $this->pdatas['listener_max'] = explode(' l'$this->pdatas['listener_max']);
    $this->pdatas['listener_max'] = $this->pdatas['listener_max'][0];
    
    return $this->pdatas['listener'];
  } // get_listener()
  
  /*****
  * integer get_peak( void )
  * returns the listener peak from stream and resets it.
  */
  function get_peak()
  {
    $this->pdatas['peak'] = $this->_extract_datas('Listener Peak: </font></td><td><font class=default><b>');
    return $this->pdatas['peak'];
  } // get_peak()
  
  /*****
  * string get_title( void )
  * returns and resetts the actual moderator/dj/stream_title at stream.
  */
  function get_title()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['title'] = FALSE;
      return FALSE;
    }
    
    $this->pdatas['title'] = $this->_extract_datas('Stream AIM: </font></td><td><font class=default><b><a href="aim:goim?screenname=''"');
    return $this->pdatas['title'];
  } // get_title()
  
  /*****
  * string get_content_type( void )
  * returns and resetts the actual ContentType at stream.
  */
  function get_content_type()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['content_type'] = FALSE;
      return FALSE;
    }
  
    $this->pdatas['content_type'] = $this->_extract_datas('Content Type: </font></td><td><font class=default><b>');
    return $this->pdatas['content_type'];
  } // get_content_type()
  
  /*****
  * string get_genre( void )
  * returns and resetts the actual Stream Genre.
  */
  function get_genre()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['genre'] = FALSE;
      return FALSE;
    }
  
    $this->pdatas['genre'] = $this->_extract_datas('Stream Genre: </font></td><td><font class=default><b>');
    return $this->pdatas['genre'];
  } // get_genre()
  
  /*****
  * string get_url( void )
  * returns and resetts the actual Stream URL.
  */
  function get_url()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['url'] = 'none';
      return 'none';
    }
  
    $this->pdatas['url'] = $this->_extract_datas('Stream URL: </font></td><td><font class=default><b><a href="''"');
    return $this->pdatas['url'];
  } // get_url()
  
  /*****
  * string get_icq( void )
  * returns and resetts the actual Stream ICQ.
  */
  function get_icq()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['icq'] = FALSE;
      return FALSE;
    }
  
    $this->pdatas['icq'] = $this->_extract_datas('ICQ: </font></td><td><font class=default><b><a href="http://wwp.icq.com/scripts/contact.dll?msgto=''"');
    //ICQ is aviable?
    $this->pdatas['icq'] = ( $this->pdatas['icq'] == 'NA' ) ? FALSE $this->pdatas['icq'];
    return $this->pdatas['icq'];
  } // get_icq()
  
  /*****
  * string get_aim( void )
  * returns and resetts the actual Stream AIM.
  */
  function get_aim()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['aim'] = FALSE;
      return FALSE;
    }
  
    $this->pdatas['aim'] = $this->_extract_datas('AIM: </font></td><td><font class=default><b><a href="aim:goim?screenname=''"');
    //AIM is aviable?
    $this->pdatas['aim'] = ( $this->pdatas['aim'] == 'NA' ) ? FALSE $this->pdatas['aim'];
    return $this->pdatas['aim'];
  } // get_aim()
  
  /*****
  * string get_irc( void )
  * returns and resetts the actual Stream IRC.
  * Note: This often is not a valid form of URL!
  */
  function get_irc()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['irc'] = FALSE;
      return FALSE;
    }
  
    $this->pdatas['irc'] = $this->_extract_datas('Stream IRC: </font></td><td><font class=default><b><a href="');
    $this->pdatas['irc'] = strstr($this->pdatas['irc'], '">');
    $this->pdatas['irc'] = substr($this->pdatas['irc'], 2);
    return $this->pdatas['irc'];
    
  } // get_irc()
  
  /*****
  * string get_track( void )
  * returns and resetts the current track informations.
  */
  function get_track()
  {
    //Is stream up?
    if( $this->pdatas['status'] == )
    {
      $this->pdatas['track'] = FALSE;
      return FALSE;
    }
  
    $this->pdatas['track'] = $this->_extract_datas('Current Song: </font></td><td><font class=default><b>');
    return $this->pdatas['track'];
    
  } // get_track()
  
  /*****
  * array parse( void )
  * get all the items aviable and return an assoc array.
  * Note: Use this only if you need ALL the informations!
  */
  function parse()
  {
    if( $this->parsed != TRUE )
    {
      //get all single infos
      $this->get_stat();
      $this->get_listener();
      $this->get_peak();
      $this->get_title();
      $this->get_content_type();
      $this->get_genre();
      $this->get_url();
      $this->get_icq();
      $this->get_aim();
      $this->get_irc();
      $this->get_track();
      //set parsed stat
      $this->parsed TRUE;
    }
    return $this->pdatas;
    
  } // parse()
  
  /*****
  * mixed get_parsed_value( string key )
  * Sucht aus dem geparsten array einen wert herraus und gibt ihn zurück
  * wenn er noch nicht gesetzt ist wird NULL zurückgegeben.
  */
  function get_parsed_value($key)
  {
    return ( isset($this->pdatas[$key]) ) ? $this->pdatas[$key] : FALSE;
    
  } // get_parsed_value()
  
  //
  // Begin private functions
  //
  
  /*****
  * private mixed _extract_datas(string match_str [, string ending])
  * extracts and returns datas after an match_string and before net html tag or ending.
  */
  function _extract_datas($match_str$ending='<')
  {
    $datas strstr($this->datas$match_str);
    //remove match_str because strstr starts before..
    $datas str_replace($match_str''$datas);
    //split text after ending mark and throw all away isnt needed.
    $datas explode($ending$datas);
    return $datas[0];
    
  } // _extract_datas()

// ShoutcastInfo class

//
// Thats it folks!
//

?>


ziemlich unten findet ihr nun die funktion get aim :)


jut also nun habe dich die datei die den block anzeigen soll als nächstes :)

die funktioniert nun auch schon soweit bis auf ein kleine kleinigkeit das bild wir darinnicht angezeigt , was ich alledings gerne haben möchte :)

also hier nun die datei zum anzeigen ganz unten ist dann zu sehen die abfrage des aim feldes.

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php



if (stristr($_SERVER['SCRIPT_NAME'], "block-Unbeatable.php"))
{
    Header("Location: index.php");
    die();
}

// Set your server info here
$rtitle "";
$scservername "213.202.247.19";
$scserverport1 10000;
$scserverport2 10050;
$scserverport3 10025;
$servertimeout 2;
// End settings

include_once('includes/shoutcastinfo.php');
$content .= "<table width=\"100%\" border=\"0\" cellpadding=\"2\">";
$scs = &new ShoutcastInfo($scservername$scserverport1$servertimeout);
if( !$scs->connect() )
{
    $error TRUE;
    $errtxt $scs->error();
}
if( $error != TRUE )
{
    $scs->send();
    if( !$scs->get_stat() )
    {
        $content .= "<tr><td colspan=\"4\"><div align=\"center\"><img src=\"images/blocks/banner_unbeatable.gif\" alt=\"Der Server ist offline\" border=\"0\" /></div></td></tr>";
    }
    else
    {
        $track $scs->get_track();
        if ($track == ""$track "Keine Titelinformation verfügbar";
        $content .= "<tr><td colspan=\"4\"><div align=\"center\"><a href=\"http://www.un-beat-able.de/modules.php?name=Sendeplan\"><img src=\"images/blocks/banner_unbeatable.gif\" alt=\"Bitte klicken für den Sendeplan !\" border=\"0\" /></a></div></td></tr>";
        $content .= "<tr><td colspan=\"4\">&nbsp;</td></tr>";
        $content .= "<tr><td colspan=\"4\"><center><b>Jetzt reinhören!</center></b></td></tr>";
        $content .= "<tr><td><b>DSL:</b></td><td><div align=\"center\"><a href=\"http://$scservername:$scserverport1/listen.pls\"><img src=\"images/blocks/winamp.gif\" align=\"bottom\" alt=\"Anhören mit WinAmp\" border=\"0\" /></a></div></td><td><div align=\"center\"><a href=\"http://www.un-beat-able.de/Unbeatable-DSL.ram\"><img src=\"images/blocks/realplayer.gif\" border=\"0\" alt=\"Anhören mit Realplayer\"></a></div></td><td><div align=\"center\"><a href=\"http://www.un-beat-able.de/Unbeatable-DSL.wax\"><img src=\"images/blocks/mediaplayer.gif\" align=\"bottom\" alt=\"Anhören mit MediaPlayer\" border=\"0\" /></a></div></td></tr>";
        $scs->close();
        $scs = &new ShoutcastInfo($scservername$scserverport2$servertimeout);
        if( !$scs->connect() )
        {
            $error TRUE;
            $errtxt $scs->error();
        }
        if( $error != TRUE )
        {
            $scs->send();
            if( !$scs->get_stat() )
            {
                $content .= "<tr><td colspan=\"4\"><center>ISDN-Server offline<br /><br /></center></td></tr>";
            }
            else
            {
                $content .= "<tr><td><b>ISDN:</b></td><td><div align=\"center\"><a href=\"http://$scservername:$scserverport2/listen.pls\"><img src=\"images/blocks/winamp.gif\" align=\"bottom\" alt=\"Anhören mit WinAmp\" border=\"0\" /></a></div></td><td><div align=\"center\"><a href=\"http://www.un-beat-able.de/Unbeatable-ISDN.ram\"><img src=\"images/blocks/realplayer.gif\" border=\"0\" alt=\"Anhören mit Realplayer\"></a></div></td><td><div align=\"center\"><a href=\"http://www.un-beat-able.de/Unbeatable-ISDN.wax\"><img src=\"images/blocks/mediaplayer.gif\" align=\"bottom\" alt=\"Anhören mit MediaPlayer\" border=\"0\" /></a></div></td></tr>";
            }
        }
        $scs->close();
        $scs = &new ShoutcastInfo($scservername$scserverport3$servertimeout);
        if( !$scs->connect() )
        {
            $error TRUE;
            $errtxt $scs->error();
        }
        if( $error != TRUE )
        {
            $scs->send();
            if( !$scs->get_stat() )
            {
                $content .= "<tr><td colspan=\"4\"><center>MODEM-Server offline<br /><br /></center></td></tr>";
            }
            else
            {
                $content .= "<tr><td><b>Modem:</b></td><td><div align=\"center\"><a href=\"http://$scservername:$scserverport3/listen.pls\"><img src=\"images/blocks/winamp.gif\" align=\"bottom\" alt=\"Anhören mit WinAmp\" border=\"0\" /></a></div></td><td><div align=\"center\"><a href=\"http://www.un-beat-able.de/Unbeatable-MODEM.ram\"><img src=\"images/blocks/realplayer.gif\" border=\"0\" alt=\"Anhören mit Realplayer\"></a></div></td><td><div align=\"center\"><a href=\"http://www.un-beat-able.de/Unbeatable-MODEM.wax\"><img src=\"images/blocks/mediaplayer.gif\" align=\"bottom\" alt=\"Anhören mit MediaPlayer\" border=\"0\" /></a></div></td></tr>";
            }
 
        }
           $content .= "<tr><td colspan=\"4\"><center>Aktuell On Air:</center></td></tr>\n";
        
        $content .= "<tr><td colspan=\"4\"><marquee behavior=\"scroll\" direction=\"left\" height=\"15\" scrollamount=\"1\" scrolldelay=\"1\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\">$track</marquee></td></tr>\n";
        
        
        
    }
    


}

$scs->close();
$scs = &new ShoutcastInfo($scservername$scserverport3$servertimeout);
        if( !$scs->connect() )
        {
            $error TRUE;
            $errtxt $scs->error();
        }
        if( $error != TRUE )
        {
            $scs->send();
            if( !$scs->get_aim() )
            {
               include_once ('moderatoren.php');  
            }
            
            else
            {
                
                $content .= "<tr><td colspan=\"4\"><center>Kein Moderator am senden!<br /><br /></center></td></tr>";
            }
        }
$scs->close();        
$content .="</table>\n\n";

?>


so in der funktion aim wird der wert auch im if übergeben an die neue seite , getestet mit einem einfachen echo :) soo nun das problem :

ich brauche einen vergleich von den namen die im aim feld drin stehen ,

soll heissen in der folgenden datei stehen als test zwei namen und deren verlinkungen drin . und drüber eine denk ich mal vollkommen falsche vergleichs funktion

sooo nun kommen wir langsam zum ende was muss ich tun das es funktioniert? das problem ist das ich es net rafffe oder falsch benenne denk ich mir nur warum weshalb keine ahnung ;)

soo hir nun die dritte und letzte seite in der die aktion passierne soll ;)

schon jetzt bedank ichmich für eventuelle hilfe :) wennmir keiner helfen kann ;) damit kann ich leben wenn doch fällt mir nen riesen stein vom herzen :)

so nun die letzte datei :

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

/************************************************************************/
/* Gareth's moderatoren.php                                             */
/*                                                                      */
/*                        (c) 2005 by Gareth                            */
/*                       http://www.un-beat-able.de                     */
/*                                                                      */
/*            This Page uses the PHP ShoutcastInfo Class                */
/*                    MCB.CC - http://www.mcb.cc                        */
/*                                                                      */                      
/************************************************************************/



//echo $'aim';
//hier soll die vergleischoption rein für die namen die unten aufgeführt werden .
if ($this->pdatas['aim'] ) ;
  {
      $this->_extract_datas == $'name';
      if ($'name'==);
      {
      return = ($'name');
      }
      else
      {
      echo 'kein moderatorenbild vorhanden';
      }
      
  }
else
  {
  return = ('block-Unbeatable2.php');
  }


$name=DJGareth = <A HREF="http://wwww.un-beat-able.de/moderatoren/gareth.htm" TARGET="_blank"><IMG SRC="http://www.un-beat-able.de/modules/coppermine/albums/userpics/10003/thumb_5.JPG" BORDER="0"  alt="Moderator Ralf Hermanski für mehr Infos Bild Klicken" ></A><br>;    
$name=DJBernd = <A HREF="http://wwww.un-beat-able.de/moderatoren/bernd.htm" TARGET="_blank"><IMG SRC="http://www.un-beat-able.de/modules/coppermine/albums/userpics/10410/thumb_DJ%20Bernd.jpg" BORDER="0"  alt="Moderator Ralf Hermanski für mehr Infos Bild Klicken" ></A><br>;


?>


grüsse ralf :)

wcf.user.socialbookmarks.titel