Jump to content

owned

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

owned's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tried the script, it was resource hog for some reason. Those kind of system-killer scripts shouldn't be used. And second, probably images shouldn't be put in database without very good reason. File system is most of the time better. Images just slow down sql server, I think. Example of image to database: <?php $font="tahoma.ttf"; $col= imagecolorallocate($im, 0,170,0); $im = imagecreatetruecolor(400, 400); imagettftext($im, 20,0,400/2,400/2, $col, $font, 'TeXt'); header ("Content-type: image/png"); imagepng($im); ob_start(); imagepng($im); $image_data = ob_get_contents(); ob_end_clean(); $query="INSERT INTO images(imagedata) VALUES('".mysql_escape_string($image_data)."')"; $fetch = mysql_query($query, $connection) or die("error"); //or using base64, fetched imagedata must be decoded then of course //$query="INSERT INTO images(imagedata) VALUES('".base64_encode($image_data)."')"; //$fetch = mysql_query($query, $connection) or die("error"); //imagedata field must be longblob imagedestroy($im); ?> When fetching the image from database just echo() the result and set header("Content-Type: image/png");
  2. What does the script do? Create a gradient colored text? Plus the script hogs all system resources, CPU usage 100% for awhile, doesn't look too good. Those white bits.. problem with alpha(i.e. transparency) channels probably? I think following code makes text correcly on transparent background without white bits and doesn't hog all system resources either. <?php $font="tahoma.ttf"; $col= imagecolorallocate($im, 0,170,0); $im = imagecreatetruecolor(400, 400); imagettftext($im, 20,0,400/2,400/2, $col, $font, 'TeXt'); header ("Content-type: image/png"); imagepng($im); imagedestroy($im); ?>
  3. http://www.deeptraffic.com DeepTraffic is a great pay per click program. If you prefer not to pay for clicks you can also swap visitors, there is a free traffic exchange 1:1 ratio! Only quality traffic! Every click and impression is analyzed in real-time to determine whether they are quality or not. Try it. / Join now. :o
  4. I would recommend to make every request via index.php and set up pretty urls there. Inside index.php include() can be used when having multiple files. Simple example with mod-rewrite: #.htaccess RewriteEngine On RewriteRule ^([a-zA-Z0-9\-_'!;\[\]()=]+)(\.html)?$ ?short=$1 [QSA,L] #also this should be used if doing things below <Files ~ "\.inc$"> Order allow,deny Deny from all </Files> <?php $short=$_GET['short']; $short_exp=explode('-',$short); $page=$short_exp[0]; $sub=$short_exp[1]; //here include can be used and put codes below into separate files e.g. include($page.".inc"); if($page=='homepage'){ echo "homepage"; if($sub=='1'){ echo "subthings"; } if($sub=='2'){ echo "subthings2"; } } if($page=='info'){ echo "info"; } ?> Usage : http://domain.com/homepage.html http://domain.com/homepage-1.html http://domain.com/homepage-2.html http://domain.com/info.html -or- http://domain.com/homepage http://domain.com/homepage-1 Without mod-rewrite above can be achieved like this: <?php $qstring=$_SERVER['QUERY_STRING']; $qstring_exp=explode('-',$qstring); $page=$qstring_exp[0]; $sub=$qstring_exp[1]; include($page.".inc"); ?> Usage: http://domain.com/?homepage http://domain.com/?homepage-1 *note the ?-mark Switching between "mod-rewrite and php" I think every link must be printed either way. E.g.: <?php $linkstyle=$_COOKIE['linkstyle']; if($linkstyle=='modrewrite'){ $link="/homepage-1.html"; }elseif($linkstyle=='querystring'){ $link="/?homepage-1"; }else{ $link="/?page=homepage&subpage=1"; } echo "<a href='{$link}'>aaa</a>"; ?> To detect which url style is used, an example: <?php $getpage=$_GET['page']; if($getpage==''){ $qstring=$_SERVER['QUERY_STRING']; $qstring_exp=explode('-',$qstring); if($qstring==''){ $short=$_GET['short']; $short_exp=explode('-',$short); if($short!=''){ $page=$short_exp[0]; $sub=$short_exp[1]; }else{ echo "homepage"; } }else{ $page=$qstring_exp[0]; $sub=$qstring_exp[1]; } }else{ $page=$getpage; $sub=$_GET['sub']; } //etc. ?> Hope this helps.
  5. Well there is nothing ajax. Client program is not even web-browser. Attachment: client app, if anyone wants to try and help. ??? [attachment deleted by admin]
  6. Oops..i meant: Socket_select() might be the reason? (cant edit)
  7. Following socket server receives data from clients instantly as it should be. But server can send data to the client only when _client first makes a request_ to the server. How can server send data to the client instantly without needing client(s) to do requests every fraction of seconds to retrieve data in intensive apps ?? Help ??? If any client sends message to the server then some message can be distributed to other connected idle clients using that commented code. But how to make server send message without client's request? Socket_accept() might be the reason? E.g. how to make this following code to send messages to connected client(s) every second? Code: <?php $running=1; $print_send = "echo (\"<font color='red'>{\$output}</font>\"); ob_flush();flush();"; $print_receive = "echo (\"<font color='green'>{\$input}</font>\"); ob_flush();flush();"; echo(" <html> <head> </head> <body> "); echo ("<h1>SERVER</h1><br><font color='green'>RUNNING...</font>"); ob_flush();flush(); // Set time limit to indefinite execution set_time_limit (0); // Set the ip and port we will listen on $address = '<ip>'; $port = 666; $max_clients = 10; // Array that will hold client information $clients = Array(); $sid_socket_list=array(); // Create a TCP Stream socket $sock = socket_create(AF_INET, SOCK_STREAM, 0); // Bind the socket to an address/port socket_bind($sock, $address, $port) or die('Could not bind to address'); // Start listening for connections socket_listen($sock); // Loop continuously while($running==1){ // Setup clients listen socket for reading $read[0]=$sock; for($i = 0; $i < $max_clients; $i++){ if($client[$i]['sock'] != null){ $read[$i + 1] = $client[$i]['sock']; } } // Set up a blocking call to socket_select() $ready = socket_select($read, $write = NULL, $except = NULL, $tv_sec = NULL); // if a new connection is being made add it to the client array if(in_array($sock, $read)){ for($i=0;$i<$max_clients;$i++){ if($client[$i]['sock'] == null){ $client[$i]['sock'] = socket_accept($sock); socket_getpeername($sock, $ip); $output = "welcome"; socket_write($client[$i]['sock'],$output.chr(0)); eval($print_send); break; }elseif($i == $max_clients - 1){ echo("too many clients"); } } if(--$ready <= 0){ continue; } } // end if in_array // If a client is trying to write - handle it now for($i=0;$i<$max_clients;$i++){ // for each client if(in_array($client[$i]['sock'] , $read)){ $input = socket_read($client[$i]['sock'] , 1024); eval($print_receive); if($input==null){ // Zero length string meaning disconnected unset($client[$i]); } $input = trim($input); if($input == 'exit'){ // requested disconnect socket_close($client[$i]['sock']); unset($client[$i]); }elseif($input=='shutdown'){ // shutdown server socket_close($client[$i]['sock']); unset($client[$i]); $running=0; }elseif($input){ // strip white spaces and write back to user //$output = ereg_replace("[ \t\n\r]","",$input).chr(0); //socket_write($client[$i]['sock'],$output); //eval($print_send); //$output = 'test'; //socket_write($client[$i]['sock'],$output); //eval($print_send); /* PROCESS CLIENT INPUT Send message to all clients: $output='message'; for($j=0;$j<$max_clients;$j++){ if($client[$j]['sock']){ socket_write($client[$j]['sock'], $output.chr(0)); eval($print_send); } } */ } //end input }else{ // Close the socket //socket_close($client[$i]['sock']); //unset($client[$i]); } }//end for } //end while // Close the master sockets socket_close($sock); echo "<br><font color=red>SHUTDOWN</font>"; ?>
  8. Yes this this is weird. OS is Windows. Phpinfo() says: Registered PHP Streams php, file, http, ftp, compress.zlib, compress.bzip2, https, [b]ftps[/b] OpenSSL support enabled FTP support enabled Where is ftps support enabled :-\ And ftp_ssl_connect() function is undefined. Damn.
  9. FTP_SSL_CONNECT() How do I enable this ? Any one got php win binaries supporting this ? Help! ???
  10. How the hell I enable FTP_SSL_CONNECT() function ? It is just undefined. Basic ftp_connect works fine. Anyone got php binaries w/ ftps support? Any ideas? Help!
  11. I'm not going to pay for that sorry. I'd like some free advice, anyone? ???
  12. Can someone explain how to create own php extensions on windows? I've searched everywhere.  I'm stuck at compiling process and can't make it output a dll file. I have "phpsrc/ext/hello/"+example files. @phpsrc path when I execute command prompt cmd 'cscript /nologo configure.js | find "hello"' : 'ERROR: MS C++ compiler required' If I try 'cscript /nologo configure.js --enable-hello' : 'Saving configure options to config.nice.bat Checking for cl.exe ... (not found) Checking for cl.exe ... (not found) ERROR: MS C++ compiler required' When I copy cl.exe from visual studio to that path same error. If I try to define some cygwin, no.. I'm just confused. Anyone give me some help? How do I compile this? ??? ??? :-\
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.