cwarn23 387 Occupation: Genius Team Colleague Featured Poster

When you setup the textbox fields, make sure they both have names and that their names are unique. So something like below is an example:

<form method='post'>
<input type='text' name='box1' size=30><br>
<input type='text' name='box2' size=30>
</form>

Then to retrieve those 2 fields and display them you would use the following php code:

echo $_POST['box1']; //displays first field in above example
echo "<br>"; // adds new html line.
echo $_POST['box2']; //displays second field in above example

So try to make sure the field names are unique and in the form element it has method=post

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi there, ok writing on database is very easy, but i don't know the following:--
1- When storing the links in the database, i want to get new link like this, domain.com/?link=89
where 89 represent row number where the link is stored??
2- when surfing the link, how can i read row 89 from the database and hyper a link with that link,

Please any reply, it will be really appreciated
regards

Although I don't directly know how to go straight to line 89, I do know that you could use a while loop then break the loop at line 89 then perform the actions with the fetched data. So try the following code to fetch each field of row 89 as an array.

<?
$result=mysql_query("SELECT * FROM `table`") or die(mysql_error());
$rownum=0;
while ($row=mysql_fetch_array($result))
    {
    $rownum+=1;
    if ($rownum==89) //change 89 to row number to retrieve
        {
        break;
        }
    }
//now if you have a column named field1 and want to display
//its value on line 89 use the following
echo $row['field1'];
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I am trying to embed a modified version of a javascript/css script from http://www.javascriptkit.com/script/script2/dbmenu/# but since have made a few problems. At the moment, my script is only compatible with Internet Explorer 7 (not compatible with earlier versions) and can anybody help me debug the top menu at http://cwarn23.info/cms/ The blog menu should be a drop down menu with only one object in it ("categories" link). But at the moment, the categories link is beside the blog menu. Most of my script is the same as the one at javascript kit but can anybody tell me what makes it so different to make it incompatible with most browsers.

Webpage:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	"http://www.w3.org/TR/html4/strict.dtd">
<html><head>
	<script src='http://cwarn23.info/cms/dbMenu.js' type='text/javascript'></script>
<style type='text/css' rel='stylesheet' media='screen'>
#menu{
	position:relative;
	z-index:1;
	top:0;
	left:0;
	padding:2px;
	margin:0px;
	list-style:none;
}
li ul{
	position:relative;
	background-color:#ffffff;
	border:1px solid black;
	display:none;
	padding:2px;
	margin:0px;
	list-style:none;
}
li{
	position:relative;
	padding:2px;
	margin:0px;
	color:#000000;
}
.subMenu{
	background-repeat:no-repeat;
}
.click{
	background-color:#FFCE11;
	color:#fffab5;
}
.click ul{
	display:block;
}
.hover, ul li a:hover{
	cursor:pointer;
	background-color: #FFCE11;
	color:#FFFAB5;
}
li ul li.hover, li ul li.hover a:hover{
	background-color:#FFCE11;
}
li a{
	width:100%;
}
li a, li ul li a, li.hover ul li a{
	text-decoration:none;
	color:#000000;
}
li.hover a, li ul li.hover a{
	color:#fffab5;
	text-decoration:underline;
}
</style><link href='http://cwarn23.info/cms/dropDown.css' type='text/css' rel='stylesheet' media='screen'></head><body bgcolor='#FFCE11' topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0><table border=0 cellpadding=5 cellspacing=0 width=100% height=100%><tr><td bgcolor='#FF9C00' align=center valign=top><font face='arial black' size=6> My Website</font><br><table border=0 cellpadding=0 cellspacing=0 height=28><tr>
	<td style='background-image: url("
       
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you are new to php, perhaps some simple documentation will explain the basics of php. For mysql, check out http://www.tizag.com/mysqlTutorial/ and on the left side of the page are links to tutorials of each part of using mysql. Also you can get advanced documentation from http://www.php.net And if you are wondering what program to use, a text editor like notepad will do the job and just save the files with the php extension. The documentation should answer at least half those questions.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

But how can i set this timeout ?

By judging your first post I thought you already did set it to 300. But anyway, place the following code at the very top of your php file:

<?
set_time_limit(0); //number of seconds and zero for infinite
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hello
Can anyone provide me a video tutorial about framework in web development field within php like how the file structure are organize in a framework,etc. Tutorial can be base upon oscommerc, zendcart, etc.This can be developing a web site . thank you.

You may want to note that if you are making the php script, you can make any file structure. The file structure is a part of the design that can be done in infinite ways. But if you are talking about what other people do, one thing they all have in common is they have one folder for all the pictures to make it easier for upload. Also another thing that is common is to have a folder or file that contains the admin control panel. But as for video tutorials, try http://www.youtube.com

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Live client side streaming with php... I wish.

