cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Thanks for the replies but I have just found out that it is mainly mysql query's that slow down the script big time. So I will try to use arrays and will try out memcache if memcache is a default php library.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
ini_set('memory_limit','384M');

Surprisingly adding the line above seems to help a little but not tremendously. But is there anything which directly relates to the execution speed or speeds up the execution time to a much faster speed?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have made a PHP script which takes days to execute (Web Article Generator) and is there any way that I can make the while loops do more Instructions Per Second using php. Because when executing the script, the servers resources are very low (15% memory & about 9% of cpus) which means the server has plenty of room for a faster execution time. The only thing that I can think of so far is to have a page with 16 iframes all executing a separate while loop of the same php applet but I really need a PHP solution.
If you have any suggestions for increasing the Scripts Instructions Per Second or making the execution time faster then please post them.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have had to do similar things in the past and I find division and rounding to be the answer. An example is as below:

$loop=0;
while ($loop<=100)
	{
	$val=$loop/10;
	if ($val==round($val))
		{
		echo ($i % ($amount / 10) == 0) ? "<div class=\"load\"></div>" : "";
		}
	$loop+=1;
	}

Hope that helps to answer your question.

MVied commented: Your response helped me solve my problem. Much thanks. +1
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although I don't 100% understand what you are requesting, I shall give you a script which shows how displaying the results. This however takes the knowledge of mysql querys, php and html lists.

//$_POST['term1'] is first posted search variable
//$_POST['term2'] is second posted search variable
//$_POST['term3'] is third posted search variable
$resulta=mysql_query("SELECT * FROM `tablename` WHERE `term`='".$_POST['term1']."'");
echo "<ol>The term is: ".$_POST['term1']."<br>";
while ($rowa=mysql_fetch_array($resulta))
    {
    echo "<li type='1'>".$rowa['definition_column_name']; //html li might be different
    }
echo "</ol>";


$resultb=mysql_query("SELECT * FROM `tablename` WHERE `term`='".$_POST['term2']."'");
echo "<ol>The term is: ".$_POST['term2']."<br>";
while ($rowb=mysql_fetch_array($resultb))
    {
    echo "<li type='1'>".$rowb['definition_column_name']; //html li might be different
    }
echo "</ol>";


$resultc=mysql_query("SELECT * FROM `tablename` WHERE `term`='".$_POST['term2']."'");
echo "<ol>The term is: ".$_POST['term2']."<br>";
while ($rowc=mysql_fetch_array($resultc))
    {
    echo "<li type='1'>".$rowc['definition_column_name']; //html li might be different
    }
echo "</ol>";

So the above will show you the basics of displaying the result and hopefully give you enough to help answer some of the questions. Also note that the html side of the lists in the script may not be accurate and the variables will need adjusting to what they are set in your current page/mysql database.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Found your problem which I had too when I did my first GD script the last line is incorrect as it has an unsigned variable within the function.

imagepng($image_e,'aa.png',0);

So replace the above with below

imagepng($image_p,'aa.png',0);

Notice the letter 'e' in the first box and the letter 'p' in the second box (after the word image). That is your bug. Although your script shows the letter 'e', it needs to be replaced with the letter 'p'. So the overall code will be:

// The file
$filename = 'd.png';
$percent = 0.5;
 
// Content type
 
 
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = 400;
$new_height = 400;

// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefrompng($filename);
imagealphablending($im_dest, false);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagesavealpha($image_p, true);
// Output
imagepng($image_p,'aa.png',0); //this is the line that has been changed
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sure, nobody said it couldn't be done, it'll just take all day, possibly all week depending on how many sites you plan to spider. Google actually claims to index 2e9 pages.

Just to add to the statistics, I remember reading in Google 'to the power of project' that Google now claims to have 1 trillion pages indexed. Also from the Google web alerts I have
(eg. inurl:cwarn23.info) I have found that Google usually revisits the same website within 8 days but one time in the past year has taken 14 days. Also I have tested my script to index an average of 16 pages per second (at the most). So I hope you find those statistics useful.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I don't think you will find too many php web spider scripts only because php is an interpreted language and will be quite slow.

I agree with RobRob here, PHP just isn't powerful enough to be doing this sort of task.

Well from the quotes above, I may just be able to prove all of that wrong with a PHP bot series I am working on. This post is not advertiesment but is to make the users 'R0bb0b' and 'heenix' and 'monsterpot' aware of what PHP is really capable of.
I have managed to make a bot which will index all of the urls that a linked to (within a tree type format) and will keep on indexing the web until it runs out of links. I will provide you with the source for you to make your javascript finder and currently the below script only indexes urls which is needed to scan more than one page.

