Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. Im trying to transfer video files from 1 domain to another for storage

     

    I found this old code in my collection but cant seem to get it configured correctly

     

    Or better yet - if anyone has a simple script for transferring files to another domain with a web based ftp and cron script??

     

    #!/usr/bin/perl -s
    use Socket;
    # EXAMPLE OF HOW TO SETUP TO PULL A FILE LOCATED AT THE URL
    # http://members.ams.chello.nl/12b3/glowballz/flash/glowballzLogo.swf
    ###################################################################################################
    $remote = "site1.com/htdocs";   				#THE DOMAIN NAME OF THE FILE SERVER
    $output = "/1205060978148238213.flv";					#THE FILENAME YOU ARE RETRIEVING
    $url = "/flvideo/1205060978148238213.flv";		#THE PATH OF THE URL YOU ARE RETRIEVING
    ###################################################################################################
    # END OF USER CONFIGURATION
    ###################################################################################################
    $port = 80;
    &superfetch ;
    exit(0);
    ###################################################################################################
    # RETRIEVE FILE
    ###################################################################################################
    sub superfetch {
    open (FILE, ">$output");
    $submit = "GET $url HTTP/1.0\n\n";
    if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
    die "No port specified." unless $port;
    $iaddr   = inet_aton($remote)       || die "Could not find host: $remote";
    $paddr   = sockaddr_in($port, $iaddr);
    $proto   = getprotobyname('tcp');
    socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
    connect(SOCK, $paddr)    || die "connect: $!";
    send(SOCK,$submit,0);
    while(<SOCK>) {
    	if ( /^[\r]??$/ ){
    		while (<SOCK>){
    			print FILE $_;
    			}
    		}
    	}
    }
    

  2. Whats wrong with sql dump??

     

    Keep getting this mysql error

     

    Error 
    SQL query: 
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_clients'
    #
    CREATE TABLE phpads_clients(
    
    clientID mediumint( 9 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
    clientname varchar( 255 ) NOT NULL ,
    contact varchar( 255 ) ,
    email varchar( 64 ) NOT NULL ,
    views mediumint( 9 ) ,
    clicks mediumint( 9 ) ,
    clientusername varchar( 64 ) NOT NULL ,
    clientpassword varchar( 64 ) NOT NULL ,
    expire date DEFAULT '0000-00-00',
    activate date DEFAULT '0000-00-00',
    permissions mediumint( 9 ) ,
    language varchar( 64 ) ,
    active enum( 'true', 'false' ) NOT NULL ,
    weight tinyint( 4 ) default '1' NOT NULL ,
    parent mediumint( 9 ) DEFAULT '0' NOT NULL ,
    report enum( 'true', 'false' ) NOT NULL ,
    reportinterval mediumint( 9 ) DEFAULT '7' NOT NULL ,
    reportlastdate date DEFAULT '0000-00-00' NOT NULL ,
    reportdeactivate enum( 'true', 'false' ) NOT NULL ,
    PRIMARY KEY ( clientID ) 
    ) 
    MySQL said:  
    
    #1067 - Invalid default value for 'clientID'  
    

     

    Original sql.txt

     

    # phpMyAdmin MySQL-Dump
    # http://www.htmlwizard.net/phpMyAdmin/
    #
    # Host: localhost:3300 Database : phpads
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_zones'
    #
    
    CREATE TABLE phpads_zones (
       zoneid mediumint(9) NOT NULL AUTO_INCREMENT,
       zonename varchar(255) NOT NULL,
       description varchar(255) NOT NULL,
       zonetype smallint(6) DEFAULT '0' NOT NULL,
       what blob NOT NULL,
       width smallint(6) DEFAULT '0' NOT NULL,
       height smallint(6) DEFAULT '0' NOT NULL,
       retrieval enum('random','cookie') DEFAULT 'random' NOT NULL,
       cachecontents blob,
       cachetimestamp int DEFAULT '0' NOT NULL,
       PRIMARY KEY (zoneid)
    );
    
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_adclicks'
    #
    
    CREATE TABLE phpads_adclicks (
       bannerID mediumint(9) DEFAULT '0' NOT NULL,
       t_stamp timestamp(14),
       host varchar(255) NOT NULL,
       KEY clientID (bannerID)
    );
    
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_adviews'
    #
    
    CREATE TABLE phpads_adviews (
       bannerID mediumint(9) DEFAULT '0' NOT NULL,
       t_stamp timestamp(14),
       host varchar(255) NOT NULL,
       KEY clientID (bannerID)
    );
    
    
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_banners'
    #
    
    CREATE TABLE phpads_banners (
       bannerID mediumint(9) NOT NULL auto_increment,
       clientID mediumint(9) DEFAULT '0' NOT NULL,
       active enum('true','false') NOT NULL,
       weight tinyint(4) default '1' NOT NULL,
       seq tinyint(4) default '0' NOT NULL,
       banner blob NOT NULL,
       width smallint(6) DEFAULT '0' NOT NULL,
       height smallint(6) DEFAULT '0' NOT NULL,
       format enum('gif','jpeg','png','html','url','web','swf') DEFAULT 'gif' NOT NULL,
       url varchar(255) NOT NULL,
       alt varchar(255) NOT NULL,
       status varchar(255) NOT NULL,
       keyword varchar(255) NOT NULL,
       bannertext varchar(255) NOT NULL,
       target varchar( default '' NOT NULL,
       description varchar(255) DEFAULT '' NOT NULL,
       autohtml enum('true','false') DEFAULT 'true' NOT NULL,   
       PRIMARY KEY (bannerID)
    );
    
    
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_clients'
    #
    
    CREATE TABLE phpads_clients (
       clientID mediumint(9) DEFAULT '0' NOT NULL auto_increment,
       clientname varchar(255) NOT NULL,
       contact varchar(255),
       email varchar(64) NOT NULL,
       views mediumint(9),
       clicks mediumint(9),
       clientusername varchar(64) NOT NULL,
       clientpassword varchar(64) NOT NULL,
       expire date DEFAULT '0000-00-00',
       activate date DEFAULT '0000-00-00',
       permissions mediumint(9),
       language varchar(64),
       active enum('true','false') NOT NULL,
       weight tinyint(4) default '1' NOT NULL,   
       parent mediumint(9) DEFAULT '0' NOT NULL,
       report enum('true','false') NOT NULL,
       reportinterval mediumint(9) DEFAULT '7' NOT NULL,
       reportlastdate date DEFAULT '0000-00-00' NOT NULL,
       reportdeactivate enum('true','false') NOT NULL,
       PRIMARY KEY (clientID)
    );
    
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_session'
    #
    
    CREATE TABLE phpads_session (
       SessionID varchar(32) NOT NULL,
       SessionData blob NOT NULL,
       LastUsed timestamp(14),
       PRIMARY KEY (SessionID)
    );
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_acls'
    #
    
    CREATE TABLE phpads_acls (
       bannerID mediumint(9) DEFAULT '0' NOT NULL,
       acl_con set('and','or') NOT NULL,
       acl_type enum('clientip','useragent','weekday','domain','source','time','language') NOT NULL,
       acl_data varchar(255) NOT NULL,
       acl_ad set('allow','deny') NOT NULL,
       acl_order int(10) unsigned DEFAULT '0' NOT NULL,
       KEY bannerID (bannerID),
       UNIQUE bannerID_2 (bannerID, acl_order)
    );
    
    # --------------------------------------------------------
    #
    # Table structure for table 'phpads_adstats'
    #
    CREATE TABLE phpads_adstats (
      views int(11) DEFAULT '0' NOT NULL,
      clicks int(11) DEFAULT '0' NOT NULL,
      day date DEFAULT '0000-00-00' NOT NULL,
      BannerID smallint(6) DEFAULT '0' NOT NULL,
      PRIMARY KEY (day,BannerID)
    );
    
    

  3. Less lines = less loading time

     

    Errr - no.

     

     

    Google index page

     

    <html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{font-size:20px}.h{color:#3366cc}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{float:left;font-weight:bold;height:22px;padding-left:2px}.gbh,.gb2 div{border-top:1px solid #c9d7f1;font-size:0;height:0}.gbh{position:absolute;top:24px;width:100%}.gb2 div{margin:5px}#gbi{background:#fff;border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;font-size:13px;top:24px;z-index:1000}#guser{padding-bottom:7px !important}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.73em;vertical-align:top}}#gbi,.gb2{display:none;position:absolute;width:8em}.gb2{z-index:1001}#gbar a,#gbar a:active,#gbar a:visited{color:#00c;font-weight:normal}.gb2 a,.gb3 a{text-decoration:none}.gb2 a{display:block;padding:.2em .5em}#gbar .gb2 a:hover{background:#36c;color:#fff}</style><script>window.google={kEI:"csqqR_ehJqTuoASVxI3CCw",kEXPI:"17259,17735",kHL:"en"};
    function sf(){document.f.q.focus()}
    window.clk=function(b,c,d,e,f,g){if(document.images){var a=encodeURIComponent||escape;(new Image).src="/url?sa=T"+(c?"&oi="+a(c):"")+(d?"&cad="+a(d):"")+"&ct="+a(e)+"&cd="+a(f)+(b?"&url="+a(b.replace(/#.*/,"")).replace(/\+/g,"%2B"):"")+"&ei=csqqR_ehJqTuoASVxI3CCw"+g}return true};
    window.gbar={};(function(){var a=window.gbar,d,h,i;function l(b,f,e){b.display=i?"none":"block";b.left=f+"px";b.top=e+"px"}a.tg=function(b){var f=0,e=0,c,m=0,n,j=window.navExtra,k,g=document;h=h||g.getElementById("gbar").getElementsByTagName("span");(b||window.event).cancelBubble=!m;if(!d){d=g.createElement(Array.every||window.createPopup?"iframe":"DIV").frameBorder="0".scrolling="no".src="#";g.body.appendChild(d).id="gbi";if(j&&h[7])for(n in j){k=g.createElement("span");k.appendChild(j[n]);h[7].parentNode.insertBefore(k,h[7]).className="gb2"}g.onclick=a.close}while(c=h[++m]){if(e){l(c.style,e+1,f+25);f+=c.firstChild.tagName=="DIV"?9:20}if(c.className=="gb3"){do e+=c.offsetLeft;while(c=c.offsetParent)}}d.style.height=f+"px";l(d.style,e,24);i=!i};a.close=function(b){i&&a.tg(b)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="sf();if(document.images){new Image().src='/images/nav_logo3.png'}" topmargin=3 marginheight=3><div id=gbar><nobr><span class=gb1>Web</a></span> <span class=gb1><a href="http://images.google.com.au/imghp?hl=en&tab=wi">Images</a></span> <span class=gb1><a href="http://maps.google.com.au/maps?hl=en&tab=wl">Maps</a></span> <span class=gb1><a href="http://news.google.com.au/nwshp?hl=en&tab=wn">News</a></span> <span class=gb1><a href="http://video.google.com.au/?hl=en&tab=wv">Video</a></span> <span class=gb1><a href="http://mail.google.com/mail/?hl=en&tab=wm">Mail</a></span> <span class=gb3><a href="http://www.google.com.au/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1"><u>more</u> <small>&#9660;</small></a></span> <span class=gb2><a href="http://groups.google.com.au/grphp?hl=en&tab=wg">Groups</a></span> <span class=gb2><a href="http://books.google.com.au/bkshp?hl=en&tab=wp">Books</a></span> <span class=gb2><a href="http://scholar.google.com/schhp?hl=en&tab=ws">Scholar</a></span> <span class=gb2><a href="http://blogsearch.google.com.au/?hl=en&tab=wb">Blogs</a></span> <span class=gb2><div></div></a></span> <span class=gb2><a href="http://www.google.com/calendar/render?hl=en&tab=wc">Calendar</a></span> <span class=gb2><a href="http://picasaweb.google.com.au/home?hl=en&tab=wq">Photos</a></span> <span class=gb2><a href="http://docs.google.com/?hl=en&tab=wo">Documents</a></span> <span class=gb2><a href="http://www.google.com.au/reader/view/?hl=en&tab=wy">Reader</a></span> <span class=gb2><div></div></a></span> <span class=gb2><a href="http://www.google.com.au/intl/en/options/">even more »</a></span> </nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr><b>admin@freexxxhunters.com</b> | <a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com.au/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNH1kEen7nYvAop6K_53cfXVwWQinQ">iGoogle</a> | <a href="https://www.google.com/accounts/ManageAccount">My Account</a> | <a href="/accounts/ClearSID?continue=http://www.google.com/accounts/Logout%3Fcontinue%3Dhttp://www.google.com.au/">Sign out</a></nobr></div><center><br clear=all id=lgpd><img alt="Google" height=110 src="/intl/en_au/images/logo.gif" width=276><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%> </td><td align=center nowrap><input name=hl type=hidden value=en><input maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>  <a href=/advanced_search?hl=en>Advanced Search</a><br>  <a href=/preferences?hl=en>Preferences</a><br>  <a href=/language_tools?hl=en>Language Tools</a></font></td></tr><tr><td align=center colspan=3><font size=-1><span style="text-align:left">Search: <input id=all type=radio name=meta value="" checked><label for=all> the web </label><input id=cty type=radio name=meta value="cr=countryAU"><label for=cty> pages from Australia </label></span></font></td></tr></table></form><br><br><font size=-1><span id=hp style="behavior:url(#default#homepage)"></span><script><!--
    (function() {var a="http://www.google.com.au/",b=document.getElementById("hp"),c=b.isHomePage(a);_rptHp=function(){(new Image).src="/gen_204?sa=X&ct=mgyhp&cd="+(b.isHomepage(a)?1:0)};if(!c){document.write('<p><a href=/mgyhp.html onClick=document.getElementById("hp").setHomepage("'+a+'");_rptHp();>Make Google Your Homepage!</a><br><br>')};
    })();//-->
    </script><a href="/intl/en/ads/">Advertising Programmes</a> - <a href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About Google</a> - <a href=http://www.google.com/ncr>Go to Google.com</a></font><p><font size=-2>©2008 Google</font></p></center></body></html>

     

    And yahoos index page:

     

    <!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Yahoo! Search - Web Search</title><meta name="description" content="The search engine that helps you find exactly what you're looking for. Find the most relevant information, video, images, and answers from all across the Web."><script></script><link rel="stylesheet" type="text/css" href="http://us.js2.yimg.com/us.js.yimg.com/lib/s3/ysch_syc_200711072041.css"><script src="http://us.js2.yimg.com/us.js.yimg.com/lib/s3/ysch_syc_200711072041.js"></script></head><body onload="init();"><div id="bd"><h1><a id="logo" href="http://www.yahoo.com/"><span class="off-left">Yahoo! Search</span></a></h1><ul id="tabs" class="tabs"><li class="on"><strong>Web</strong></li><li><a href="http://images.search.yahoo.com/images;_ylt=A0oGkjzSyqpHeCUBUVel87UF?ei=UTF-8&fr2=tab-web&fr=">Images</a></li><li><a href="http://video.search.yahoo.com/video;_ylt=A0oGkjzSyqpHeCUBUlel87UF?ei=UTF-8&fr2=tab-web&fr=">Video</a></li><li><a href="http://search.yahoo.com/yp;_ylt=A0oGkjzSyqpHeCUBU1el87UF?ei=UTF-8&fr2=tab-web&fr=">Local</a></li><li><a href="http://search.yahoo.com/products;_ylt=A0oGkjzSyqpHeCUBVFel87UF?ei=UTF-8&fr2=tab-web&fr=">Shopping</a></li><li class="last"><a id="vm-link" class="menu-link" href="http://tools.search.yahoo.com/about/forsearchers.html">more</a><div id="vm-menu" class="menu hidden"><ul><li><a href="http://answers.yahoo.com/;_ylt=A0oGkjzSyqpHeCUBVVel87UF?ei=UTF-8&fr2=tab-web&fr=">Answers</a></li><li><a href="http://audio.search.yahoo.com/audio;_ylt=A0oGkjzSyqpHeCUBVlel87UF?ei=UTF-8&fr2=tab-web&fr=">Audio</a></li><li><a href="http://search.yahoo.com/dir;_ylt=A0oGkjzSyqpHeCUBV1el87UF?ei=UTF-8&fr2=tab-web&fr=">Directory</a></li><li><a href="http://search.yahoo.com/jobs;_ylt=A0oGkjzSyqpHeCUBWFel87UF?&keywords_all=&fr2=tab-web&fr=">Jobs</a></li><li><a href="http://news.search.yahoo.com/news;_ylt=A0oGkjzSyqpHeCUBWVel87UF?ei=UTF-8&fr2=tab-web&fr=">News</a></li><li><a href="http://rds.yahoo.com/_ylt=A0oGkjzSyqpHeCUBWlel87UF/SIG=129rn5975/EXP=1202461778/**http%3a//tools.search.yahoo.com/about/forsearchers.html">All Search Services</a></li></ul><div></div><ul><li><a href="http://searchmarketing.yahoo.com/arp/srch_ss.php?o=US2117&cmp=Yahoo&ctv=SERP_tab&s=Y&s2=S&s3=&b=25">Advertising Programs</a></li></ul></div></li></ul><form id="sf" action="http://search.yahoo.com/search;_ylt=A0oGkjzSyqpHeCUBW1el87UF"><div><label for="yschsp" class="off-left">Web Search</label><input type="text" id="yschsp" name="p" value=""><input type="submit" class="ygbt" value="Search"><input type="hidden" name="ei" value="UTF-8"><input type="hidden" name="iscqry" id="iscqry"><input type="hidden" name="fr" value="sfp"><div id="atg" class="panel hidden"><ul id="atgl"></ul></div></div></form><div id="so"><a id="so-link" class="menu-link" href="http://search.yahoo.com/preferences/preferences">Options</a><div id="so-menu" class="menu hidden"><ul><li><a href="http://search.yahoo.com/web/advanced?ei=UTF-8">Advanced Search</a></li><li><a href="http://search.yahoo.com/preferences/preferences?pref_done=http%3A%2F%2Fsearch.yahoo.com%2F%3Fei%3DUTF-8&.bcrumb=7928fa4ad02d8b4fdad03f7be312199e,1202375378">Preferences</a></li></ul><div></div><ul><li><a href="http://searchmarketing.yahoo.com/arp/srch_ss.php?o=US2117&cmp=Yahoo&ctv=SERP_tab&s=Y&s2=S&s3=&b=25">Advertising Programs</a></li><li><a href="http://help.yahoo.com/l/us/yahoo/search/basics/basics-23.html">About This Page</a></li></ul></div></div></div><div id="ft"><hr><p class="copyright"><span>© 2008 Yahoo!</span> <a href="http://privacy.yahoo.com/">Privacy</a> / <a href="http://info.yahoo.com/legal/us/yahoo/utos/utos-173.html">Legal</a> - <a href="http://search.yahoo.com/info/submit.html">Submit Your Site</a></p></div><form name="hf"><div><input type="hidden" name="qry"><input type="hidden" name="ei" value="UTF-8"></div></form><script>if(typeof YAHOO=="undefined"){YAHOO={};}YAHOO.SPLD={};YAHOO.SPLD.resources=[['http://us.js2.yimg.com/us.js.yimg.com/lib/s3/shainew_200801151557.css','css'],['http://us.js2.yimg.com/us.js.yimg.com/lib/s3/shainew_200801111833.js','js'],['http://us.js2.yimg.com/us.yimg.com/i/us/sch/gr3/ngsprt_srp_20080104a.png','image'],['http://us.js2.yimg.com/us.yimg.com/i/us/sch/el/ng_bg.png','image']];YAHOO.SPLD.schbox=document.getElementById("yschsp");YAHOO.SPLD.preloadFlag=0;YAHOO.SPLD.tmpImage=null;YAHOO.SPLD.CustomFunctions={preload:function(){var yspld=YAHOO.SPLD;var ysres=yspld.resources;if(yspld.preloadFlag===1){return;} yspld.preloadFlag=1;var newIframe=document.createElement('iframe');newIframe.setAttribute('name','hiddenFrame');newIframe.setAttribute('id','hiddenFrame');newIframe.style.width='0px';newIframe.style.height='0px';newIframe.style.display='none';document.body.appendChild(newIframe);var frameHandle=document.getElementById("hiddenFrame");var frameDoc=false;if(frameHandle){if(frameHandle.contentDocument) frameDoc=frameHandle.contentDocument;else if(frameHandle.contentWindow) frameDoc=frameHandle.contentWindow.document;else frameDoc=frameHandle.document;var frameHead=frameDoc.getElementsByTagName('head')[0];if(!frameHead){frameDoc.open();frameDoc.writeln("<html><head></head></html>");frameDoc.close();frameHead=frameDoc.getElementsByTagName('head')[0];} for(var i=0;i<ysres.length;i++){if(ysres[i][0]){if(ysres[i][1]==='image'){yspld.tmpImage=new Image();yspld.tmpImage.src=ysres[i][0];} else if(ysres[i][1]==='css'){var newLnk=frameDoc.createElement('link');newLnk.setAttribute('href',ysres[i][0]);newLnk.setAttribute('rel','stylesheet');newLnk.setAttribute('type','text/css');newLnk.setAttribute('media','all');frameHead.appendChild(newLnk);} else if(ysres[i][1]==='js'){var scriptNode=frameDoc.createElement('script');scriptNode.setAttribute('type','text/javascript');scriptNode.setAttribute('src',ysres[i][0]);frameHead.appendChild(scriptNode);}}}}}};if(YAHOO.SPLD.schbox){if(window.attachEvent){YAHOO.SPLD.schbox.attachEvent('onkeypress',YAHOO.SPLD.CustomFunctions.preload);}else if(window.addEventListener){YAHOO.SPLD.schbox.addEventListener("keypress",YAHOO.SPLD.CustomFunctions.preload,false);}}</script></body></html><!-- m26.search.sk1.yahoo.com uncompressed Thu Feb  7 01:09:38 PST 2008 -->
    

     

    PROOF!!

     

    Just look at the style sheet no unwanted white space/lines

  4. I think ive found a better , less bulky way for this.

     

    Original code:

     

    <?php
    
    $age = 4;
    
    if ($age > 10){
       echo 'False 10 is greater than 4';
    }else if ($age == 4){
       echo 'This is correct';
    }else{
       echo 'True 10 is greater than 4';
    }
    ?>

     

    Alternate method (2 lines code, instead of eight):

     

    <?php
    $age = 11;
    echo ($age == 11)? 'Number exactly 11' : 'Not 11';
    ?>

  5. If you are thinking of using more than 10 GB of space then you should start looking into buying a server. Google, yahoo, and even myspace host on their own servers just because it doesn't cost much after an initial investment - including a fiberoptic backbone and many servers (once they get this, they simply buy harddrives for space, a very cheap investment).

     

    Haha, you have to be kidding me about needing a dedicated server for 10GB.

     

    I think he meant actually owning the servers, not renting a dedicated one  ;)

  6. Question - why use {} brackets in an "if else" script, considering it returns the same results??

     

    Without {} Brackets:

    <?php

     

    $age = 4;

     

    if ($age > 10)

    echo 'False 10 is greater than 4';

    else if ($age == 4)

    echo 'This is correct';

    else

    echo 'True 10 is greater than 4';

     

    ?>

     

    Returns - "This is correct"

     

    With {} Brackets:

    <?php

     

    $age = 4;

     

    if ($age > 10){

    echo 'False 10 is greater than 4';

    }else if ($age == 4){

    echo 'This is correct';

    }else{

    echo 'True 10 is greater than 4';

    }

    ?>

     

    Returns - "This is correct"

  7. Im trying to filter hacking attempts on this form but keep getting this error message:

     

    Fatal error: Call to undefined function safe_ouput() in \get_post.php on line 14

     

    What am I doing wrong??

     

    <?php
    
    function safe_output($string) {
    
    $string = trim($string);
    $string = strip_tags($string);
    $string = htmlspecialchars($string);
    return $string;
    }
    
    
    if ($_GET ['action'] == 'send') {
    
    echo ('Data = '.safe_ouput($_GET['keyword']));
    }
    
    ?>
    
    <form method="get" action ="get_post.php">
    <fieldset>
    <legend>Programming Form</legend><br>
    <input type="text" name ="keyword" size ="25"><br><br>
    <input type="submit" name ="action" value ="send">
    </fieldset>
    </form>

  8. These sites don't make huge money by the way, YouTube wasn't very profitable when Google took them over and MySpace is backed by a huge media company. The real money is selling them.

     

    I agree. I watch about 100+ youtube vids every week for the past year and have never clicked an ad.

     

    Wasnt myspace recently taken over (sold)? Originally developed by a 22yo or something.

     

    Saw a new clip on youtube recently, the guy from Facebook got offered 1 BILLION dollars for the website. Maybe that should be our REAL focus - Building crazy websites with no initial profit, and selling them.

     

    Interesting goings on anyhow  8)

  9. I have a script:

     

    <head>
    <style>body {
    background-color:#ffffff;
    color: #484848; 
    font-size:0.9em;
    margin:0px;
    font-family: Verdana,Arial,Helvetica;	
    
    }
    td {
    font-size:0.7em;
    
    }
    a {
    color:#484848;
    font-weight : bold;
    }
    a:visited {
    	color: #909090;
    }
    a:hover {
    color: #990000;
    }
    
    
    table.main {width:800px;
    
    }
    
    /* Header */
    
    h1 {font-size:1.5em;
    padding-top:3px;
    margin-left:10px;
    color:#123456;
    }
    h2 {font-size:1.3em;
    padding-top:3px;
    margin-left:10px;
    color:#123456;
    }
    h3 {font-size:1.2em;
    padding-top:3px;
    margin-left:10px;
    color:#123456;
    }
    
    ul  {
    font-weight:bold;
    }
    
    ol  {
    font-weight:bold;
    }
    
    .orange {
    width:100%;
    height:20px;
    background-color:#FF2F2F;
    color:#ffffff;
    font-weight:bold;
    
    }
    
    .title {
    width:100%;
    height:20px;
    background-color:#FFF3DB;
    }
    .yellow {
    background-color:#FFF3DB;
    }</style>
    
    <script>/**
    * @author Natalia Bazhenova www.fh54.de (c) 2005-2007
    */
    
    /********************************/
    /*******start config****************/
    /*******************************/
    //array with suggest texts
    
    var opttext=[
    "Amsterdam","Berlin","Bern","Prag","Paris","Vienna","Warsaw","Rome","Riga","Tallinn","Vilnius","Lisbon",
    "Madrid","Athens","Sofia","London","Bucharest","Budapest","Bratislava","Ljublana","Beograd","Brussels",
    "Helsinki","Stockholm","Copenhagen","Oslo","Dublin","Vaduz"
    ]
    //id of the textbox element
    var inputID="inputSelect"
    //max size of "selectbox"
    var maxcount=5 
    /*******************************/
    /**********end config***********/
    /*******************************/
    
    opttext.sort();
    var scripting=false;
    //initialize:
    //for mozilla
    if (window.captureEvents) {
        window.captureEvents(Event.LOAD)
        window.onload=suggestInput_init;
    }
    //for ie
    document.onreadystatechange=ieInit;
    function ieInit()
    {
       if (document.readyState=="complete")
       {
          document.body.onload=function() {suggestInput_init()}
       }
    }
    var SIs //initially invisible select box
    var SItxt //the main input text element
    var newdiv=document.createElement("DIV") //a visible pendant to select box
    var globalN=0; //how much options scrolled up
    //for ie
    if (document.attachEvent)
    document.attachEvent("onclick",hideSelect)
    // for Mozilla
    if (document.captureEvents) {
    document.captureEvents(Event.CLICK);
    document.onclick = hideSelect;
    }
    function hideSelect() {
    newdiv.style.display="none"
    }
    function suggestInput_init() {
    if (document.createElement("DIV")) { //otherwise nothing happens
    	scripting=true;
    	SIs=document.createElement("SELECT")
    	SIs.onkeyup=function(e){
    		if(!e) e=event; setInputValue(this.selectedIndex,e)
    	}
    	SIs.className="select_input"
    	SIs.setAttribute("id","selectInput");
    	SIs.style.position="absolute"
    	SIs.style.top="-9999px"
    	SIs.style.left="-9999px"
    	SIs.style.visibility="hidden"
    	document.body.appendChild(SIs)
    	SItxt =document.getElementById(inputID);
    	SItxt.setAttribute("autocomplete","OFF")
    	SItxt.onkeyup=function(e){
    		if (!e) e=event; showSelection(this.value,e)
    	}
    	SItxt.focus()
    	for (i=0;i<opttext.length;i++) {
    		o=document.createElement("OPTION");;
    		o.innerHTML=opttext[i];
    		SIs.appendChild(o)
    		SIs.style.visibility="visible"; // for Opera
    	}
    	elt=SItxt 
    	//find coords where the suggest div will appear
    	pos2=findPos(elt); pos2.push(elt.offsetHeight); pos2.push(elt.offsetWidth)
    
    	newdiv.style.top=(pos2[1]+pos2[2])+'px';
    	newdiv.style.left=pos2[0]+'px';
    	newdiv.style.width=pos2[3]+'px';
    	newdiv.className="suggestBoxContainer"
    	newdiv.style.display="none"
    	buildDiv(0)
    	document.body.appendChild(newdiv)
     }
    } 
    
    function buildDiv(n) {
    if (n>SIs.childNodes.length) 
    	return false; 
    for (i=0;i<newdiv.childNodes.length;i++) {
    	newdiv.removeChild(newdiv.childNodes[i]);i--
    }
    if (n>0) {// insert top "..." - div
    	d1=document.createElement("DIV");
    	d1.id="lessDiv"
    	d1.style.width="100%"
    	d1.style.fontSize="0.8em"
    	d1.onmouseover=function() {this.className="mouse_over";}
    	d1.onmouseout=function() {this.className="suggestBox"}
    	d1.onclick=function() {
    		buildDiv(n-1);
    		d1.className="mouse_over"
    	} 
    	d1.innerHTML="......"; 
    	newdiv.appendChild(d1); 
    }
    m=(maxcount<SIs.childNodes.length)?(maxcount):(SIs.childNodes.length)
    for(i=0;i<m;i++) {
    	d=document.createElement("DIV")
    	d.style.width="100%"
    	d.style.fontSize="0.8em"
    	d.onmouseover=function() {
    		this.className="mouse_over";
    		SItxt.value=this.innerHTML
    	}
    	d.onmouseout=function() {
    		this.className='suggestBox'
    	}
    	d.onclick=function() {
    		SItxt.value=this.innerHTML;
    		newdiv.style.display="none"
    	}
    	try {
    		d.innerHTML=SIs.childNodes[i+n].innerHTML;
    	}
    	catch(err) {}
    	newdiv.appendChild(d)
    };
    globalN=n;
    if (SIs.childNodes.length-n>maxcount) {// insert bottom "..." - div
    	d2=document.createElement("DIV");
    	d2.id="moreDiv"
    	d2.style.width="100%"
    	d2.style.fontSize="0.8em"
    	d2.onmouseover=function() {this.className="mouse_over";}
    	d2.onmouseout=function() {this.className="suggestBox";}
    	d2.onclick=function() {
    		buildDiv(n+1); 
    		d2.className="mouse_over";
    	}
    	d2.innerHTML="......"; 
    	d2.className="suggestBox";
    	newdiv.appendChild(d2) 
     } 
    }
    
    function setInputValue(m,ev) {
    if (!scripting) return;
    isLess=(document.getElementById("lessDiv"))?(1):(0)
    if (m>globalN+maxcount+isLess+1) {
    	m=globalN+maxcount;SIs.selectedIndex=m
    }
    if (m<isLess) {
    	m=globalN-1;SIs.selectedIndex=globalN-1
    }
    a=SIs.childNodes[m].innerHTML
    SItxt.value=a;
    try {
    	if (newdiv.childNodes[m-globalN+isLess]) {  
    		if (newdiv.childNodes[m-globalN+isLess].id=="moreDiv") { 
    			buildDiv(globalN+1);  
    			newdiv.childNodes[maxcount].className="mouse_over";;
    			return
    		}
    	}
    } catch (err) {}
    try {
    	if (newdiv.childNodes[m-globalN+isLess]) {  
    		if (newdiv.childNodes[m-globalN+isLess].id=="lessDiv") {  
    			buildDiv(globalN-1);
    			isLess_new=(document.getElementById("lessDiv"))?(1):(0)
    	 		newdiv.childNodes[isLess_new].className="mouse_over";
    	 		return
    		}
    	}
    } catch (err) {}
    try {
    	for (i=0;i<newdiv.childNodes.length;i++)
    		newdiv.childNodes[i].className="suggestBox";
    	 newdiv.childNodes[m-globalN+isLess].className="mouse_over";
    } catch(err) {}; 
    if ((ev.keyCode!=40) && (ev.keyCode!=38) && (ev.keyCode!=0)) { // if not arrow down, arrow up or mouseclick  
    	newdiv.style.display="none"
    	SItxt.focus();
    }
    }
    
    function showSelection(t,ev) {
    if (!scripting) return;
    if (ev.keyCode==40) { // by arrow down comes into suggestion select
    	 if (SIs.childNodes.length>0) {
    		  newdiv.childNodes[0].className="mouse_over";
    		  SItxt.value=SIs.childNodes[0].innerHTML; 
    		  try {
    		  	SIs.focus();
    		  } catch(err){}
    		  SIs.childNodes[0].selected=true;
    	 }
    	 return            
    }
    if (t=="") 
    	return ;
    t=t.toLowerCase();
    l=t.length; 
    for (i=0;i<SIs.childNodes.length;i++) {
    	SIs.removeChild(SIs.childNodes[i]);
    	i--
    }
    for(i=0;i<opttext.length;i++) {
    	 if (opttext[i].substr(0,l).toLowerCase()==t) {
    	  	oOption = document.createElement("OPTION");
    	  	SIs.appendChild(oOption)
    	 	 oOption.innerHTML = opttext[i];
    	 }
    }
    if (SIs.childNodes.length>0)  {
    	newdiv.style.display=""
    	buildDiv(0)
    } 
    else 
    	newdiv.style.display="none";
    SItxt.focus()
    }
    
    /** Source: http://www.quirksmode.org/js/findpos.html - is better than my own**/
    function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
    	curleft = obj.offsetLeft
    	curtop = obj.offsetTop
    	while (obj = obj.offsetParent) {
    		curleft += obj.offsetLeft
    		curtop += obj.offsetTop
    	}
    } 
    return [curleft,curtop];
    } </script>
    </head>
    
    <body>
    
    <!--Search Box-->
    <input type=text id=inputSelect class=input_select>
    
    </body>
    
    

     

    It displays a input suggestion as the user types. I want to replace:

     

    //array with suggest texts
    
    var opttext=[
    "Amsterdam","Berlin","Bern","Prag","Paris","Vienna","Warsaw","Rome","Riga","Tallinn","Vilnius","Lisbon",
    "Madrid","Athens","Sofia","London","Bucharest","Budapest","Bratislava","Ljublana","Beograd","Brussels",
    "Helsinki","Stockholm","Copenhagen","Oslo","Dublin","Vaduz"

     

    by a database driven keyword suggestion....

     

    But thats not all...I want to use the users input for future searches.

     

    Does anyone know of a script/program that has these features already, or can someone help me with a sql txt dump for the tables and integration??

     

    Thanks

×
×
  • 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.