Since this sort of question keeps appearing, I shall explain.
Php is only able to compile SERVER side code and can only send to the browser or user html, javascript, or css code. Other than that you would need to switch to a client side language like Flash, Ajax or Java which have nothing to do with php.

So when using php, since your final result is expected to be html, Javascript or Css script, it means you need to choose one of those 3 languages to display or continue processing after page has fully loaded. So in your case, you would need to use Javascript unless you want to switch to a non-php related client side script (Ajax, Java or Flash) then Ajax, Java and Flash can do the same thing as Ajax, Java and Flash are design to have simular abilities to php.

If you choose Javascript, there is a free clock provided at the below link which you can fiddle with.
http://www.javascriptkit.com/script/script2/digitalclock.shtml

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If it is just the permissions that you are worried about, you could probably just make the individual php files have your desired chmod such as 644 while cgi scripts in the same directory have a different chmod number. This should work or at least on the server I'm on as when changing the chmod configurations of my cgi-bin seems to not effect the whats in the directory. From my experience, it is the chmod of individual files that makes the difference.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It means your page took too long to load and exceeded to time limit. Try setting the timeout in php.ini to zero for infinite timing or setting it to something like 99999 seconds.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Since in a way, that kind of works just like and "include" file, it's always "there" when page is called up

I must have misread the sentence in the above quote and what I meant about the include function was having a separate php file for each page to be displayed which wouldn't be very convenient for a content management system.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Using the include function is one way of doing it but another way of achieving seo friendly urls is using a htaccess file (if apachie enables the rewrite mod). To make it easier below is an example url that I'll explain below:

http://www.example.com/index.php?category=more_info&page=contact_us
http://www.example.com/more_info/contact_us.html

The first example url above shows the true location of the php file which can be set so when you visit the second url (the html file), it will display the data in the php file while keeping the url in the address bar as the html file. This is known the the url rewrite mod which allows you to create virtual pages and can even hide the fact that you are using php. Now to create what I have described above, first create a file called ".htaccess" without the quotes (note: windows explorer may not allow you to create that name so use notepad to save as that name.) and put in the .htaccess file the below code.

RewriteEngine On
RewriteRule ^(.*)/(.*).html$ index.php?category=$1&page=$2

Then place that htaccess file in the homepage directory (for the above url example to work) and from there, instead of linking to the php file, link to the html file as shown in the first code box.
That is the basics but if you can give examples of your different php urls (post those urls inside a code box) then I will happily create a .htaccess file that will allow you to link to seo friendly …

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well you shouldn't have to worry about how to call the functions as mentioned before my first reply and an example of what the page should look like is as below:

<?
echo "<html><head><title>Page Title</title></head><body>"; //headers
echo "any html code and general php code goes where this line is";
//so above was almost all of the script with the following at the very bottom
//below is based on an earlier example
if (isset($_POST['Submit']))
{
//   query-----
 if( username and pass )
    {
    echo"<script language='javascript'>window.location.href='login.php'</script>";
    }
} else {
echo "<script>alert('Username/password pair is invalid.Please try again.')</script>";
}
echo "</body></html>";
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi,
The background will be blank only as the control is first going to the alert function ;
You can do like this.........
You have this alert and location inside two functions and call them when required...