if (isset($_GET['url']))
	{
	include("db.php");
	mysql_connect($dbhost,$accountname,$password)
	or die("Could not connect to MySQL server");
	mysql_select_db($database) or die(mysql_error()."Could not select database");
	$file=file_get_contents($_GET['url']);
	$links=preg_split('/(href\=\'|href\=\"|href\=)/is',$file);
	//$file=preg_replace('/(.*)(\ href\=\"|\ href\=\'|\ href=)(.*\ |.*\"|.*\'|.*>)/is','$2|^=^|',$file,1);
	//echo $file."<br>";
	
	mysql_query("INSERT INTO `indextemp` SET `url`='".$_GET['url']."', `stage`='1'");
	$id=1;
	while (isset($links[$id]))
		{
		$links[$id]=preg_replace("/([^\'])\'(.*)/is",'$1',$links[$id]);
		$links[$id]=preg_replace("/([^\"])\"(.*)/is",'$1',$links[$id]);
		$links[$id]=preg_replace("/([^\>])\>(.*)/is",'$1',$links[$id]);
		$links[$id]=preg_replace("/([^ ])\ (.*)/is",'$1',$links[$id]);
		$links[$id]=preg_replace("/([^\'])\'(.*)/i",'$1',$links[$id]);
		$links[$id]=preg_replace("/([^\"])\"(.*)/i",'$1',$links[$id]);
		$links[$id]=preg_replace("/([^\>])\>(.*)/i",'$1',$links[$id]);
		$links[$id]=@preg_replace("/([^ ])\ (.*)/i",'$1',$links[$id]);
		
		$ifexists=mysql_query("SELECT * FROM `indextemp` WHERE `url`='".$links[$id]."'");
		if (mysql_num_rows($ifexists)==0 && strlen($links[$id])>16)
			{
			mysql_query("INSERT INTO `indextemp` SET `url`='".$links[$id]."', `stage`='0'");
			echo $links[$id]."<br>";
			}
		$id+=1;
		}
	unset ($links);
	$continue=1;
	while ($continue=1)
		{
		
		$sqllinksa=mysql_query("SELECT * FROM `indextemp` WHERE `stage`='0'");
		while ($sqllinks=mysql_fetch_array($sqllinksa))
			{
			$file=file_get_contents($sqllinks['url']);
			$links=preg_split('/(href\=\'|href\=\"|href\=)/is',$file);
			
			mysql_query("UPDATE `indextemp` SET `stage`='1' WHERE …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sorry if this is in the wrong forum but I couldn't find a Flash forum so I am just guessing from previous posts that this is the right forum for the programming side of Flash.

A few months ago I got a flash program called '3D Flash Animator' but comes with a scripting language called actionscript. I have checked Wikipedia about actionscript and I am guessing that actionscript is the proper flash language. But what I want to know is are there any sites that explain the actionscript syntax in the way that php.net explains the php syntax? I have just started learning actionscript and am finding it very confusing without the proper tutorials. So please if you know of great actionscript tutorials or sites that explain the actionscript syntax like php.net explains the php syntax then post the links here.

Thanks in advance.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well $_GET[] should always have quotation marks between the brackets and numbers/letters/characters between the quotation marks. So $_GET[] on its own isn't a valid command. You need something like $_GET or $_GET and if it does not exist in the url bar then it will return a string with 0 letters 0 numbers and 0 characters. So basically a $_GET statement which has letters between the brackets and quotation marks but those letters/variable does not exist in the url bar will return the below string if you remove the quotation marks:
"" - as you can see there is nothing between those quotation marks so you will just receive a blank string if it does not exist in the url bar.

So just a reminder, you always need something between those brackets (more than just quotation marks).

Edit:
I just saw more of what you are asking for and to check if there is nothing there i prefer to use the preg replace function just like follows:

$urlvars=preg_replace('/(.*)?(.*)/i',$2,$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
if ($urlvars='')
	{
	//code in here
	}

The preg replace should be something along those lines.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

So the line in the middle of the example above is basically telling the server to 'get' the variable 'nflag' from the url bar and to echo/display it.
From: http://www.daniweb.com/forums/thread147753.html

You may want to check the reply I made on your previous post.
The array $_GET[] basically just tells the server to get a variable from the url bar and the name of that variable goes between the two brackets. So say for example the address is as follows:
http://www.daniwebs.com/forums/newreply.php?do=postreply&t=14773
Then to get the variable 'do' you would use the following code to print/echo/display it to the browser:

<? echo $_GET['do']; ?>
Above produces below
postreply

or if you wanted to get the other variable in that address you would use

<? echo $_GET['t']; ?>
above produces below:
14773

So the $_GET array and any other array beginning with $_ (dollar sign then underscore) is a inbuilt function.
As for the default value, there is no default value as it only holds the values that are in the url bar.

Shanti C commented: Good Reply... +2
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

In my example of login.php, the variable was stored in $nflag with the use of the first 3 lines making it $nflag. Also the code $_GET retrieves the variable named nflag from the url bar.

Just in case if you are confused or are wondering on how the example I wrote for login.php works I shall explain each line. As most php programmers would know, lines 1 and 3 are the opening and closing of the php code. In line 2, the variable $nflag is being assigned to be just like the previous page so you wouldn't need to use an array to call the value and for good looks. Also below will work just the same:

<html><body>
The variable passed on is <? echo $_GET['nflag']; ?>.
</body></html>

So the line in the middle of the example above is basically telling the server to 'get' the variable 'nflag' from the url bar and to echo/display it.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Below is a script I made which will delay the page by 2 seconds however, although the page will be processed with the delay, you may find that the whole page may display at the same time (after 2 seconds).

<html>
<body>
<?php
$oldseconds=date(s);
if ($oldseconds==58)
	{
	$newseconds=='00';
	} else
if ($oldseconds==59)
	{
	$newseconds=='01';
	} else
	{
	$newseconds=$oldseconds+2;
	}
	while (date(s)!=$newseconds)
		{
		//anything before this loop may not be delayed
		//anything after this loop will be delayed.
		// But with some browsers or servers this
		// loop will delay the entire page
		}
//place below here what you want after 2 seconds
$cpu=exec('top -d 1 -n 1|grep Cpu | tail -n 1 | cut -c 25-33');
echo "The Current CPU Utilization is ".$cpu;
<?php
$mem=exec('top -n 1|grep Mem');
echo $mem;
?>
</body>
</html>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The best way to pass short variables such as a page title is using url variables so use the following code:

First page before redirect.

// Note it redirects to a php page.
echo "<meta http-equiv=Refresh content=0;url=login.php?nflag=".$nflag.">";

Login.php page

<?
$nflag=$_GET['nflag'];
?>
<html><body>
The variable passed on is <? echo $nflag; ?>.
</body></html>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Have you checked if cookies are enabled in Firefox because to use sessions you need the session ID which is usually stored in a cookie. If you haven't got cookies enabled in Firefox then try enabling them and see if that makes the sessions work.
-------
Also if it does turn out to be cookies and you want to keep cookies disabled then you could a, put the session id in the url bar (not very secure) or b, use what I have made and call server side cookies. That is when you store the session values and names of the values in a database (eg. mysql). Also each value goes on its own line with the users IP address in the same row as the session value and name of value. Then when the user visits a page, the server then checks for all rows matching the users IP address. So in your case, the server side cookie would probably be the Session ID. Nice little trick if you don't like cookies.

So let us know if it is just cookies that are disallowing the session as that is all that I can think of.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Below is a sample of a form using preview and submit if it helps.

<?
if (isset($_POST['submit']))
	{
	//form submission data
	}
?>

<html><body>
<form method='post'>
<textarea cols=50 rows=12 name='formtext'><? echo $_POST['formtext'] ?></textarea>
<input type='submit' value='submit' name='submit'>
<input type='submit value='preview' name='preview'>
</form>
</body></html>

<?
if (isset($_POST['preview']))
	{
	echo $_POST['formtext'];
	}
?>
ChintuChowdary commented: tahnks alot +1
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although I don't know about overwriting the image what I would do is to first submit the image to a temporary location. Then the script can read the file from that temporary location and create 2 new files each with there own sizes. Then you simply use the unlink function to delete the file at the temporary location.
Below is a sample from one of my old projects.

$imgfile='tmp/'.basename( $_FILES['uploadedfile']['name']);
//below line moves uploaded file but word 'uploadedfile' will
//need adjusting the the name of the browse field in the form.
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)
$newwidth=640;
$newheight=480;								
$tmpc=imagecreatetruecolor($newwidth,$newheight);
				
//Below is the thumbnail being set out				
imagecopyresampled($tmpc,imagecreatefromjpeg($imgfile),0,0,0,0,$newwidth,
$newheight,$width,$height);

$newwidth=160;
$newheight=120;

$tmpb=imagecreatetruecolor($newwidth,$newheight);
				
imagecopyresampled($tmpb,imagecreatefromjpeg($imgfile),0,0,0,0,$newwidth,
$newheight,$width,$height);
								
//===== Now to export
$fname='test';
imagejpeg($tmpc, "../pics/".$fname.".jpg", 90);
imagejpeg($tmpb, "../thumbs/".$fname.".jpg", 90);
unlink($imgfile);

So above are the basics and replace the phrase 'uploadedfile' in the first couple of lines with the name of the browse field. Hope the code above helps explain what to do.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

PHP Parse error: syntax error, unexpected T_VARIABLE in /home/mysite/public_html/guestbook/getdrawings.php on line 1

I have tested the provided code both as it currently is and with many different modifications and from what I have found, although with single character changes errors can be made, I don't think that with this code alone that a T_variable error could occure. Especially with line 1 being

<?php

The only possible error I could see on line one (if you have an odd server) is removing the letters

php

from line 1. Other than that I would say that a global variable such as ini settings may be interfering with the script.
So basically I just couldn't reproduce the error and was working for me fine.

Shanti C commented: Yes..Same for me also... +2
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

There is no way to hide HTML or JavaScript code from the user, these are client-side scripts and will need to be processed by the client browser, as such the code will need to be sent and can be viewed.

Although that is true, there are still 2 options on the board for hiding all of the client side code with only a small amount of additional code being displayed. That is, Java/Ajax or Flash. All you need to do is first upload your html files to the server into a hidden folder (a folder with a robots.txt hiding it) then setup a Java or Flash applet to view those pages.
So basically you would just be using the Java/Flash applet to view the webpages while the webpages are in an unknown location. I know bits and pieces of flash if you would like me to try and help you with that and just as a note, no page will need any conversion.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

when user select his unit corresponding value again fetch form mysql and fill to other combobox but onchange() my browers url change http://localhost/MIS/PS/add/add_ps2.php and other combobox value are not fetching form mysql. i make a function sel() <document.form.submit()> onchange combobox item.but problem is not solving
please help me form rohit

Although the information in that quote is hard to understand (a bit fragmented), I can spot several things wrong with the below mysql query. One is you have a bug in the debugger, that is the last line of the below code and the variable in the mysql query needs the appropriate surrounding code so the script searches for the value of the variable instead of the name of the variable.

$res = mysql_query("SELECT distinct untcode FROM table where division='$division'")
or die("Invalid query: " . mysql_query());

So basically replace the above with the below.

$res = mysql_query("SELECT `distinct untcode` FROM `table` where `division`='".$division."'")
or die("Invalid query: " . mysql_error());

or if the words 'distinct' and 'untcode' are two separate columns then use the following:

$res = mysql_query("SELECT `distinct`, `untcode` FROM `table` where `division`='".$division."'")
or die("Invalid query: " . mysql_error());

So the above is what I have notices without fully understanding the problem although you did describe what is happening ok.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have seen on the news about new technology called exitreality. Also I have also seen examples of the new technology at http://www.exitreality.com/ where you can have 3D websites but how can I add the 3D objects to my website. I have searched their website and found no language documentation so where do I start and how do I make 3D websites with this new cool technology. I have no clue on how to develop websites for exitreality or where to begin since it has just been released so does anyone here know how to develop websites for exitreality.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Unless the variable is not posted in the url bar when clicking the link, I would say the bug is in a mysql query inside the news.php page. So when you click the link that leads to your (currently) blank article, is the identity/variable in the url bar? If it is then try using something like the code below to retrieve the data when in the news.php page.

$sqlresult=mysql_query("SELECT * FROM `news_posts` WHERE `post_title`='".$_GET['post']."'");
$sqlresult=mysql_fetch_array($sqlresult);
echo $sqlresult['newspost'];

Also the the word 'newspost' to what the name of the column which contains the articles news content but keep the quotes around it.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Id is definitely a column in the table.

If all your columns are not starting with listings. (in the field name like you have mentioned in the quote) and if you have the appropriate version of mysql then your code should look like the following:

$query_rs_listings = "SELECT `Id`, `town`, `mkt_area`, `list_price`, `address`, `ml`, `list_office`, `list_office_phone`, `property_type`, `baths`, `bedrooms`, `square_feet`, `acreage` FROM `listings` WHERE `property_type`='".$_GET[property_type]."'";

Also if you are selecting all columns then you can use the following:

$query_rs_listings = "SELECT * FROM `listings` WHERE `property_type`='".$_GET[property_type]."'";
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

My biggest recommendation would be to use a prebuilt syntax highlighter and just add a syntax extension. Geshi is one my my favorites.

Thanks for that reply and Geshi is doing the job perfectly. So the code below I replaced with the code provided by Geshi (keeping in mind Geshi uses other files) with a few other minor changes to the attachment in the first post.

$textb=preg_replace("/([^)])( |
|	|\>| \>|
\>|	\>)(.*)\((.*)?\)([^(])?()/is",'$1$2<font color=#c#o#l#o#r#2#>$3($4)</font>$5',$textb);

		$textb=str_replace('>	<','><',$textb);
		
		$textb=preg_replace("/(\'(.*)\')/is","<font color=#c#o#l#o#r#3#>'$2'</font>",$textb);
		$textb=preg_replace("/(\'([^'])\')/is","'</font>$2<font color=#c#o#l#o#r#3#>'",$textb);


		$textb=preg_replace('/(\"(.*)\")/is','<font color=#c#o#l#o#r#3#>"$2"</font>',$textb);
		$textb=preg_replace('/(\"([^"])\")/is','"</font>$2<font color=#c#o#l#o#r#3#>"',$textb);		
		
		$textb=str_replace('globalvar','<b>globalvar</b>',$textb);
		$textb=preg_replace('/( |
|	|\>| \>|
\>|	\>)var /is','$1<b>var </b>',$textb);

So if you check the manual of the version of Geshi you have, the code provided to view the source in the syntax highlighter replaced that code.

So thanks for that reply as it has solved my question and I love how Geshi supports about 106 types of syntax's.

*Solved*

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sorry about the double post but I couldn't find the edit button.
Below is the code which would go into the html page to read the php page.

<html><head>
<title>Review Website</title>

<script>function geturlvars()
{
    var vars = window.location.href.slice(window.location.href.indexOf('?') + 1);
    vars='http://www.yourdomain.com/index.php?'+vars;
    return vars;
}</script>
</head>

<body bgcolor=#FFFFFF topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0>
<script>document.write("<iframe border=0 FRAMEBORDER=0 scrolling=auto width=100% height=100% src='"+geturlvars()+"' name='topframe'></iframe>");</script>

</body>

</html>

Also replace the below with the domain of your website with php (but keep the www.)

www.yourdomain.com

So with the above code, you should be able to place together a php website with is viewed by a pure html/javascript website.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If SEO (Search Engine Optimization) is what I think it is (I googled it), there are 2 ways of doing it. The easy way and the hard way with great results.
The easy way is just to have a page with iframes or as mentioned above javascript. But the hard way is to not only use iframes and javascript in the ways mentioned above, but to also use javascript to have variables in the url bar and those variables then go into the iframe locations. Although another method is to instead of iframes, to use something as follows.

<script type="text/javascript src="domain.com/index.php?"javascript:geturlvars()></script>

And of course you would have the function geturlvars() defined at the beginning of the page. That information can be found at http://snipplr.com/view/799/get-url-variables/ but the code at that location will need heavily altering to return the url vars as one long string.

Sorry if the code isn't exact but that is from the top of my head.

So as you can see in the code box above, it imports the page from the other website and all links from the host with php link to the host without php (to the same file every time but different url vars) if you know what I mean.

Edit: To stop search engines double indexing the data a robots.txt on the server with php can block all search engines but search engines could still index from the main website.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It would probably be easiest to build a php review site on an external host and use a system of iframes to display each page in html formatting. I would happily make such a site for you as I make those type of sites all the time and soon I will even be making my own review site from scratch.

Also as a website host, checkout http://www.jumba.com.au/hosting/personal/

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try replacing it with the following:

$query_rs_listings = "SELECT `listings.Id`, `listings.town`, `listings.mkt_area`, `listings.list_price`, `listings.address`, `listings.ml`, `listings.list_office`, `listings.list_office_phone`, `listings.property_type`, `listings.baths`, `listings.bedrooms`, `listings.square_feet`, `listings.acreage` FROM `listings` WHERE `listings.property_type`='".$_GET[property_type]."'";

The 2 things I did to the script was I added the appropriate types of quotations marks around each piece of text and I made sure the $_GET array wasn't inside the string.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although I don't know about converting the script but you may find downloading a review script written in Java would be your best option. You should try and ask if a particular script is compatible with your server before buying one though. So try looking for a Java applet review script at http://www.hotscripts.com/Java/Applications/index.html

Note it is Java, Not Javascript.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I am expanding one of my websites which requires me to write a script which has a language syntax highlighter (the gml/gamemaker language). So to do that I am using mainly preg replace and str replace. I have been working hard at it for the last 29 hours but there is just three bugs (or preg replace functions) which is messing up the end result. I have attached to this post the code (as an attachment) since several phrases in my code kept on getting replaced with the bbcode <code> tag but with the [] brackets.

The 3 preg replaces which are sending me crazy are as follows:

$textb=preg_replace("/([^)])( |
|	|\>| \>|
\>|	\>)(.*)\((.*)?\)([^(])?()/is",'$1$2<font color=#c#o#l#o#r#2#>$3($4)</font>$5',$textb);

// one preg replace that works was taken out from this spot.
		
$textb=preg_replace("/(\'(.*)\')/is","<font color=#c#o#l#o#r#3#>'$2'</font>",$textb);
$textb=preg_replace("/(\'([^'])\')/is","'</font>$2<font color=#c#o#l#o#r#3#>'",$textb);

You will find that above code in the attachment file with its surrounding code but it is those lines of code that are messing up the final result (I believe). Currently the below text is replace by the html below that. But please replace the brackets <> with the brackets [].

This is a test line
<code>
	 function('value1','value2','value3');
	 functionb("value1","value2",value3);
	functionb("value1","value2",value3);
globalvar variable;
</code>
This is more text

The above is preg/str replaced with the below currently.

This is a test line<br>
<font ><font color=#000080>color=#000000><br>
	 function(<font color=#800000>'value1'</font>,<font color=#800000>'value2'</font>,<font color=#800000>'value3'</font>);<br>
	 functionb(<font color=#800000>"value1"</font>,<font color=#800000>"value2",value3);<br>
	 functionb("value1"</font>,<font color=#800000>"value2"</font>,value3)</font>;<br>
<b>globalvar</b> variable;<br>
</font><br>
This is more text

As you can see in the above box, there are a few final result bugs …

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

you cannot test mail on your localhost try it from a free web server, like www.111mb.net

That is totally wrong and you don't even need internet to test email scripts with php. All of the answers to this topic can be found on a search term such as 'xampp'. xampp is a program that allows you to setup a localhost website (not online but through the browser offline). It contains the following features:

  • php server-side language Viewable through a browser
  • A server email program which acts as a server
  • An uploader that basically just copies the files into the htdocs folder
  • The ability to use Mysql Databases

The second option which I assume you have started is to find each of the server programs individually but I would recommend xampp if and only if your computer is not connected to the internet due to security issues. So check out the link below for xampp as I use it myself for developing websites offline:
http://www.apachefriends.org/en/xampp-windows.html

If however you want to keep doing what you are already doing then you can download the one component of the xampp software at the below link and where-ever a domain name is asked, just place localhost. There are other local domains you can make but those are the basics. So a download link for the email server program on its own is located at: http://www.snapfiles.com/get/mercury.html

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well first to help you understand it more, the phrase IRQ means 'Interrupted Request' and I would say the letter L that follows that would be short for 'Leak' meaning that there is an interrupted program request due to a memory leak. This could be because of two reasons. One is that you may have a damaged memory chip in your computer and the other reason is that you could just have a faulty program recently installed on your computer. So if you have installed any software in the past 3 weeks which is over 63MB then try uninstalling that software and see if the same error occurs. If it does then you may need to download a diagnostics program that tests your entire system for compatibility problems including the hardware. Although I don't know where to download that diagnostics program I just know of a computer repair shop that uses one and I found traces of it on my computer.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try replacing line 3 with the following and check if the same message occurs. If the same message occurs then it means that the error is between the word 'where' and the last quotation mark.

$review_query = "SELECT * FROM `tb_review_dvd` WHERE `review_dvd` = '$review_dvd'";

Also try the below code if all of that fails:

$db = new ReviewDB();

    $review_query = "SELECT * FROM `tb_review_dvd` WHERE `review_dvd` = '$review_dvd'";
    $rq_result = mysql_query($review_query);
    if(!$rq_result) die ("query failed:" . mysql_error());
    $review = mysql_fetch_array($rq_result, MYSQL_BOTH );
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although this is not a common problem and most would disagree that this problem exists, there is a slight incompatibility (from my point of view) with some versions of MySQL scripts. This is because in some later versions of MySQL (like you have possibly switched) there is a thing with quotations being necessary. So try replacing your first block of code with the following:

$db = new ReviewDB();

    $review_query = "SELECT * FROM `tb_review_dvd` WHERE `review_dvd` = '".$review_dvd."'";
    $rq_result = mysql_query($review_query, $db->handle);
    if(!$rq_result) die ("query failed:" . mysql_error());
    $review = mysql_fetch_array($rq_result, MYSQL_BOTH );

So in the MySQL syntax, database names and column names are surrounded by an apostrophie ` (Top left corner of keyboard beside number 1 key) and when finding the values in a database, they are surrounded by a regular set of single quotation marks. There is more to it than what I have just said such as arrays but those are the essentials that I have mentioned.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have just completed a login system for a php site and although it is not open source I will tell you how it works. So for beginners, you will need to know the following:

Making sessions
http://www.tizag.com/phpT/phpsessions.php
http://au2.php.net/session_start
Making HTML Forms
The isset($_POST) command
MySQL querys
PHP Variables

And a few other small things. So to begin with, make a html page with a html login form then when it all looks perfect, change the extension to php and use the echo ""; command to show the page. Be sure not to use any double quotation marks ( " ) in your html codes otherwise you will come across problems.

After you have a html form, you have a php code at the beginning that detects if the form has been submitted. If the if function detects the form has been submited, then the script will attempt to connect to the MySQL database to check if the form details are valid. Then if the details are valid, a session is created. When the session is created, other parts of the website can see if the user is logged in. You then set the pages so that if there is no session in place, then the parts of pages (or even whole pages) will not load up.

Also if you are new to php then you should read some books and online tutorials about php before using it …

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

After many days of hard work I have now solved the problem. I found that any page beginning with the following code is likely to have a cookie (or at least for me) session_start(); I found that by removing the session_start(); and session_register('$translog'); from all of my pages and script, this prevented any cookies from being made and all my scripts work like normal. Also I found that the following now works as my logout code:

<?
{
session_start();
$_SESSION = array(); // destroy all $_SESSION data
setcookie("PHPSESSID", "", time() - 3600, "/");
session_destroy();

The reason why the above code did not work before was that every page with the session_start() made a cookie even if there was no session started.
So now all is well and thanks for the help nav33n as now I know how to delete cookies with php.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have tried your reply and your example works but the situation is a bit more technical than that. I use the following code to create the session which I believe also creates a cookie: session_register('$translog'); The cookie it makes is called 'PHPSESSID' and it is how the cookie expiry is set that is a real problem. The cookie expiry from the above code is by default set to expire when the session ends. Although the session ends, the cookie never gets removed. So how would I:
A - Make the user computer know the session has ended instead of just the server side.
-or-
B - Make a script that would remove a session cookie with a session type expiry.

Thanks for your reply though.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Its the property (or the structure) of the table.

Then sorry for the misunderstanding as this has been a confusing topic. But still the point I had about the third quotation mark (or apostrophe) needs to be put to use if you are using MySQL 5.*

The first piece of code I provided was assuming the above structure was all the data entered into the database. But knowing that is the structure of the table, you would need to use the following:

$query = "SELECT * FROM `freeboard` WHERE `is_comment` = '0' ORDER BY `thread` desc";
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have being analyzing the code and text snippets even further and I have a question that could turn around my answer. Is the following the table with all the data in it or is the following just the properties of a table.

+---------------+-------------+------+-----+---------+----------------+
| Field         | Type        | Null | Key | Default | Extra          |
+---------------+-------------+------+-----+---------+----------------+
| idx           | int(11)     | NO   | PRI | NULL    | auto_increment | 
| name          | varchar(20) | NO   |     | NULL    |                | 
| passwd        | varchar(20) | NO   |     | NULL    |                | 
| title         | varchar(80) | NO   |     | NULL    |                | 
| date          | varchar(10) | NO   |     | NULL    |                | 
| time          | varchar(8)  | NO   |     | NULL    |                | 
| hit           | int(11)     | NO   |     | NULL    |                | 
| contents      | text        | NO   | MUL | NULL    |                | 
| thread        | int(11)     | NO   | UNI | NULL    |                | 
| depth         | int(11)     | NO   |     | NULL    |                | 
| is_comment    | int(11)     | NO   |     | NULL    |                | 
| parent_thread | int(11)     | NO   |     | NULL    |                | 
| comment_num   | int(11)     | NO   |     | NULL    |                | 
+---------------+-------------+------+-----+---------+----------------+
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Below is an example of designing the above database:

+---------------+-------------+------+------+-----------+----------------+
| Column name   | Column name |Column|Column|Column name| Column name    |
+---------------+-------------+------+------+-----------+----------------+
| Row 1         | example     |      |      |           |                |
| Row 2         | example     |      |      |           |                |
| Row 3         | example     |      |      |           |                |
| idx           | int(11)     | NO   | PRI  | NULL      | auto_increment | 
| name          | varchar(20) | NO   |      | NULL      |                | 
| passwd        | varchar(20) | NO   |      | NULL      |                | 
| title         | varchar(80) | NO   |      | NULL      |                | 
| date          | varchar(10) | NO   |      | NULL      |                | 
| time          | varchar(8)  | NO   |      | NULL      |                | 
| hit           | int(11)     | NO   |      | NULL      |                | 
| contents      | text        | NO   | MUL  | NULL      |                | 
| thread        | int(11)     | NO   | UNI  | NULL      |                | 
| depth         | int(11)     | NO   |      | NULL      |                | 
| is_comment    | int(11)     | NO   |      | NULL      |                | 
| parent_thread | int(11)     | NO   |      | NULL      |                | 
| comment_num   | int(11)     | NO   |      | NULL      |                | 
+---------------+-------------+------+------+-----------+----------------+

So as you can see in my example is that straight across the top is the names of each column and the column on the very left has the rows like my example points out. Note that columns are verticle ( | ) and rows are horizontal ( --- ). Hope this helps to explain the confusion in this topic.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

As I can see from the table structure posted by OP, there is a column called thread.

Isn't it a row called thread because those other words I included in the below text are what I believed to be the columns.

(`Type` ='0' OR `Null` = '0' OR `Key` = '0' OR `Default` = '0')

Note that when using phpMyAdmin, the columns are listed along the top and not the side. The things on the side are rows.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
$query = "SELECT * FROM freeboard where is_comment = 0 order by thread desc";

Notice that I have removed unwanted '.

If MySQL 5.* is being used then it is most likely you have this all wrong. This is because on some servers, MySQL 5 requires the apostrophe or as I would call it, the third quotation mark. Also the structure of the code is wrong as you need to refer to the column first.
So try the following.

$query = "SELECT * FROM `freeboard` WHERE `field` = 'is_comment' AND (`Type` ='0' OR `Null` = '0' OR `Key` = '0' OR `Default` = '0') ORDER BY 'thread' desc";

The only part of the above code I am not sure about is the following as it does not refer to any appropriate columns and I don't think there are any:

ORDER BY 'thread' desc

Also as a general notice, make sure you have the right code to connect to the MySQL database as that can cause the same error message.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have been working on a php login system which is basically finished but needs one thing cleaning up. When the session is created/registered, a cookie is created. And according to firefox, the cookie will expire when the session ends. However, the session ends (according the the rest of my php scripts) and the cookie is still there. Below is the php code I use to end the session.

<?
{
session_set_cookie_params(0);
session_start();
session_destroy();
//setcookie("PHPSESSID","",time()-3600);
}
//And the rest doesn't relate to logging out

So when the logout button is pressed, the user is sent to a page with that code at the very beginning of the page. And as you can see in my code above, I have tried with and without the setcookie code with many different combinations between the brackets.

Can anybody see where I am going wrong because I have read all of the manuals which relate to each of these scripts. Any help would be appreciated.
Thanks

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

can someone help me make a site to compete with www.google.com? im on aim halp plz :)

Well I am doing just that. I have found PHP is not powerful enough so I am using Perl to compete with Google. I have already completed a type of search engine I call InfoBot where you add the answers manually (text - not links). So I am already starting the next step for a search engine that will automatically scan the web for links. And I am serious. As for the first post made in this topic, I would happily help you make a variation of myspace.com and I will pm you my msn contact.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

A few weeks ago I was in the same situation and I would recommend the following books:

  • PHP MySQL Web-Development All-in-One-Desk-Reference For Dummies
  • PHP5 and MySQL Bible / By: Tim Converse and Joyce Parks, with Clark Morgan.

Also the following google search term:
site:www.php.net mysql
Note that the link above was computer generated so make that entire line a search term.

And also use PhpMyAdmin to generate some MySQL query's but you will need to alter those computer generated query's. And of course there is the following web link:
http://www.tizag.com/mysqlTutorial/

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

First make sure that account has been through the setup wizard. To do this just open Exel from the start menu or desktop. Then a installation wizard may appear. If it does then follow the prompts else you may find that the account settings have been messed up. To solve the account settings being messed up, you may need to:
a - reinstall Office
or
b - recreate that account.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Another thing to add to the previous post is sometimes Microsoft ads the key on the plastic raper that most people would just put in the bin. So try finding every bit that came with the box as the key can be hidden in all sorts of places.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I would say that your program has changed the universal sound preferences. This can be found on the start menu at:
Start --> All Programs --> Accessories --> Entertainment --> Volume Control.
Then check that all of the sound meters as set to at least half way.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If alignment of the image wont work, why not make a barrier around the image. An example is

$imgwidth=64; //Image width
$imgheight=64; //Image height
echo '<tr id="divider"><td>
<table border=0 cellpadding=0 cellspacing=0 width=$imgwidth 
height=$imgheight align=left>
<tr><td>
'.$row['profileimg'].'
</td></tr></table>
'.$row['username'].'</td></tr>';

The above is just from the top of my head so don't be too suprised if there is a bug or 2.

Kavitha Butchi commented: Genious +1
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Once again I have solved my own topic. I found that html can do php's posting job. That is when you have a form which posts information, you do not need the $_POST variable inside the form as the html part (method=post) already posts the info. So that makes php's $_POST function act similar to a $_GET function. So the code I first posted can be replaced with the following:

echo "<form method='post'>";
//variable deleted

//form fields
echo "<input type='submit' value='Submit ' name='dataappend'></form>";

Note that the onclick event has also been deleted and the submitting process works just as good as before but without displaying the double submit.

peter_budo commented: Nice job +8