1. php question

    Date: 08/24/05 (WebDesign)    Keywords: php, asp, sql

    *For those who know php* I love coding (learned Basic and logo back in middle and highschool and took C++ in college) and would like to get a grasp of php and sql. I know the more you practice it the more you learn but I wanted to know in general how long it took everyone to learn php at the intermediate level.

    Source: http://www.livejournal.com/community/webdesign/963120.html

  2. Stupid question I'm sure but I can't figure it out.

    Date: 08/25/05 (PHP Community)    Keywords: php

    Hi all,

    I'm having a problem understand when PHP code involving forms is actually run. I have this:

    Text file because I can't figure out how to post code without it parsing sdfasdfasdf


    I realize there are probably a gross amount of mistakes and formatting issues in there anyway, and feel free to comment on those as well (otherwise I'll never learn this shit), but my main problem is that the if submitted part doesn't work. It just executes the script every time someone opens the god damn page, which is a problem because then it's just firing off blank emails. Can someone here help me understand how to get PHP code to be used ONLY when a form is submitted, or when a variable test is used like I've used it? Maybe I'm not clearing the POST variables or something, or I should use SESSIONs, but I just don't know here. >_<

    Thanks in advance!

    Source: http://www.livejournal.com/community/php/339229.html

  3. Sorting an array

    Date: 08/26/05 (PHP Community)    Keywords: php

    I have a multi-dimensional array. I would like to sort by date, but I'm not at all sure how to do this. I've tried reading the PHP docs on sorting a multi-dimensional array, but I can't figure out how to make what I read apply to what I've got.


    What I have:

    Array ( 
    	[0] => Array ( 
    		[title] => Word of the Day 
    		[link] => http://www.the-leaky-cauldron.org/MTarchives/week_2005_08_21.php#007493 
    		[summary] => Today's Miami Herald notes that rhapdophobia is an unreasonable fear of magic wands. Guess that explains the Dursleys?... 
    		[sourcelink] => http://www.the-leaky-cauldron.org/ 
    		[sourcetitle] => The Leaky Cauldron 
    		[date_timestamp] => 1125065786 ) 
    	[1] => Array ( 
    		[title] => Special PotterCast/MuggleCast Edition! 
    		[link] => http://www.the-leaky-cauldron.org/MTarchives/week_2005_08_21.php#007491 
    		[summary] => There's a new, surprise edition of Leaky's PotterCast and MuggleNet's MuggleCast available tonight. After the latest kerfuffle (the iTunes outCast episode!), we decided to join forcesfor a special tell-all in which we reveal some big secrets: what really happened with... 
    		[sourcelink] => http://www.the-leaky-cauldron.org/ 
    		[sourcetitle] => The Leaky Cauldron 
    		[date_timestamp] => 1125040470 ) 
    	[2] => Array ( 
    		[title] => Felton Says He'll Work on Potter As Long as Possible 
    		[link] => http://www.the-leaky-cauldron.org/MTarchives/week_2005_08_21.php#007490 
    		[summary] => Tom Felton, who plays Draco Malfoy, took part in a carp fishing tournament this weekend (video interview here at the site of the World Junior Carp Tournamnet, pictures here), in which he said he'll do the HP films as long... 
    		[sourcelink] => http://www.the-leaky-cauldron.org/ 
    		[sourcetitle] => The Leaky Cauldron 
    		[date_timestamp] => 1125000722 ) 
    	[3] => Array ( 
    		[title] => Direct Download Links to International Trailer Available 
    		[link] => http://www.the-leaky-cauldron.org/MTarchives/week_2005_08_21.php#007489 
    		[summary] => Laurent has sent us download links for the international trailer at the official WB site:SuperHi Quality (.mov)High Quality (.mov)Medium Quality (.mov)Low Quality (.mov)... 
    		[sourcelink] => http://www.the-leaky-cauldron.org/ 
    		[sourcetitle] => The Leaky Cauldron 
    		[date_timestamp] => 1124997890 ) 



    Any advice or links to tutorials on this would be most welcome.

    Source: http://www.livejournal.com/community/php/339541.html

  4. firefox doesn't like my XML

    Date: 08/28/05 (Web Development)    Keywords: php, xml

    I'm trying to learn about XML, so i'm probably making a very basic error here....

    I'm working on modding a phpBB board to display some information, optionally, as XML. Here, for example, I have a simple XSLT stylesheet associated with it and a DTD:

    http://www.doorknobsoft.com/testboard/viewtopic.php?t=11&xml=true

    it renders in internet explorer, and appears to be valid, but in firefox it just appears as a chunk of plain text.
    also, in firefox, when I had an inline DTD it shows ]> at the beginning of the page, which of course it shouldn't, leading me to wonder if it's something like the character encoding? but I don't know how to find that out or how to fix that in PHP...

    Source: http://www.livejournal.com/community/webdev/239237.html

  5. Stamping a Date in Thunderbird

    Date: 08/28/05 (Mozilla)    Keywords: php



    I was always confused with Thunderbird's way of showing when a message was received or sent. There was no date included. If a message was sent on a particular day, it would only show the time it was sent, but not the date. That information was included the following day. When I looked at that Date column, it looked incomplete. Today I found out that there is an extension that enables the configuration of the date information. The name of the extension is ConfigDate 0.3.0 written by Alexander Ihrig released on August 22, 2005.


    Quick Description:

    In Thunderbird many people are confused because of the missing date from today's messages in the date column. By using ConfigDate, you're able to choose out of five (5) different date formats. Note: - The five (5) date formats are given by Thunderbird itself. - The date formats are depending on your systems/regions setting, too (e.g.: "25.08.2005 15:54" in Germany or "2005/08/25 15:54" in US).

    I just installed ConfigDate and it works flawlessly. I prefer the long date; i.e. Sunday, August 28, 2005 - 11:34 AM, but there are other options as well. If you were missing this feature, now you have it. The download link is:
    https://addons.mozilla.org/extensions/moreinfo.php?application=thunderbird&numpg=10&id=901

    Enjoy,

    Omar.-

    Image hosted by Photobucket.com

    Source: http://www.livejournal.com/community/mozilla/311892.html

  6. Integrate Google Desktop Into Firefox

    Date: 08/29/05 (Mozilla)    Keywords: php, google



    If you have already installed Google's Desktop in your hard disk and would like to search your desktop directly from Firefox, Google just came up with a useful plug-in developed by Bas Rokers for Windows XP.

    If you are interested in more information about this plug-in kindly click the following link:
    http://horopter.com/gds.php

    Enjoy,

    Omar.-

    Source: http://www.livejournal.com/community/mozilla/312869.html

  7. Tagboards?

    Date: 08/30/05 (Javascript Community)    Keywords: php, java, web

    I've been implored to design a website for a friend's band. Here it is. Nothing special, I know; they wanted something simple. I'm currently using a tag board from one of those websites that generates a generic, mostly uncustomizable code. I'd like to make one on my own but I can't find anything to help me along in the process. I'm not terribly familiar with JavaScript or PhP and I was wondering if anyone could point me in the right direction. I would appreciate a tutorial or something similar, but if you feel ambitious and want to write a code for me, I'll be sure to give you credit. XD


    Thanks in advance for any help. X-posted to '[info]'discuss_design.

    Source: http://www.livejournal.com/community/javascript/74873.html

  8. Stuck with XML

    Date: 08/30/05 (PHP Community)    Keywords: php, xml, database


    I have an XML file with a format similar to what follows:


      
          Item Title
          Item Description
          Item Size
         
             ##
             ##
             ##
         

         
             ##
             ##
             ##
         

         
             ##
             ##
             ##
         

       

      
         .
         .
       




    Having never had to parse XML before, I did some searching and found very quickly and easily how to pull information out of the first node, such as a list of titles, descriptions, or sizes, but the data I want to report is:

    Item1: Size, avgMonthlysales
    Item2: Size, avgMonthlysales
    etc.

    preferably with each value in a separate array so they could be easily called as $item[x], $size[x]...

    I'm using PHP5, so I've been working with the simplexml functions, although I have worked with the older xml functions. I haven't figured out how to get the data from the monthlysales under each corresponding item.

    Any pointers as to where I can look for more information on this? Thanks.


    Edit: I'm a little closer, but still need some help. I discovered all of the operators that work with xpath.

    Here's my (borrowed) code:

    $result = $xml->xpath('item/title | item/size | item/monthlysales/avg');
    while (list( ,$node) = each($result)){
    echo $node.'
    ';
    }

    This gives me a very nice
    Item1
    Size
    avgMonthylsales.

    I'd still like to make these into separate arrays because I want to compare them individually with existing database entries, and here is where I'm not smart enough and request help.

    Source: http://www.livejournal.com/community/php/340072.html

  9. javascript

    Date: 08/30/05 (Web Development)    Keywords: php, html, xml, java

    I shall start by saying that I really don't know much at all about javascript.

    I'm trying to send my xhtml as application/xhtml+xml wherever possible, which means I need well formed xml or I get lots of lovely errors.
    I'm usually a validation nut, so this hasn't been a problem with most stuff. However, I have several fanlistings on my site which use a script called phpfanbase.

    I've spent lots of time converting its html to xhtml, and removing lots of silly tables etc. Now the only thing stopping it from validating/being well formed is this bit of javascript:


    function submitonce(theform){
    //if IE 4+ or NS 6+
    if (document.all||document.getElementById){
    //screen thru every element in the form, and hunt down "submit" and "reset"
    for (i=0;ivar tempobj=theform.elements[i]
    if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
    //disable em
    tempobj.disabled=true
    }
    }
    }


    Can anyone explain what this does? If it's nothing too important then I'm just going to delete it I think.
    thanks :)

    Source: http://www.livejournal.com/community/webdev/240007.html

  10. Getting Windows user name

    Date: 08/31/05 (PHP Community)    Keywords: php, apache

    I am attempting to create an intranet site at work. We want to be able to authenticate users using active directory, and in such a way that the user doesn't need to put in a password or login name as long as they are logged into active directory(i.e., logged into Windows.) I was wondering if there's anyway I can determine the user's windows login name using either PHP or Apache. The point of this is that the user will simply be able to go to the intranet site from their work PC and use it, without needing to log into the site.

    Source: http://www.livejournal.com/community/php/340424.html

  11. HTML before PHP?

    Date: 08/31/05 (WebDesign)    Keywords: php, programming, html, asp, java, web

    Hi!  I'm new to this community.


    I am currently a graphic designer taking classes at RISD (Rhode Island School of Design) for web design and development.  I've completed most of the DESIGN aspects of the certificate program and am working on the PROGRAMMING/CODING part.

    My only experience with programming of any sort comes from these classes... "Actionscript in Flash" and "Javascript for Non-programmers."  Any other HTML I know is what I've picked up from LJ and using the dual split screen in Dreamweaver.

    I am for sure enrollling in the HTML class.  But the PHP class I want to take (two in one semester would be ideal) has an HTML prereq.

    Can I handle it?
    How hard is learning PHP?
    Should I take the two classes simultaneously this fall semester?
    Or should I take the HTML class, let it soak in until next spring, and then do the PHP?

    Pros to PHP now...
    1) I know someone in the class
    2) I'd hopefully be able to incorporate what I learn into a website I'm supposed to create this fall...

    Cons to PHP now...
    1) Getting totally and completely lost and not learning anything from the class...

    Thanks for your help and opinions.  I'd really appreciate it!

    Source: http://www.livejournal.com/community/webdesign/967411.html

  12. Anyone using Blogger?

    Date: 09/06/05 (PHP Community)    Keywords: php, html, web

    I'm trying to redo my website to php, including my blog. What scripting language are Blogger tags in if not PHP? I see placeholder tags such as < $ BloggerFileName $ > (sans the spaces) and I'm trying to understand it so I can successfully migrate that code from my html page to my new php page, and eventually make my own layout/ template for it. When I tried that and viewed it on my test site it only displayed the code and not the blog entries.

    I'm currently thinking of simply including the blogger.html file and not trying to make it a php page.

    Any hints or ideas as for deciphering Blogger's code?

    Source: http://www.livejournal.com/community/php/341292.html

  13. php, mysql search engine

    Date: 09/07/05 (MySQL Communtiy)    Keywords: cms, php, mysql, html, sql

    Ok, I’m trying to make a nice little search script for my CMS. The whole site is in the db, and I would like to have a way for people to be able to search all the content. Each entry in the db has an id, name, title, description and body. They may all contain html. now I would like to run a query that looks through all the fields (except the id) and pulls out all those that match, then display them in a table (I assume a while loop is fie for this). So what I'm really looking for is an sql query that will search all the fields. Now I would also like it to recognise boolean searches if this is possible.

    Ok, I’m sure you get the idea by now. Does anyone know how this might be achieved? Please note, my php knowledge is about a year old and my mysql is very poor. I have also been through mysql docs (mainly this page, but have found it s little beyond me).

    Thanks for any help

    x-posted to '[info]'php

    Source: http://www.livejournal.com/community/mysql/68021.html

  14. zip codes

    Date: 09/07/05 (MySQL Communtiy)    Keywords: php, mysql, html, database, sql

    i'm doing a project where i need to measure distances between zip codes; en route to a solution i stumbled upon a couple of handy resources that i figured i'd pass along:

    http://www.zend.com/codex.php?id=1486&single=1
    a class used to do various zipcode calculations such as distance and finding the zip codes within range of another zip code
    take a look at the class to see how he wants your tables and fields named for the state and zip code database tables

    http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm
    zipbase - datbase of zip codes with lat & long info, state info, etc. available in a text file and an access datbase
    i used the textfile and in mysql said:
    mysql> LOAD DATA LOCAL INFILE 'c:/ZIP_CODES.txt'
    -> INTO TABLE zip_code
    -> FIELDS TERMINATED BY ',' ENCLOSED BY '"'
    -> LINES TERMINATED BY '\r\n';

    http://27.org/isocountrylist/usps_states_list.sql
    SQL file for creating a states table (i believe in the zipcode class, he wants the states table called "state")

    i used that to make a silly little app to test some of the features of the class:

     $zip){
    		$field = 'zip'.($key+1);
    		if(isset($_REQUEST[$field])){
    			if(is_numeric($_REQUEST[$field])){
    				$zips[$key] = $_REQUEST[$field];	
    			}
    		}
    	}
    	
    	
    
    ?>
    
    " method="GET"> " /> " />
    $zip){ if($zip){ echo "
      "; echo "$zip:"; $details = $zc->get_zip_details($zip); if(!empty($details)){ foreach($details as $key => $value){ echo "
    • $key: $value
    • "; } } echo "
    "; } } ?>
    get_distance($zips[0], $zips[1]); } ?>


    oh, and i found this http://centricle.com/tools/html-entities/ to convert app code into HTML special chars



    crossposted in '[info]'php '[info]'mysql & '[info]'bobalien

    Source: http://www.livejournal.com/community/mysql/67585.html

  15. php, mysql search engine

    Date: 09/07/05 (PHP Community)    Keywords: cms, php, mysql, html, sql

    Ok, I’m trying to make a nice little search script for my CMS. The whole site is in the db, and I would like to have a way for people to be able to search all the content. Each entry in the db has an id, name, title, description and body. They may all contain html. now I would like to run a query that looks through all the fields (except the id) and pulls out all those that match, then display them in a table (I assume a while loop is fie for this). So what I'm really looking for is an sql query that will search all the fields. Now I would also like it to recognise boolean searches if this is possible.

    Ok, I’m sure you get the idea by now. Does anyone know how this might be achieved? Please note, my php knowledge is about a year old and my mysql is very poor. I have also been through mysql docs (mainly this page, but have found it s little beyond me).

    Thanks for any help

    x-posted to '[info]'mysql

    Source: http://www.livejournal.com/community/php/341853.html

  16. zip codes

    Date: 09/07/05 (PHP Community)    Keywords: php, mysql, html, database, sql

    i'm doing a project where i need to measure distances between zip codes; en route to a solution i stumbled upon a couple of handy resources that i figured i'd pass along:

    http://www.zend.com/codex.php?id=1486&single=1
    a class used to do various zipcode calculations such as distance and finding the zip codes within range of another zip code
    take a look at the class to see how he wants your tables and fields named for the state and zip code database tables

    http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm
    zipbase - datbase of zip codes with lat & long info, state info, etc. available in a text file and an access datbase
    i used the textfile and in mysql said:
    mysql> LOAD DATA LOCAL INFILE 'c:/ZIP_CODES.txt'
    -> INTO TABLE zip_code
    -> FIELDS TERMINATED BY ',' ENCLOSED BY '"'
    -> LINES TERMINATED BY '\r\n';

    http://27.org/isocountrylist/usps_states_list.sql
    SQL file for creating a states table (i believe in the zipcode class, he wants the states table called "state")

    i used that to make a silly little app to test some of the features of the class:

     $zip){
    		$field = 'zip'.($key+1);
    		if(isset($_REQUEST[$field])){
    			if(is_numeric($_REQUEST[$field])){
    				$zips[$key] = $_REQUEST[$field];	
    			}
    		}
    	}
    	
    	
    
    ?>
    
    " method="GET"> " /> " />
    $zip){ if($zip){ echo "
      "; echo "$zip:"; $details = $zc->get_zip_details($zip); if(!empty($details)){ foreach($details as $key => $value){ echo "
    • $key: $value
    • "; } } echo "
    "; } } ?>
    get_distance($zips[0], $zips[1]); } ?>


    oh, and i found this http://centricle.com/tools/html-entities/ to convert app code into HTML special chars



    crossposted in '[info]'php '[info]'mysql & '[info]'bobalien

    Source: http://www.livejournal.com/community/php/341574.html

  17. Socket problem

    Date: 09/07/05 (PHP Community)    Keywords: php

    I've got a class I'm writing (PHP5) that has three methods:

    1) Connect to a remote machine
    2) Send a command (and read response)
    3) Disconnect from the remote machine

    When I connect to the remote machine and log in to the system I'm golden, but after I return from the method and try to send another command, it never gets there. I watched the socket traffic on the remote machine and the second command never gets there. My script returns no errors, but times out waitng for a remote response.

    If ya'll got some time, I'd appreciate the help.



    class cpAdmin
    {
    	var	$hostname;	// Host or IP to connect to
    	var	$port;		// Port to connect on
    	var	$timeout;	// Port connect timeout
    	var	$password;	// Password to use
    	var	$cprw;		// Read/write or Read-only
    	const	cpeol = '\r\n';	// End of Line for the remote commands
    	
    
    	var	$command;	// Command to send to the host
    	var	$okerror;	// OK or ERROR from the host
    	var	$cperror;	// ERROR message from the host
    	var	$cpresult;	// Server data response (array)
    	var	$cpresultc;	// "clean" Server data response (array) stripped of all special markers, line feeds, etc.
    	var	$cpcommand;	// Command to send to host
    	
    
    	var	$socket;	// Socket connection
    	var	$answer;	// data read from from the socket
    	var	$connected;	// 1 or 0, is the socket connected?
    	var	$loggedin;	// 1 or 0, are we logged in?
    	var	$enable;	// 1 or 0, do we have enabled privs?
    	
    	var	$gerror;	// General Error (for non server communications errors)
    	var	$gerrord;	// General Error Description
    	
    	
    	// Connect and log in.
    	function connect()
    	{
    		$this->connected = 0;
    		$this->gerror = 0;
    		$this->loggedin = 0;
    		
    		if(!$this->socket = fsockopen($this->hostname, $this->port, $errno, $errstr, $this->timeout))
    		{
    			$this->gerrord = "Error connecting to the socket! Error Number: " . $errno . " Error description: " . $errstr;
    			$this->gerror = 1;
    			return FALSE;
    		}
    		else
    		{
    			$this->gerror = 0;
    			// Set the stream to blocking so we can read multiple lines from it if we need to.
    			/*
    				http://us3.php.net/manual/en/function.stream-set-blocking.php
    
    				If mode is 0, the given stream will be switched to non-blocking
    				mode, and if 1, it will be switched to blocking mode. This affects
    				calls like fgets() and fread()  that read from the stream. In
    				non-blocking mode an fgets() call will always return right away
    				while in blocking mode it will wait for data to become available on
    				the stream.
    			*/
    
    			if(!stream_set_blocking($this->socket, TRUE))
    			{
    				$this->gerror = 1;
    				$this->gerrord = 'Error setting the socket stream to blocking mode';
    				return FALSE;
    			}
    
    			// Read the answer from the connection and see if we connected right.  We read in 128 bytes.  Don't
    			// read to EOL, it won't work with the CP servers.
    			$this->answer = fgets($this->socket,512);
    
    			if(!preg_match("/\<.+\@.+\.com>/", $this->answer))
    			{
    
    				// If this fails you are probably not set to blocking on the stream or you did not read enough in.
    				$this->gerror = 1;
    				$this->gerrord = 'Data read from the stream did not look like a CP initialization string';
    				return FALSE;
    			}
    			else
    			{
    				$this->cperror = $this->answer;
    			}
    
    			// Log in.
    			if($this->cprw == "rw")
    			{
    				$loginString = "LOGIN $this->password WRITE\r\n";
    				$this->enable = 1;
    			}
    			else
    			{
    				$loginString = "LOGIN $this->password\r\n";
    				$this->enable = 0;
    			}
    			
    			if(!fputs($this->socket, $loginString.cpAdmin::cpeol))
    			{
    				$this->gerror = 1;
    				$this->gerrord = 'Error writing to socket.  Not connected?';
    				return FALSE;
    			}
    			
    			$this->answer = fgets($this->socket,64);
    			
    			if(preg_match("/^ERROR/",$this->answer))
    			{
    				$this->gerror = 0;
    				$this->okerror = "ERROR";
    				$this->connected = 1;
    			}
    			elseif(preg_match("/^OK/",$this->answer))
    			{
    				$this->gerror = 0;
    				$this->loggedin = 1;
    				$this->okerror = "OK";
    				$this->cperror = $this->answer;
    				$this->connected = 1;
    			}
    		}
    		
    		return TRUE;
    	}
    	
    	
    	
    	function disconnect()
    	{
    
    		// Disconnect
    		
    		$this->okerror = '';
    		$this->cperror = '';
    		$this->gerror = 0;
    		
    		if($this->connected == 0)
    		{
    			$this->gerror = 1;
    			$this->gerrord = 'Socket is not connected.';
    			return FALSE;
    		}
    		
    		if(!fputs($this->socket, 'QUIT'.cpAdmin::cpeol))
    		{
    			$this->gerror = 1;
    			$this->gerrord = 'Error writing to socket.  Not connected?';
    			return FALSE;
    		}
    		
    		@fclose ($this->socket);
    		$this->connected = 0; 
    		return TRUE;
    	}
    	
    	
    	
    	function command()
    	{
    		$this->gerror = 0;
    		$this->okerror = "";
    		$this->cperror = "";
    		
    		if($this->connected == 0)
    		{
    			$this->gerror = 1;
    			$this->gerrord = 'Socket is not connected.';
    			return FALSE;
    		}
    		
    		$count = 0;
    
    		$command = $this->cpcommand.'\r\n';
    		if(!fputs($this->socket, $command))
    		{
    			$this->gerror = 1;
    			$this->gerrord = 'Error writing to socket.  Not connected?';
    			return FALSE;
    		}
    		
    		while($answer = fgets($this->socket,128))
    		{
    			echo $answer.'
    '; if((!preg_match('/^ERROR/',$answer)) && (!preg_match('/^OK/',$answer))) { $this->cpresult[$count] = $answer; $this->cpresultc[$count] = preg_replace('* ','', rtrim($answer)); $count++; } elseif(preg_match('/^OK/',$answer)) { $this->okerror = 'OK'; } elseif(preg_match('/^ERROR/',$answer)) { $this->okerror = 'ERROR'; $this->cperror = $answer; } } return TRUE; } }




    Here is how I call it:


    include "cpAdmin.inc";
    
    $bob = new cpAdmin();
    $bob->hostname = '1.2.3.4';
    $bob->port = '1234';
    $bob->timeout = '30';
    $bob->password = 'somepassword';
    $bob->cprw = 'ro';
    
    if($bob->connect())
    {
    	echo 'Connected: '.$bob->connected.'
    '; echo 'OK/ERROR from host: '.$bob->okerror.'
    '; echo 'CP ERROR msg: '.$bob->cperror.'
    '; echo 'Logged in?: '.$bob->loggedin.'
    '; $bob->cpcommand = 'SOME COMMAND'; if(!$bob->command()) { echo '
    problem sending command
    '; echo 'Gen. Erorr desc: '.$bob->gerrord.'
    '; echo 'Gen error y/n: '.$bob->gerror.'
    '; } else { echo '
    command result:
    '; echo "result: ".$bob->cpresult.'
    '; } } else { echo 'Connected: '.$bob->connected.'
    '; echo 'OK/ERROR from CP: '.$bob->okerror.'
    '; echo 'CP ERROR msg: '.$bob->cperror.'
    '; echo 'Gen. Erorr desc: '.$bob->gerrord.'
    '; echo 'Gen error y/n: '.$bob->gerror.'
    '; }

    Source: http://www.livejournal.com/community/php/342193.html

  18. A question for the CSS gurus...

    Date: 09/08/05 (WebDesign)    Keywords: php, css

    I'm trying to do nested/threaded commenting system, not unlike what you see here on livejournal, but I really want to do it using CSS + DIV tags instead of using nested tables. Basically, I have a complete comment box that holds all the comments, and then I have a "headers" element that defines the layout of the header. I've been using 'margin-left' to move things to the right by calculating (25 * nested level) as it's value (I'm using PHP). The problem is that moves the whole header outside of the comment box, as shown below:




    This is how I want to make it look, though. See, it seems that there's no way to get CSS to calculate the remaining width of the comment box. Or maybe I'm missing something. I want width:100% to mean 100% of what's left after I set margin-left. Basically, like this:



    Is there something I'm missing? Should I use a container class and set padding-left instead of using the margin-left value of the comment header? Help me out here, this is driving me nuts!

    Source: http://www.livejournal.com/community/webdesign/973560.html

  19. freelancer article

    Date: 09/09/05 (WebDesign)    Keywords: php

    http://www.creativebehavior.com/index.php?PID=194

    a good article about the joys of project management.

    i especially like the tip about how to present your designs to the client:

    "Your explanation is very important. I have found that clients can have a totally different view of a design without my explanation. My advice is to show your designs in person or over the phone. Do not post the designs and shoot off an e-mail, because you are asking for trouble."

    Source: http://www.livejournal.com/community/webdesign/974418.html

  20. gmui/php probs

    Date: 09/09/05 (Computer Geeks)    Keywords: php, mysql, sql, apache

    I'm having trouble getting gmui to work properly. I have MySQL and Apache2 running fine behind it, but I just get this:

    Warning: displaysite(/var/www/localhost/gmui/./themes/default/template.php): failed to open stream: No such file or directory in /var/www/localhost/htdocs/gmui/class/Core.php on line 369

    EDIT:
    This is Line 369:
    require_once($this->gmui_dir.$this->subDirs['theme_dir'].$_SESSION['user']->theme."/template.php");




    * @author Don Seiler
    */
    class Core {

    /*
    * The version of GMUI
    */
    var $version;

    /*
    * Array containing settings for GMUI from conf.php
    */
    var $settings = array();

    /*
    * Array containing all CORE_OP
    * where the page refresh should enabled
    */
    var $pageRefresh = array("vd", "servers", "upl");

    /*
    * all available GMUI panels which are optional when mldonkey is running/off
    *
    */
    var $clientUpPanels = array("vd" => "Downloads", "s" =>"Search", "dllink" => "Links",
    "upl" => "Uploads", "upstats" => "Statistics", "servers" => "Servers", "shares" => "Shares",// "vfr" => "Friends",
    "cmd" => "Console", "opt" => "Client Options", "uopt" => "User Options",
    "umanage" => "Users", "gmanage" => "Groups", "other" => "Other", "inc" => "Incoming", "kill" => "Kill Client", "logout" => "Logout");

    var $clientDownPanels = array("umanage" => "Users", "gmanage" => "Groups",
    "other" => "Other", "uopt" => "User Options", "inc" => "Incoming",
    "start" => "Start Client", "logout" => "Logout");

    /*
    * GMUIs subdirectories
    */
    var $subDirs = array( "conf_dir" => "./conf/",
    "lang_dir" => "./lang/",
    "theme_dir" => "./themes/",
    "client_dir" => "./client/",
    "bin_dir" => "./bin/",
    "lib_dir" => "./lib/");
    /*
    * GMUIs priority mapping
    */
    var $priorities = array();

    /*
    * reload id
    */
    var $refreshed = FALSE;

    /*
    * client stat
    */
    var $alive;

    /*
    * settings from conf.php
    *
    */
    var $gmui_dir;
    var $gmui_http;

    var $client_basedir;
    var $client_startup;
    var $client_incoming;

    var $min_page_refresh;
    var $data_sync_time;
    var $use_javascript;
    var $allow_http_download;
    var $allow_http_upload;
    var $max_upload_size;
    var $make_commit_script;
    var $use_hard_links;
    var $include_incoming_size;
    var $max_displayed_sources;
    var $max_displayed_names;
    var $content_src;
    var $use_http_auth;
    var $use_db;
    var $sqlite_db_file;

    var $mysql_user;
    var $mysql_passwd;
    var $mysql_host;
    var $mysql_db;

    /*
    * use php file functions, workaround for file too big errors
    */
    var $use_php_ff;

    /**
    * Constructor for Core class
    *
    * Loads all settings and initializes what is needed.
    */
    function Core()
    {
    $this->loadSettings();
    $this->checkSettings();
    }
    /*
    * hack to use settings during Core Object is created
    */
    function postInit()
    {
    $this->setVersion();
    $this->setInterface();
    $this->setDataBase();
    $this->setPriorities();
    }

    function setPriorities() {
    $this->priorities = array(
    "-20" => _("Very Low"),
    "-10" => _("Low"),
    "0" => _("None (priority)"),
    "10" => _("High"),
    "20" => _("Very High")
    );
    }

    /**
    * Get database wrapper Object
    *
    * @author Moritz Warning
    */
    function setDataBase() {
    require($this->subDirs['conf_dir']."config.php");

    if($use_db == "sqlite") {
    $_SESSION['db'] = new SQLite($sqlite_db_file);
    } elseif ($this->use_db == "mysql") {
    $_SESSION['db'] = new MySQL($mysql_user, $mysql_passwd, $mysql_host, $mysql_db);
    } else exit(''._("No valid database type selected!")."
    \n");
    }

    /**
    * Get Interface Objekt to get data from MLDonkey
    *
    * @author Moritz Warning
    */
    function setInterface() {
    require($this->subDirs['conf_dir']."config.php");

    $_SESSION['interface'] = new MLD_Interface($client_host, $client_port, $client_user, $client_passwd);
    $_SESSION['interface']->postInit();
    }

    /**
    * Grabs version from VERSION file
    *
    * @author Don Seiler
    */
    function setVersion() {
    if (file_exists("./VERSION")) {
    $lines = file("./VERSION");
    $this->version = $lines[0];
    } else {
    exit(''._("Version File not found!")."
    \n");
    }
    }

    /**
    * Return available languages.
    *
    * @author Moritz Warning
    */
    function getLanguages() {
    return getDirs($this->subDirs['lang_dir']);
    }

    /**
    * Return available themes
    *
    * @author Moritz Warning
    */
    function getThemes() {
    return getDirs($this->subDirs['theme_dir']);
    }

    /**
    * Loads core settings into $this->settings array
    *
    * @author Moritz Warning
    */
    function loadSettings() {
    $conf_file = $this->subDirs['conf_dir']."config.php";
    if (!file_exists($conf_file)) {
    exit(''."Required file conf/config.php not found!"."
    \n");
    }
    require($conf_file);

    //check for optional $gmui_dir in conf.php
    if(!isset($gmui_dir)) {
    $this->gmui_dir = dirname($_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"]).DIRECTORY_SEPARATOR;
    } else {
    $this->gmui_dir = $gmui_dir;
    }

    //check for optional $gmui_http in conf.php
    if(!isset($gmui_http)) {
    $this->gmui_http = dirname("http://".$_SERVER["SERVER_ADDR"].":".$_SERVER["SERVER_PORT"].$_SERVER["PHP_SELF"]).DIRECTORY_SEPARATOR;
    } else {
    $this->gmui_http = $gmui_http;
    }

    //needed settings in ./conf/conf.php
    $this->client_basedir = $client_basedir;
    $this->client_startup = $client_startup;
    $this->client_incoming = $client_incoming;
    $this->data_sync_time = $data_sync_time;
    $this->min_page_refresh = $min_page_refresh;
    $this->use_javascript = $use_javascript;
    $this->allow_http_download = $allow_http_download;
    $this->allow_http_upload = $allow_http_upload;
    $this->max_upload_size = $max_upload_size;
    $this->make_commit_script = $make_commit_script;
    $this->chmod = $chmod;
    $this->use_hard_links = $use_hard_links;
    $this->include_incoming_size = $include_incoming_size;
    $this->max_displayed_sources = $max_displayed_sources;
    $this->max_displayed_names = $max_displayed_names;
    $this->content_src = $content_src;
    $this->use_http_auth = $use_http_auth;
    $this->use_db = $use_db;
    $this->use_php_ff = $use_php_ff;

    //other settings, depend on others
    if($use_db == "sqlite") {
    $this->sqlite_db_file = $sqlite_db_file;
    } elseif($use_db == "mysql") {
    $this->mysql_user = $mysql_user;
    $this->mysql_passwd = $mysql_passwd;
    $this->mysql_host = $mysql_host;
    $this->mysql_db = $mysql_db;
    }
    }

    function checkSettings() {
    $check_settings = array(
    'client_basedir',
    'client_startup',
    'client_incoming',
    'min_page_refresh',
    'data_sync_time',
    'use_javascript',
    'allow_http_download',
    'allow_http_upload',
    'max_upload_size',
    'make_commit_script',
    'use_hard_links',
    'include_incoming_size',
    'max_displayed_sources',
    'max_displayed_names',
    //'content_src', this may be empty b y purpose
    'use_http_auth',
    'use_db'
    );

    foreach ($check_settings as $setting) {
    $value = $this->{$setting};
    if (is_null($value) or $value === "") {
    $missingsettings[] = $setting;
    }
    }

    if(count($missingsettings) > 0) {
    $errorstring = "

    \nConfig file incomplete. The following values are missing:
    \n

      \n";
      foreach ($missingsettings as $setting) {
      $errorstring .= "
    • $setting
    • \n";
      }
      $errorstring .= "
    \n

    \n";
    $errorstring .= "If you have recently upgraded, please check config.php.sample for any new settings.\n";
    exit($errorstring);
    }
    }

    /**
    * Lets you know if a menu item is currently active
    *
    * @author CJ Kucera
    */
    function isMenuActive($menu)
    {
    return ($_SESSION["active"] == $menu);
    }

    /**
    * Returns a list of available menu items, for themes
    *
    * @author Moritz Warning
    */
    function getMenu() {
    $menu = array();
    $panels = array();

    if($this->alive) { $panels = $this->clientUpPanels; }
    else { $panels = $this->clientDownPanels; }

    foreach($_SESSION['user']->titlebar as $id) {
    if(isset($panels[$id])) {
    $menu[] = new MenuItem($id, _($panels[$id]), $this->isMenuActive($id));
    }
    }
    return $menu;
    }

    /*
    * this function print the entire site using getSite() in themes/template.php
    *
    * Moritz Warning
    */
    function displaySite() {
    $this->setConstants();
    $this->setAlive();
    $this->setLanguage();
    $this->setTimeMark();

    //update users downloads and settings
    if($this->timemark) {
    $_SESSION['user']->refill_settings();
    $_SESSION['user']->refill_downloads();
    }

    require_once($this->gmui_dir.$this->subDirs['theme_dir'].$_SESSION['user']->theme."/template.php");
    echo getSite(); //getSite is part of the theme

    //reset text variables
    $_SESSION['title'] = "";
    $_SESSION['message'] = "";
    $_SESSION['headline'] = "";

    exit();
    }

    //$this->subDirs
    /*
    * set constants
    *
    * Moritz Warning
    */
    function setConstants() {
    define("NL", "\n");
    define("BN", "
    \n");
    define("BBN", "

    \n");
    }

    /*
    * set alive status of the client
    *
    * Moritz Warning
    */
    function setAlive() {
    $this->alive = $_SESSION['interface']->alive();
    }


    /*
    *
    set gettext variables
    *
    * Moritz Warning
    */
    function setLanguage() {
    $lang = $_SESSION['user']->lang;

    if($lang == "en") {
    setlocale(LC_ALL, 'en_US');
    } else {
    setlocale(LC_ALL, $lang."_".strtoupper($lang));
    }
    putenv("LANG=".$lang);
    bindtextdomain('messages', $this->subDirs['lang_dir']);
    textdomain('messages');
    }

    /*
    * set $this->timemark every $data_sync_time seconds (set in config.php)
    *
    * Moritz Warning
    */
    function setTimeMark() {
    $this->timemark = FALSE;
    if(!isset($_SESSION['last_time_check']) OR (time() - $_SESSION['last_time_check']) > $this->data_sync_time) {
    $_SESSION['last_time_check'] = time();
    $this->timemark = TRUE;
    }
    }

    /**
    * Reads $_REQUEST var and takes appropriate action
    *
    * @author Don Seiler
    * @author Moritz Warning
    */
    function getBody() {

    $core_op = $_REQUEST["CORE_OP"];

    if(!$this->alive) {
    $_SESSION['was_dead'] = TRUE;
    }

    list($prefix,$suffix) = explode("_", $core_op);
    //set CORE_OP if it is not valid
    if(!$_SESSION['user']->allow_show_Menu($prefix)) {
    if(!empty($core_op)) {
    $core_op = "";
    $prefix = "";
    } elseif($this->alive AND $_SESSION['user']->allow_show_Menu("vd")) {
    $core_op = "vd"; //default is CORE_OP when not set and "vd" allowed
    $prefix = "vd";
    }
    }
    $_REQUEST["CORE_OP"] = $core_op; //reset core_op because other programms use it

    $this->dbCare();

    //select availabel panels
    $panels = array();
    if($this->alive) { $panels = $this->clientUpPanels; }
    else { $panels = $this->clientDownPanels; }

    if(function_exists($core_op)) {
    $_SESSION["title"] = "Web-GMUI: ".$panels[$prefix];
    $_SESSION["active"] = $prefix;
    $content = call_user_func($core_op);
    } else {
    $_SESSION["title"] = "Web-GMUI: "._("Welcome");
    $_SESSION["active"] = "";
    $content = "";
    }
    return $content;
    }

    /*
    * dbCare check if mlnet was restarted and initiate an auto reassignment program (verify_db)
    *
    * Moritz Warning
    */
    function dbCare() {
    $restarted = FALSE;

    if($this->alive AND $_SESSION['was_dead']) {
    $restarted = TRUE;
    $_SESSION['was_dead'] = FALSE;
    }

    if($this->alive AND !$restarted AND ($_REQUEST["CORE_OP"] == "vd")) {
    $restarted = $_SESSION['interface']->check_MLDrestart();
    }

    if($restarted) {
    $check_all = FALSE;
    if($_SESSION['user']->username == "admin") { $check_all = TRUE; }

    $_SESSION['user']->verify_db($check_all);
    $_SESSION['user']->refill_downloads();
    } elseif($this->alive AND $this->timemark) {
    $_SESSION['user']->remove_finished();
    }
    }

    /*
    * logout - what should i say any more? ;)
    *
    * Moritz Warning
    */
    function logout() {
    //for gettext tool
    _("Logout");

    $_SESSION['user']->search_delAll();
    unset($_SESSION);
    session_destroy();
    if($this->use_http_auth) { //send a 401 to clear the browser cache
    Header('WWW-Authenticate: Basic realm="Logout"');
    Header('HTTP/1.0 401 Unauthorized');
    }
    }
    }
    ?>


    x-posted to #linux and #computergeeks

    Source: http://www.livejournal.com/community/computergeeks/771090.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home