I will just rephrase that to make it much more clearer.
"To show the page in the background, the alert(); script must be at the very bottom of the page where the footers would be." Functions are just another way of calling them.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Another thing you can do to reduce the space used is to use bicubic resize the make the images half the height and half the width but for large images this technique can use a lot of cpu when resizing them back with a bicubic resize unless you just use html to pixel resize to the original size.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you are talking about the page it redirects to (http://www.swoopo.co.uk/) then my answer is as below:
As for the counters, Ajax or Java would have been used for the live changes (since the countdown counts up a bit when someone bids & displays a red box when someone bids). So php isn't really used in this case. Also one way for doing the live updates which with that many bids may cause a bit of a high server load is for each bid, a mysql entry is updated saying what the new bid is and updates the mysql time to something like time+2 seconds. But one thing that will save a bit of server load is instead of every second updating the time in the database, Java/Ajax updates the time in the database whenever a bid is placed and the user end updates the countdown locally every second. Then you may think what about those who just entered the page who haven't got an accurate reading of how much time is left. Well on the same row as the number of seconds left would be another column in the database for when it was last updated. So the computer can subtract the current time from the last updated time then subtract the answer from the time remaining as shown in the database which then provides the latest timing of the item for the computer to locally count down. That's the theory (and in Java/Ajax not php)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It has to be like divachix, please comment or send me a message if you are interested.

If you are talking about http://divachix.com/ then it shouldn't be too hard for most parts to recreate and I can help with the php and javascript codes/scripts. You may also want to use mysql databases or a text file system to record all site data?

As for how to start, I would suggest to make a basic single page html file template then adding the php script to the file to automatically generate the rest of the pages according to data entered into the mysql-databases/text-files. Also to make the url system look pretty, you can use a htaccess rewriterule system. The Javascript would mainly be used for the menus although it wouldn't be very good for the search engine optimization.

Note for stottlifey:
If you are interested, I can help you create anything too hard (maybe most of it) live on msn. Just let me know and I will pm you my msn details.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you want to keep your old script then try adding a visual validator where you enter the numbers/letters you see in a picture into a field to submit the form. All you need is to make a bunch of pictures and make one at random display and the value that the user needs to place in could be the file name. But the filename would need to be a hash and to compare the validator field, the validator field would need to be hashed to match the filename. From what I have read that is how some of the latest validators do it.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

i built one a few months back. look here. it still has a test script up. this one was made for people who wanted a chat but didn't have access to a database. it can be modified to do anything. i currently trying to find time to add features like admin functionality and smilies ect.

http://www.daniweb.com/forums/thread126462.html

I have read the information from the link and the reason why you were able to not use databases and have better live streaming is because you used ajax where as my theory in post #2 was done in pure php and javascript. And that is when the sentence below which I mentioned in post #2 explained that it would be better in ajax/java

Well generally chat applets/applications are done by client side software such as Java/Ajax.

So basically a database is only required if you don't use a client side language that can communicate with another computer.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well generally chat applets/applications are done by client side software such as Java/Ajax. But if you want it to be done in php, it won't be the fastest and may cause extra cpu usage of the server if it is done by php. So to do it with php, you would need an iframe which refreshes once every 2000 milliseconds (2 seconds) and gets an update on if there are any new messages. Then if a new message is detected, the php script passes onto a javascript the signal which causes the entire page (target=_top) to refresh or as you have suggested, just for another window to popup with the new message. And if the entire page is refreshed, it can retrieve all the messages from the conversation through a mysql database with one column being the logon id which all people in the same conversation share the same id. Hope that theory helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the below code and adjust the mysql query accordingly to your database design:

$access=mysql_query("SELECT * FROM `table` WHERE `column name` = '1'");
if (mysql_num_rows($access)!==0)
    {
    //Insert here data they can only view if the mysql column value = 1
    //You could also just place here "exit;" without the quotes the skip
    //all code below.
    }
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
$sql = 'staff.emp_no, staff.fName, staff.lName, event.event_date, event.timeStart, event.timeEnd, event.emp_no, event.agenda FROM staff, event WHERE staff.emp_no = event.emp_no AND event.emp_no = "$check_array" AND event.event_date = "$e_date" AND timeStart = "$s_time"';

Quotations inside quotations. That just returns the string of the name of the variable and not what the value of the variable is. Also in addition, you need to add the method you are using at the beginning. I assume you are using the Select method. So try the following:

$sql = 'SELECT staff.emp_no, staff.fName, staff.lName, event.event_date, event.timeStart, event.timeEnd, event.emp_no, event.agenda FROM `staff`, `event` WHERE staff.emp_no = event.emp_no AND event.emp_no = "'.$check_array.'" AND event.event_date = "'.$e_date.'" AND staff.timeStart = "'.$s_time.'"';

-or-

$sql = 'SELECT staff.emp_no, staff.fName, staff.lName, event.event_date, event.timeStart, event.timeEnd, event.emp_no, event.agenda FROM `staff`, `event` WHERE staff.emp_no = event.emp_no AND event.emp_no = "'.$check_array.'" AND event.event_date = "'.$e_date.'" AND event.timeStart = "'.$s_time.'"';

In the 2 above code boxes, the only difference is which table the column timeStart is associated with at the end of the code. Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I did a bit of searching on the w3 website and found a javascript code which detects what browser you are using. So if it is javascript you are trying to use then the below code allows 2 separate codes to be used, 1 for Internet Explorer while the other js code is for any other browser. So the script is:

<script type="text/javascript">
var browser=navigator.appName;
if (browser="Microsoft Internet Explorer")
{
//Internet explorer code
} else {
//Code for any other browser
}
</script>

And as the comments show in the code box above, you can place separate code for Internet Explorer.

Note: Next time please try and post in the appropriate section as this thread currently has no reference to php other than that the javascript is been echo""; by php.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Why not do what php (Hypertext Preprocessor) was designed to do and make the php script to generate the javascript code which is then used by the browser. So you would make the php script to dump all the data into a large javascript code as arrays and every 10 seconds, the javascript can switch to the next array line (eg. from array[0] to array[1]) to display. That would be your best solution. So below is an example javascript after the php/Hypertext Preprocessor has generated the javascript:

var spanarray=new Array();
spanarray[0]='<span class="att_name"> 
<a href="attorney-detail.asp?pageTitle=AttorneyName&amp;id=94">Patricia L. Holland</a></span>';
spanarray[1]="second to display";
spanarray[2]="third to display";

var spanarrayb=new Array();
spanarrayb[0]='<span class="att_spec">Employment &amp; Labor Law</span>';
spanarrayb[1]="second to display";
spanarrayb[2]="third to display";

So a php script would have generated the above code and the below script appends the data every 10 seconds but will need a bit more working on.

var row=0;
while (spanarray[row]!=="")
{
document.write(spanarray[row]+"<br />
"+spanarrayb[row]);

row+=1;
setTimeout('',10000);
}

Sorry if the Javascript isn't 100% accurate but it's not often I use Javascript.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I want the user to choose the quantity and pass the variable to my form, please help

If you are meaning to setup another page/form which submits to this form the quantity then first the code you mentioned will need to be altered to the below:

<form method="post" action="https://pay.com/live/shop/add_to_cart">
Qty:
<input name="cantidad" type="text" id="cantidad" size="2" />
<br />
<input type="hidden" name="store" value="project321">
<input type="hidden" name="need_to_ship" value="no">
<input type="hidden" name="need_to_tax" value="no">
<input type="hidden" name="identifier" value="<?php echo $row_rsMiscDetail['part_number']; ?>">
<input type="hidden" name="description" value="<?php echo $row_rsMiscDetail['product_name']; ?> <?php echo $row_rsMiscDetail['product_model']; ?>">
<input type="hidden" name="quantity" value="<?php echo $_POST["cantidad"]; ?>">
<input type="hidden" name="price" value="<?php echo $row_rsMiscDetail['price']; ?>">
<input type="hidden" name="fingerprint" value="820a4a580170e88df93d26beb7a2eafa">
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="center" valign="bottom"><label>
<input name="submit" type="image" id="submit" onclick="this.form.submit()" src="images/buy_button.png" alt="add_to_cart" />
</label></td>
</tr>
</table>
</form>

Also the form that submits the quantity to the above form would look something like below: (change the string/text page_name to the name of the php page which contains the above code.

<form method='post' action='page_name.php' style='margin:0; padding:0;'>
Quantity number: <input type='text' value='1' name='cantidad' size='5' maxlength='4'> 
<input type='submit' value='submit'>
</form>

And that should allow your users to submit a custom quantity number.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

^(http://|[url]https://)?(www\.)?([/url][a-zA-Z0-9-]+\.)*([a-zA-Z0-9-]+)(\.[a-zA-Z]{2,3})+(/|$) That is as close as I can get. It will let you get "domain" out of all the following examples:

domain.com
www.sub.domain.com.au/lolerskates
http://www.massive.domain.com.au.cd.wiz/index.php?link=http://www.anotherdomain.com/
http://domain.com/
//but it won't pick up on the following domains:
www.sub.dom.com //wait... it will by chance
www.sub.dom.com.au //this will grab "com" instead of "dom"

So unless the domain name is 3 letters or less, that will work. I also don't know how the $n variable is treated when there are multiple matches for ([a-zA-Z]+)* . You may have to use an alternative method...

Just thought of this:

$bits = explode('/', $url);
//will yield ("http:","","www.domain.com","images","example.jpg")
//or ("www.domain.com","images","example.jpg") ("www." optional)
$i = 0;
if ($bits[i] == 'http:'){ //which bit of $bits do we want?
  $i += 2;
}
$bits = explode('.', $bits[$i]);
//will yield ("www", "sub", "domain", "com", "au")
//where most of those bits are optional except "domain" and at least one of the "com" bits
$i=0;
if ($bits[$i] == 'www'){
  $i++;
}
while (isset($bits[$i])){
  //do a check on the length or something else
  $i++;
}
//then try to determine which element in $bits is the domain.
//I suggest that it's the last element that is longer then 3 chars but not always.

Great example with the explode() function that I didn't know even existed. With the information in the quote above, I was able to produce the following code that from what I can see, solves how to get just the domain name from a url.

function domain($domainb)
	{
	$bits = explode('/', $domainb);
	if …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

In my opinion, I would use the html answer.
If you are meaning to open links in new tabs, just use the html code target=_blank. So to open links in the tabs (in browser without tabs - new windows) use:

<a href="link.htm" target="_blank">

Also if you are using iframes or regular frames and you want the link to open on the entire page (not just in the frame) use the following:

<a href="link.htm" target="_top">

As for the link, it can be found at:
http://www.allwebco-templates.com/support/S_target_link.htm

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
if (file_exists($fullpath)) {

Also the above line of code is invalid due to what $fullpath variable contains. It is impossible to use url's in the file_exists. The file exist function is design for relative paths such as
"../../../folder/file.php". For the answer, someone named justin at php.net has made a function that will detect url's. So the link to that code:
http://au2.php.net/manual/en/function.file-exists.php
And your modified code will be:

<?
function url_exists($url) {
    // Version 4.x supported
    $handle   = curl_init($url);
    if (false === $handle)
    {
        return false;
    }
    curl_setopt($handle, CURLOPT_HEADER, false);
    curl_setopt($handle, CURLOPT_FAILONERROR, true);  // this works
    curl_setopt($handle, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") ); // request as if Firefox   
    curl_setopt($handle, CURLOPT_NOBODY, true);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, false);
    $connectable = curl_exec($handle);
    curl_close($handle);  
    return $connectable;
}
		if (!empty($row_AUTO_SKU_WS['Pictures'])) {
			$images = explode(" ", $row_AUTO_SKU_WS['Pictures']);
			$images = str_replace(' ', '', $images); 
			$count = count($images);
			$fullpath = "http://xx.xx.xxx.xxx/birkeys/dealerservices/images/auto/".$images[0];
		}		

		if (isset($images)) {
			if (url_exists($fullpath)) {
				echo "<a href=\"http://xx.xx.xxx.xxx/birkeys/dealerservices/images/auto/".$images[0]."\" rel=\"lightbox[thumbnails]\"><img src=\"http%3A%2F%2F69.80.208.156/birkeys/phpThumb.php?src=/birkeys/dealerservices/images/auto/".$images[0]."&w=375px\" alt=\"\" style=\"border: solid 1px #333; margin-bottom: 11px;\" /></a>";

				$count--;
				$i=1;

				while($i<=$count) {
					if ($images[$i] != "") {
						echo "<a href=\"http://xx.xx.xxx.xxx/birkeys/dealerservices/images/auto/".$images[$i]."\" rel=\"lytebox[thumbnails]\"><img src=\"http://xx.xx.xxx.xxx/birkeys/dealerservices/images/auto/".$images[$i]."&w=116px&h=87\" alt=\"\" style=\"border: solid 1px #333; margin: 0px 11px 11px 0px;\" /></a>";
					}
					$i++;
				}

			} else { echo "File Error!<br/>".$fullpath; }
	
		} else {
			echo "<br/>No Preview Available<br/>";
		}		
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
"^(http://|https://)?(www\.)?([a-zA-Z0-9-]+\.)*([a-zA-Z]+)\.(com|net|org|co\.uk|com\.au|tv|biz|etc)(/|$)"

should work (as a pattern) and will return false for invalid URL's. The domain will be in $4.

When I was first making this preg_replace(), I was at first thinking that until I descovered that businesses can pay for their own top level domains. So technically there are potentially infinite top level domains (eg. .com or .qld.au). Also another problem has occurred for the your preg replace (and my version) is when trying to filter the below url it messes up in different ways each time:

http://www.example.com/index.php?link=http://www.example.com

So if businesses can make their own top level domains then that means I need to program the preg replace to detect the .com/.qld.au/.mil or whatever it may be. And also I need the preg replace to somehow not get mixed up the the above example url as it occurs a lot. But nice try though since you may not have known about custom top level domains.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I would suggest changing 'sample.js' to 'sample.php' then use sessions to transfer the value and echo the value into the file. A sample is as below and make sure the first line is exactly the same:

<? session_start(); ?>
//to display the value in the javascript
var variable=<? echo $_SESSION['variable']; ?>;
						case 'ol' :
						case 'ul' :
							var isFirstLevel = !htmlNode.parentNode.nodeName.IEquals( 'ul', 'ol', 'li', 'dl', 'dt', 'dd' ) ;

							this._AppendChildNodes( htmlNode, stringBuilder, prefix ) ;

							if ( isFirstLevel && stringBuilder[ stringBuilder.length - 1 ] != "\n" ) {
								stringBuilder.push( '\n' ) ;
							}

							break ;

						case 'li' :

							if( stringBuilder.length > 1)
							{
								var sLastStr = stringBuilder[ stringBuilder.length - 1 ] ;
								if ( sLastStr != ";" && sLastStr != ":" && sLastStr != "#" && sLastStr != "*")
									stringBuilder.push( '\n' + prefix ) ;
							}

							var parent = htmlNode.parentNode ;
							var listType = "#" ;

							while ( parent )
							{
								if ( parent.nodeName.toLowerCase() == 'ul' )
								{
									listType = "*" ;
									break ;
								}
								else if ( parent.nodeName.toLowerCase() == 'ol' )
								{
									listType = "#" ;
									break ;
								}
								else if ( parent.nodeName.toLowerCase() != 'li' )
									break ;

								parent = parent.parentNode ;
							}

							stringBuilder.push( listType ) ;
							this._AppendChildNodes( htmlNode, stringBuilder, prefix + listType ) ;

							break ;

And in the php file use the following with the first session_start() being in the first line or in the php headers:

<? session_start();
//your headers
//your code
$_SESSION['variable']=$myvariable; //must be before including javascript file.
//include javascript file
//your code …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I am having 2 technical difficulties with a web search engine I have created. One is that the search bot comes to a url and never stops loading. Below is the current script I use to validate a url and to capture the information but my question is: How do you time how long it takes for file_get_contents() to load a url and if it takes longer than 10 seconds how to make it skip the url automatically and continue with the rest?

<?
function url_exists($url) {
    // Version 4.x supported
    $handle   = curl_init($url);
    if (false === $handle)
    {
        return false;
    }
    curl_setopt($handle, CURLOPT_HEADER, false);
    curl_setopt($handle, CURLOPT_FAILONERROR, true);
    curl_setopt($handle, CURLOPT_HTTPHEADER, Array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.15) Gecko/20080623 Firefox/2.0.0.15") ); // request as if Firefox   
    curl_setopt($handle, CURLOPT_NOBODY, true);
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, false);
    $connectable = curl_exec($handle);
    curl_close($handle);  
    return $connectable;
}

$address='http://www.google.com.au/';
if (url_exists($address))
    {
    file_get_contents($address);
    }
$address='http://www.example.com/';
if (url_exists($address))
    {
    file_get_contents($address);
    }
?>

My second question which I though I would ask while I'm posting is how do I correct the below preg_replace to filter any url to just the domain? The below code will only work half the time but the rest of the time will return the entire url.

<?
$domain=@preg_replace('/((http\:\/\/|https\:\/\/)?.*(\.[a-zA-Z][a-zA-Z]\/|\.[a-zA-Z][a-zA-Z][a-zA-Z]\/|\.[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]\/))(.*)(\.[a-zA-Z][a-zA-Z]\/|\.[a-zA-Z][a-zA-Z][a-zA-Z]\/|\.[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]\/)?(.*)?(\.[a-zA-Z][a-zA-Z]\/|\.[a-zA-Z][a-zA-Z][a-zA-Z]\/|\.[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]\/)?(.*)?/i','$1',$url);
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Just before I mark this thread as solved, I have managed to find a tutorial for displaying text in Java and now my code is as below.

import java.applet.*;
import java.awt.*;
 

//the below name starts the applet with the files name called 'filename'.
public class filename extends Applet
    {
        short vara;
        int varb;
        long varc;
        double vard;
        float vare;
        byte varf;
        char varg;
        String varh;
        boolean vari;

    public void init()
        {
        vara=1;
        varb=127349634;
        varc=2000000000;
        vard=3.57;
        vare=95;
        varf='i';
        varg='/';
        varh="this is a string";
        vari=true;
        }
 

// This method gets called when the applet is terminated
// That's when the user goes to another page or exits the browser.
    public void stop()
        {
     // no actions needed here now.
        }
 

// The standard method that you have to use to paint things on screen
    public void paint(Graphics g)
        {
        g.drawString("short="+vara,10,20);
        g.drawString("int="+varb,10,40);
        g.drawString("long="+varc,10,60);
        g.drawString("double="+vard,10,80);
        g.drawString("float="+vare,10,100);
        g.drawString("byte="+varf,10,120);
        g.drawString("char="+varg,10,140);
        g.drawString("String="+varh,10,160);
        g.drawString("boolean="+vari,10,180);
        }

    }

Thanks for the help peoples as this is my first working Java applet and can't wait to do more (from online tutorials).

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Then I guess I will need to do a lot more research on Java to find out how to make proper Java applets. But for the time been I will leave this thread open for those who might know what makes a Java applet work.
But other than any comments on that I guess my debugging problem is mainly solved (just a lot of research to do).

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I just searched the web for more info on what the path variable should be and I found a handy link at http://www.apl.jhu.edu/~hall/java/beginner/settingup.html
So I re-followed the instructions in afzal_01's post (also copied the java source code file into the bin directory) and although it exported the .class file, none of my 5 web browsers recognize the file. Even though step 3 will view the file, no browser will view the .class file. And all the browsers still report the "applet filename notinited" error as mentioned in the first post. Is there any explination to why the command prompt can view the java file but none of my web browser will view the .class file? (Web browsers tested: Internet Explorer, Safari, Google Crome, Firefox, Opera)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You follow the following steps to run the program:
1. Save the file with name FileName.java(Standard java code convention not mandator but recommended)
2.javac FileName.java
to compile, this will create FileName.class file
3.java FileName
will run and display your desired output.

I have just tried those steps and steps 2 and 3 each came with an error. When I tried step 2 through the windows command prompt (I was in the same directory as the script), a message then appeared inside the command prompt saying "'javac' is not recognized as an internal or external command, operable program or batch file."
Does that mean I need to install something for the computer to recognized that command? And step 3 which had a more useful error displayed the following which I have seen in JCreator before but wont redisplay in JCreator:
'Exception in thread "main" java.lang.NoClassDefFoundError: filename'
So what could possibly cause the above fatal error which by the looks of it, prevents the applet from compiling properly. How do I solve the errors?
Note: before I was trying to run the applet through the browser which is why I didn't see these 2 errors before.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I must know if this script is valid to determine if the Java console and my Java compiler need reinstalling. I have tried so many samples and my browser shows an invalid message. My file is named 'filename.class' and below is the script I have used to test Java on my computer (but I don't know much Java).

class filename
    {
    public static void main(String[] args)
        {
        short vara;
        int varb;
        long varc;
        double vard;
        float vare;
        byte varf;
        char varg;
        String varh;
        boolean vari;

        vara=1;
        varb=127349634;
        varc=400000000;
        vard=3.6290048129;
        vare=95;
        varf='i';
        varg='/';
        varh="this is a string";
        vari=true;

        System.out.print("short="+vara);
        System.out.print("int="+varb);
        System.out.print("long="+varc);
        System.out.print("double="+vard);
        System.out.print("float="+vare);
        System.out.print("byte="+varf);
        System.out.print("char="+varg);
        System.out.print("String="+varh);
        System.out.print("boolean="+vari);
        }
    }

Let me know if there are any errors in the above script. Also, the error report that I am given is first a message in the browser status bar saying "applet filename notinited" (filename is the name of the applet). Also the report is as follows:

load: filename.class is not public or has no public constructor.
java.lang.IllegalAccessException: Class sun.applet.AppletPanel can not access a member of class filename with modifiers ""
	at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.applet.AppletPanel.createApplet(Unknown Source)
	at sun.plugin.AppletViewer.createApplet(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Does anybody know what is going on here because I have never gotten a single script to work.
P.S. My java compiler is "JCreator LE" and I have Java 3D installed.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I must ask about line 13. You used the function end(); which returns the value of an array between the brackets. If you want line 13 to end/exit the code, you must use the exit element or the code as showen below.

exit;

So now lines 11 to 14 would look as below if you want that if statement to exit the code.

if($emptyFields != "") {
header("Location: /signup.php?empty=1&$emptyFields");
exit; //needed to skip below code.
}
//rest of below code
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The only way that I know how to make subdomains (other than using the servers control panel) is by editing the apache httpd.conf file which you may be able to program a php script to do if you have full permissions of the server. Guides can be found at http://apptools.com/phptools/virtualhost.php So if you are the server administrator then just program a php script to edit the httpd.conf file as instructed in the above and the apache codes would look something like:

NameVirtualHost realdomain.com

<VirtualHost realdomain.com>
   DocumentRoot "C:\My Sites\Site1"
   ServerName subdomain.realdomain.com
</VirtualHost>

<VirtualHost realdomain.com>
   DocumentRoot "C:\My Sites\Site2"
   ServerName realdomain.com
</VirtualHost>

And obviously replace in the code above the term "realdomain.com" with your registered domain and replace the word "subdomain" with the name of your subdomain. But that is a sketch of what I think the apachie code needs to look like but would wait for further comments on the above code before copying it.

Also in the link I provided, you will need to ignore the information below the title: "Resolving the DNS issue" as you have a domain in the first place instead of localhost.

So basically, the only thing that php can really do is edit the apache httpd.conf file.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

To detect if a file has a virus, you need to check its memory dump/stack. You can find all about the virus memory stack with a Yahoo Search (the search term "virus memory stack" and click the link that tells yahoo the word stack is not stick) And at the bottom of the search page (in the link I've provided above) you will find a pdf file that can explain some of the memory dump/stack codes that may be harmful. So an example of a W32 file (I think it means 32-bit) is as follows:

81 E5 59 E6 5A ED and ebp, 0ED5AE659h
81 D4 0A A1 DA F9 adc esp, 0F9DAA10Ah
81 F1 D8 AF FF 07 xor ecx, 007FFAFD8h
81 CE A2 46 3E CB or esi, 0CB3E46A2h

or W64

48 81 CE 0E EB 43 23 or rsi, 2343EB0Eh
48 81 F0 3D DD 81 52 xor rax, 5281DD3Dh
48 81 D4 F4 BE 9A 43 adc rsp, 439ABEF4h
48 81 CB 36 F7 90 42 or rbx, 4290F736h

So from that data you extract from the files potential memory stack/dump you need to check for any harmful codes and if there are any, they can be rated and when the rating reaches a certain level, it is then classified as a virus. So that is what my theory is although it may be hard to make.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have read your code and could I ask what version of php you have. Because this very same error keeps on being reported onto these php forums and nobody truly knows the answer. That is why I am now starting to study these T_variable errors on daniwebs to see what bug is behind php. The only pattern I have so far come across is as follows.

<?php

I suspect that the above code needs to be replaced with the below. I'm not sure why but one possibility is that php version 6 may not support the above type of php opening. So try replacing the php opening as shown in the above box with what is shown in the below box. And as I can see, you will have a few replacements to do.

<?
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although I am not entirely familiar with mysqli query's, I do know that there is a chance of the $email variable being embeded wrong. Below is the script and its replacement.

//Your script:
$q = "SELECT uid FROM table WHERE email = '$email'";

//Above needs to be replaced with below:
$q = "SELECT uid FROM table WHERE email = '".$email."'";
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If so is this the correct syntax

$table = "abc";
$sql = "DELETE FROM $table WHERE *";
mysql_query($sql);

Below is the correct syntax:

$table = "abc";
$sql = "DELETE FROM `".$table."`";
mysql_query($sql);
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well it seems your only option is server side cookies as I call (an invented) them. Although I don't know how to code this with sessions but I will explain the theory. If you set up a Mysql database with 2 columns that will hold all of the session id data for all viewers. One column has their ip address while the other is the session id. When the user starts the session, the session id is recorded and their ip address if the ip address cannot be found. If their ip address is found then they can retrieve their previous session id. And each time they enter a page, the page looks up in the database their session id where the ip address in the database matches the ip address the user currently has. So basically you can use mysql to store the session id and the session id will allow you to unlock the rest of the session data from the server.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

move_uploaded_file($_FILES, 'pics/picture.jpg');

Repeating this three times (with pic2, pic3, pic4) doesn't seem to work.

The reason why that didn't work is because the array refers the the name of the file browse field in your html form. So what you put in 'pic1' should be the same as what you put in the type='file' field. This then brings the question of how to load the image multiple times. To solve the issue of loading the file multiple times, use the following code:

<?
$image=imagecreatefromjpeg($_FILES['uploadedfile']['name']);
?>

Then the image is stored in the variable $image where it can be used by the gd library. Note you may want to alter the imagecreatefrom*() to the appropriate supported format.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you are talking about using html meta tags in php then use the following (assuming you are placing it in the middle of your existing code:

echo "<META name=\"something\" content=\"something else\">";

Notice I put the backslash before each quotation mark in the html code. That is because of the surrounding quotation marks for the echo function. The following script (replacing the echo quotation marks) will do the same:

echo '<META name="something" content="something else">';

So if you where taking about html meta tags in php that should give you some idea on what it should look like.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

In which page to add this is in logout.php or login.php

The code I mentioned earlier is meant to be in logout.php as it removes the session.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I have a localhost server with Windows XP Pro and the Xampp server package but what I need is something to monitor the servers speed and performance. This includes CPU, ssl/php execution time, memory used and similar functions. Does anyone know where I could find such a program for free?
Thanks in advance

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Believe it or not this is just barley possible to do with php (and a little html). What you need to do is setup an iframe and make the link submit to the iframe with a url variable. Then when the iframe reloads, it gets the url variable and assigns it to a session variable making it available to the first page.

Below is the code for the page with the link (note that the very first thing the page starts with is the php code opening bracket:

<?
session_start();
$page=$_SESSION['page'];
?>
<iframe src='iframe.php' name='iframe' width='1' height='1' frameborder=0 scrolling='no'></iframe>
<a href='iframe.php?page=home.php' target='phpiframe'>Test Link</a>

Note that in the link, after the phrase "page=", it is then followed by what you want the $page variable to be. Now for the php iframe. So in the same folder, create a page named iframe.php and place in it the following code:

<?
session_start();
$_SESSION['page']=$_GET['page'];
?>

Now when you click the link it will return the "page=x" (in the link) as "$page=x". Just let me know if you need more info.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have gathered the below script from the official documentation at: http://au2.php.net/manual/en/function.session-destroy.php

<?php
session_start(); //must be at beginning of page

//in here is any miscellaneous logout data such as mysql scripts.

//Below destroys the session
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
?>

So the above script I have mentioned can go into the logout file with the any other logout data going where the comments are.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have checked your code and the last piece of php code at the end of the script should look something like below. Notice how I added $date=0 and $date+=1. That is because the date you were saying that wasn't being displayed hadn't been assigned any value at all. So try using the below code.

<?php
$date=0;
foreach ($week as $key => $val)
{
echo '<tr>';
// here you may need to add $date+=1; or $date-=1;
for ($i=0;$i<7;$i++)
{
$date+=1;
echo '<td align="center">'. $date .'</td>';
}
echo '</tr>';
}
?>

And please use code tags next time.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\globals\functions.php on line 35
The username and password provided did not match.

The error you have mentioned is from my experience, has always been the result of an invalid Mysql query. And I would say that your Mysql query has become invalid from an invalid database connection.

mysql_select_db($dbnames[$DATABASE_MAPLESTORY]);

	$result = mysql_query("SELECT * FROM `accounts` WHERE `name` = '" . $username . "'");

So above are the lines which I believe are needed to be focused on and need altering. So first alter the mysql_select_db line so instead of an array inside the brackets, as a test place the database name (not table name). Then for the Mysql query, add the optional variable at the end which I think is the connection variable. So the above should look something like below:

mysql_select_db("database name");

	$result = mysql_query("SELECT * FROM `accounts` WHERE `name` = '" . $username . "'",$conn);

So the above code is just roughly what it should be but the syntax can be checked at www.php.net