cwarn23 387 Occupation: Genius Team Colleague Featured Poster

in other words, if i have a 56k connection can i still watch youtube or for that matter a live stream?

Of course you could however you need a buffer if the download rate is slower then the display rate. Just from the top of my head, the formula to calculate the buffer percentage would be as follows:

Example rates
d=download side per second = 150kbps
x=internet speed = 50kbps
v=d/x
v=100/v
'v' now contains the percentage of the movie that needs to
be placed into the buffer before playing.

So as you can see, the above is a simple equation to work out the buffer which is what youtube uses however most sites unfortunately don't place an equation such as this one to work out what the buffer needs to be for each user. Instead they just put something like a 10 second buffer and make those with slower internet suffer the slow speeds.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It meens that the file located at /forum/forums/libs/functions_forums.inc.php does not exist. If you believe it should exist and that the location is relative to the base of your website then you will need to a - adjust it to the base of something like the server root or b - specify a location relative to the folder the script is in without a slash at the beginning.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following code:

<?php
$num_to_guess=42;
$num_tries=0;
$num_tries = (!isset($_POST["num_tries"])) ? $num_tries + 1 : 0;
$message = "";
if (!isset($_POST["guess"])){
 $message = "WELCOME TO THE GUESSING MAChINE!";
 } else if ($_POST["guess"] >$num_to_guess) {
 $message = "$_POST[guess] is too big! TRY a smaller number";
 }else if ($_POST["guess"] < $num_to_guess) {
	$message = "TOO SMALL OR EMPTY";
 } else { 
	$message = "WELL DONE!";
 }
(isset($_POST["guess"])) ? $guess = $_POST["guess"] : $guess = '';
?>
<html>
<head>
<title>SAVE STATE WITH HIDDEN FIELD</title>
</head>
<body>
<h1>
<?php echo $message ?>
</h1>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
<p><strong>Type your guess Here: </strong>
<input type="text" name="guess" value="<?php echo $guess ?>" >
<input type="hidden" name="num_tries" value="<?php echo $num_tries ?>" >
<p><input type="submit" value="submit your guess" /></p>
</form>
</body>
</html>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I've tested the htaccess code I've posted and it seems to work perfectly for me so perhaps the rewrite module isn't correctly enabled as in the past, I have encountered that error while trying to enable the rewrite module.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Your php code is incorrect and needs quotes inside the array. So the correction is the following:

<html>
<head>
<title>READING IMPUTS FROM THE FORM </title>
</head>
<body>
<?php
echo "<p><b>YOUR NAME IS: </b>".$_POST['user']."</p>";
echo "<p><b>YOUR ADDRESS IS: </b>".$_POST['address']."</p>";
echo "<p><br>YOUR PRODUCT CHOICES ARE:<br></p>";
if(!empty($_POST['products'])){
echo "<ul>";
foreach($_POST['products'] as $value) {
echo "<li>$value";
}
echo "</ul>";
}
?>
</body>
</html>

And please use code tags as it makes the code easier to read.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Trying placing the following in your htaccess file and place the htaccess file in the same folder as the homepage:

RewriteEngine On
RewriteRule ^([^.]+[^/])$ $1.php

Also note that when linking to directories such as the hompage you may need a forward slash at the end.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Doesn't make sense to me. When there is two topics with the same category, you will run into problems. Maybe I am not thinking correctly as its 4:47am but I can't think of how that would work.

Well I have designed it so that if there are two topics or more topics in the one category, the category field will always contain the same category name as like an identifier and that is what the following if statement is all about:

if ($catid!==$row['catname']) {
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

As you've mentioned, it is best to have 1 table as it will save recourses and space. So the table structure will be as follows:

tblCategory
cat_id as primary key
cat_name as nvarchar
topic_id as nvarchar
topic_name as nvarchar

Then to retrieve the data and display it as the html format shown in post #1, simply use the following:

<?
//mysql connections

$result=mysql_query('SELECT * FROM `tblCategory` ORDER BY cat_id');
$catid=false;
while ($row=mysql_fetch_array($result)) {
    if ($catid!==$row['catname']) {
        if ($catid==false) {
            echo '<ul><li>'.$row['cat_name'].'</li><ul>';
            } else {
            echo '</ul><li>'.$row['cat_name'].'</li><ul>';
            }
        echo '<li>'.$row['topic_name'].'</li>';
        }
    $catid=$row['cat_name'];
    }

Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Yer go for eather Wamp or Xampp (But NOT PHP 4, the current version is 5.somthing)

Also as a note, I have seen that it is possible to install both php4 and php5 on the same webserver. (Two file extensions - .php4 & .php) So if you have a lot of php 4 programs then you may want to install a package with both.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Perhaps ajax.
I checked the source code and appears that at least javascript to some degree must have been used since there is no hyperlink but instead an oop reference with javascript. Then and although I haven't dug in deep enough to confirm this but it appears there is some server to client communication that updates the div fields. That's about all that I have found so far.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well if you do want to make an entire website just as detailed as the ya posted then first I shall explain the basic concept of viewing the pages. The easiest way to load a page from a mysql database is as follows:

<?
/* Assuming link is 
   http://www.example.com/test.php?page=testpage

mysql connections here */

$result=mysql_query('SELECT * FROM `table` WHERE `page`="'.mysql_real_escape_string($_GET['page']).'"');
$content=mysql_fetch_array($result); //retrieve page
echo $content['page']; //display page
?>

So that will give you some idea on how to do it and if you don't like the ugly url then you can always use a .htaccess file to style it up providing the rewrite module is enabled.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you would like it to post on server side then you could just use curl. So the following is an example script that will display only the paypal page but still submit the post variables to the second link:

$vars='';
foreach ($_POST AS $key => $val) {
$vars.=$key.'='.$val.'&';
}
$vars=substr($vars,0,-1);
$ch = curl_init();
// set the target url
curl_setopt($ch, CURLOPT_URL,'xyz.com/order/email_order.php');
curl_setopt($ch, 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
// howmany parameter to post
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$vars);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$dresult= curl_exec ($ch);
curl_close ($ch);

//now for paypal
$ch = curl_init();
// set the target url
curl_setopt($ch, CURLOPT_URL,'https://www.paypal.com/cgi-bin/webscr');
curl_setopt($ch, 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($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$vars);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result= curl_exec ($ch);
curl_close ($ch);
echo $result;

So if you post to a page that has just the above script, the above script will then re-post the data to the 2 links provided.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sorry I don't quite understand what you are trying to acheive.

Is it similar to linkbuks and other sites like that?

I think subirs77 is talking about making a cms (Content Management System) which is probably the hardest thing to make with php if you want to achieve the kind of things in the description of post #1. However, as a project I every so often add a few dozen lines to, I have been making my own social network cms and it is something like 1100 lines long when adding up all of the files. So I have to ask, do you think your prepared for the big one as I have done a few times before or do you think that you should get a better understanding of php first as you will need at least around 700 lines for a decent cms? I just ask because a cms isn't exactly a newbies challenge but am willing to help if you are prepared.

Just a few notes:
You can also download Content/Link Management Systems for free.
Just work out LMS - Link Management system lol -_-

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If ya want a tutorial all it takes is a google or yahoo search. A good one I found was at http://www.zimmertech.com/tutorials/php/25/comment-form-script-tutorial.php which shows how to make a comments box in a similar way that I would do it although there is a lot of optional code in the tutorial. Hope that helps and just let me know if you need a hand understanding the code.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I thought that it would be automatically secure.

The reason why it is never secure to place even just $_POST variables into a mysql query is because someone can just write a script using curl to send $_POST variables to the page. Also mysql_real_escape_string does more than just securing the variable. It also makes the variable bug free. That is why I recommend it.

undefine Undefined variable: item_color

That silly e_notice error again. Unless ya want to be a professional commercial programmer, it is easiest to just add the following to the top of your page(s) as it is an unnecessary/useless error.

error_reporting(E_ALL ^ E_NOTICE);

You will find the e_notice being disabled is also the universal default before administrators change it. If however you want to be a professional commercial programmer then you need to define your variables before doing .= or += or -= or *= or []=

<?
//define an array
$variable_a=array();

//define a string
$variable_b='';

//define a number
$variable_c=0;

Hope that answers your question.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hello,

This query works when entered directly into MySQL but when used in a php page it fails and generates the following error:

Also, the date values are not accepted in either the php page or mysql terminal, they default to '0000-00-00'.

Here is my query:

mysql_select_db("ecommerce");

$query = "INSERT INTO products VALUES (
'00001', 'toothbrush',
'Brush your teeth with this.',
395.00, '2009-21-04'),
('00002', 'tooth paste',
'You will need this too.',
695.00, '2009-21-04'),
('00003', 'mouth wash',
'Good to use after toothbrush.',
1,250.00, '2009-21-04')";

$result = mysql_query($query)
    or die(mysql_error());
echo "Products added successfully!";

What do you guys think?

There is at least one obvious reason and that is you should never have new lines in a mysql query. In addition you should escape each value. So your query should look like the following:

mysql_select_db("ecommerce");

$query = "INSERT INTO products VALUES ('".mysql_real_escape_string('00001')."', '".mysql_real_escape_string('toothbrush')."', '".mysql_real_escape_string('Brush your teeth with this.')."', '".mysql_real_escape_string('395.00')."', '".mysql_real_escape_string('2009-21-04')."'), ('".mysql_real_escape_string('00002')."', '".mysql_real_escape_string('tooth paste')."', '".mysql_real_escape_string('You will need this too.')."', '".mysql_real_escape_string('695.00')."', '".mysql_real_escape_string('2009-21-04')."'), ('".mysql_real_escape_string('00003')."', '".mysql_real_escape_string('mouth wash')."', '".mysql_real_escape_string('Good to use after toothbrush.')."', '".mysql_real_escape_string('1,250.00')."', '".mysql_real_escape_string('2009-21-04')."')";

$result = mysql_query($query)
    or die(mysql_error());
echo "Products added successfully!";

If that doesn't work then you may need to specify the column names. I think mysql and php have separate but simular languages for accessing a mysql database and the one ya tried to use was the mysql version and not php version. The reasion why I say that is that postgresql query and mysql query are both identical meaning php must be the interpreter and not mysql. So try converting your query …

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi, for the past couple of weeks I have noticed that daniweb crashes when the traffic exceeds 4200 members online. It usually happens around a Thursday night Australian Eastern Standard Time and is real annoying at times since I need to wait for the next day to post.
I know it's not my internet because I can visit every other website and from the windows command prompt, most of the time I can ping daniweb.com with no problems. I suspect that daniweb just can't handle the 4200+ members during peak hour of the week. Just thought I would mention this and ask if anyone else has noticed the same problem.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

$query = "DELETE from color WHERE colorid = $colorid";

That line should be the following:

$query = "DELETE from color WHERE colorid = '".mysql_real_escape_string($colorid)."'";

And add the mysql_real_escape_string() to all inputs into mysql like I did in the problem line above otherwise your script like it is now won't be very secure.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi,
I want my first form itself with no bars,my code is as follows,

<body bottommargin="0" onLoad="loadpage('http://localhost/org/index.php');">
<script language="JavaScript">
function loadpage(var1) 
{
window.open(var1,'TheNewpop','fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}
</script>

That onload= code will not work due to the advanced popup blocker filters that every browser has today. To be able to use the function, you need to link to the page with that function or make the user click something. Automated events will just be blocked by the browser unfortunately.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

are you trying to make the table get bigger and smaller with the window it's kinda hard to follow what you are saying? if you clear up what you are trying to do i can help more

Well I can understand it due to the use of code I'll explain what I think he is saying even though I'm not entirely sure on how to what he is saying.
In the code there is a html table, 100% width and 100% height if the window is the right size. Then if the window is large enough when the page loads there will be no scroll bars. However, if the user resizes the window after the page loads and the content inside the table cannot fit inside the window then the scrollbars appear. Then when the user resizes the window to make it a big window again the scrollbars disappear and the table is 100% width and 100% height. I think that is what he meant. But as I said, I am not sure on how to do that, just though I would explain my interpretation.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Also the following will do the same job:

$arr = array(1 => "apple",2 => "orange",3 => "mango");
$var = "apple 1";
if(!in_array( $var, $arr )) {
  // not found, do something...
  } else {
  // found
  $found = $var;
  }
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well php itself can launch the window since php deals with the server side items while other languages such as javascript and flash deal with the client/user side items. So that makes it impossible for php itself to make a popup but you can make php send to the browser javascript code to launch up a popup. Below is an example of the javascript and html required:

<script language="JavaScript">
function loadpage(var1) {
window.open(var1,'TheNewpop','fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}
</script>

<CENTER><FORM>
<input type="button" VALUE="click me!" onClick="loadpage('http://www.google.com.au/');">
</FORM>
</CENTER>

And there is a tutorial about it at http://htmlgoodies.earthweb.com/beyond/javascript/article.php/3471181

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

That code works perfectly for me so perhaps it's the html code on the main page used to include the iframe. The code I used to include the iframe is as follows:

<iframe src='frame.php' width=300 height=30>Iframe Not supported</iframe>

Also if you want to know what language to do the proper vision in I would suggest pure javascript and a div tag because every second a javascript function could update the contents of what is inside the div tag using basic maths.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Make the uplaod folder writable..Change its security level to chmod 777

Forgot about that however, some servers do not allow chmod 777. Due to security reasons, they only allow something like 766 by memory. The reason why such security policies exist is so that from the servers point of view, not everybody is the owner of the server. Where as if it were allowed to have chmod 777 like most do then everybody is an administrator. That's what I've read about my web host.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I agree with nav33n but I suppose newbies to daniweb aren't familiar to the code tag concept. Also in addition, I would secure that mysql query of yours. The corrected and easier to read code is as follows:

<?php

include("connect.php");

if (!isset($_POST['Submit']))
{

$GpoNumber =$_POST['GpoNumber'];
$invoice=$_POST['invoice'];
$amount=$_POST['amount'];
$receiver=$_POST['receiver'];
$dateIn=$_POST['dateIn'];
$submitter=$_POST['submitter'];

// create empty error variable
$error = "";

// check for data in required fields
if (($GpoNumber == "") || ($invoice == "") || ($amount == "") || ($receiver == "") || ($dateIn == "") || ($submitter == "")) {
$error = "Please fill in all the required fields!";
}

// validate GpoNumber
if ((ctype_alpha($GpoNumber) == false) {
$error = "Please enter a valid GpoNumber <br/>";
}

// validate invoice
if ((ctype_alpha($invoice) == false) {
$error = "Please enter a valid invoice <br/>";
}

// validate amount
if ((is_numeric($amount) == false) {
$error = "Please enter a valid amount <br/>";
}

// validate receiver
if ((ctype_alpha($receiver) == false) {
$error = "Please enter a valid receiver <br/>";
}


// validate date
if ((is_numeric($dateIn) == false) {
$error = "Please enter a valid date <br/>";
}

// validate submitter
if ((ctype_alpha($submitter) == false) {
$error = "Please enter a valid submitter <br/>";
}


?>
<body>
<div id="container">
<div id="intro">
<div id="pageHeader">
<h1><span>Department of Water Affairs<h3><font color='black'>Payment Process Tracking System</font></h3></span></h1>

</div>
<div id="linkList">
<div id="linkList2">
<div id="lmenu">
<ul>
<li><a href="index.html">Main Menu</a>&nbsp; </li>
<li><a href="receipt.php">Receipt Division</a>&nbsp; </li>
<li><a href="viewReceipt.php">View Details</a>&nbsp; </li>
<li><a href="deleteReceipt.php">Delete Details</a>&nbsp; </li>
</ul>
</div>
</div>
</div>

<div id="about">
<h3><span>Update Receipt …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try adding this to the top of the your php files:

ini_set('file_uploads', 1);
ini_set('upload_max_filesize', '8M');

Could be just that uploads are disabled in the php.ini file.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi, I have made a function that will resize images and is as follows:

<?php
function resize_image($filename,$newwidth,$newheight) {
    if (!file_exists($filename) || !in_array(preg_replace('/(.*)[.]([^.]+)/is','$2',basename($filename)),array('png','jpg','jpeg','gif','xbm','xpm','wbmp'))) {
        //note .wbmp is 'wireless bitmap' and not 'windows bitmap'.
        return false;
        } else {
        $ext=preg_replace('/(.*)[.]([^.]+)/is','$2',basename($filename));
        if ($ext=='jpg') { $ext='jpeg'; }
        $ext='imagecreatefrom'.$ext;
        list($width, $height) = getimagesize($filename);
        $thumb = imagecreatetruecolor($newwidth, $newheight);
        $source = $ext($filename);
        imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
        return $thumb;
        }
    }
$img = resize_image('file_from.gif','320','280');
//save image to file
imagejpeg ($img,'file.gif',100);
?>

Hope that helps ya as I would imagine that some of the previous posts would be a little confusing without the syntax highlighter.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I received your message and had a crack at the code but it seems there is some sort of anti-bot protection script on the website. The following is the script I used:

<?
//array('AF','DZ','AS','AD','AO','AI','AQ','AG','AR','AM','AW','AT','AU','AZ','BS','BH','BD','BB','BY','BE','BZ','BJ','BM','BT','BO','BA','BW','BV','BA','IO','BN','BF','BG','BI','KH','CM','CA','CV','KY','CF','TD','CL','CN','CX','CC','CO','KM','CG','CD','CK','CR','CI','HR','CY','CZ','DK','DJ','DM','DO','EC','EG','SV','GQ','EE','ET','FK','FO','FJ','FI','FR','GF','PF','GA','GM','GE','DE','GH','GI','GR','GL','GD','GP','GU','GT','GN','GW','GY','HT','HM','VA','HN','HK','HU','IS','IN','ID','IQ','IE','IL','IT','JM','JP','JO','KZ','KE','KI','KR','KW','KG','LA','LV','LB','LS','LR','LY','LI','LT','LU','MO','MK','MG','MW','MY','MV','ML','MT','MH','MQ','MR','MU','YT','MX','FM','MD','MC','MN','MS','MA','MZ','MM','NA','NR','NP','NL','AN','NC','NZ','NI','NE','NG','NU','NF','MP','NO','OM','PK','PW','PS','PA','PG','PY','PE','PH','PN','PL','PT','PR','QA','RE','RO','RU','RW','SH','KN','LC','PM','VC','WS','SM','ST','SA','SN','CS','SC','SL','SG','SK','SI','SB','SO','ZA','ES','LK','SR','SJ','SZ','SE','CH','TW','TJ','TZ','TH','TL','TG','TK','TO','TT','TN','TR','TM','TC','TV','UG','UA','AE','GB','US','UM','UY','UZ','VU','VE','VN','VG','VI','WF','YE','ZM','ZW');
$country=array('AF');
for ($id=0;isset($country[$id]);$id++) {
	$ch = curl_init();
	// set the target url
	curl_setopt($ch, CURLOPT_URL,'http://tools.cisco.com/WWChannels/LOCATR/performBasicSearch.do');
	curl_setopt($ch, 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
	// howmany parameter to post
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS,'state=&latitude=&longitude=&city=&zip=&lonlatRequired=N&smbSort=true&address=&country='.$country[$id]);
	curl_setopt($ch, CURLOPT_NOBODY, false);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$result= curl_exec ($ch);
	curl_close ($ch);
	echo $result;
	}
?>

And if you check what it displays the curl function doesn't redirect to the third page which contains the results. It is stuck in the second page and may may have something to do with javascript or ajax. So although the above script partially works at retrieving the data it just needs extending to lead to the beginning results instead of the bot trap.

Also just as a note, the commented array can replace the array on the line below it when it all works so that the script will check all of the countries.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi,

You are missing double quotes

$sql = 'SELECT * FROM cartable';
$finalurl = <a href='$row["carwebsiteurl"]'>$row[carname]</a>;
echo $finalurl;

You are also missing the quotes around the html code. Try the following:

$sql = 'SELECT * FROM cartable';
$finalurl = '<a href=\''.$row['carwebsiteurl'].'\'>'.$row['carname'].'</a>';
echo $finalurl;
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I would suggest using mysql databases and the following is an example mysql query:

mysql_query('INSERT INTO `table` SET `title`="'.mysql_real_escape_string(stripslashes($_POST['title'])).'" `date`="'.mysql_real_escape_string(stripslashes($_POST['title'])).'" `body`="'.mysql_real_escape_string(stripslashes($_POST['title'])).'"')

Then to place the contents into a page use the following:

$result = mysql_query('INSERT INTO `table` SET `title`="'.mysql_real_escape_string(stripslashes($_POST['title'])).'" `date`="'.mysql_real_escape_string(stripslashes($_POST['title'])).'" `body`="'.mysql_real_escape_string(stripslashes($_POST['title'])).'"')
while($row=mysql_fetch_array($result)) {
echo '<div class="post">
	<div class="post_title"><h2>'.$row['title'].'</h2></div>
	<div class="post_date">'.$row['date'].'</a></div>
	<div class="post_body">
		<p>'.$row['body'].'</p>
	</div>
</div>';
    }

Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although as previously mentioned, you may use arrays to select a language, that may not always be a possible option if other users submit content. To solve this with a bit of extra cpu, you may use the google translator via php without leaving the website. The script is as follows:

function translate($sentence,$languagefrom,$languageto)
{
$homepage = file_get_contents('http://translate.google.com/translate_t');
if ($homepage==false) {$homepage='';}
preg_match_all("/<form[^>]+ction=\"\/translate_t\".*<\/form>/",$homepage,$botmatch);
$botmatch[0][0]=preg_replace("/<\/form>.*/",'',$botmatch[0][0]);
preg_match_all("/<input[^>]+>/",$botmatch[0][0],$botinput);
$id=0;
while (isset($botinput[0][$id]))
	{
	preg_match_all("/value=(\"|'|[^\"'])[^\"']+(\"|'|[^\"'])?( |>|	)/",$botinput[0][$id],$tmp);
	$tmp[0][0]=preg_replace('/((\'|")?[^\'"]+)/','$1',$tmp[0][0]);
	$tmp[0][0]=preg_replace('/(\'|")/','',$tmp[0][0]);
	$tmp[0][0]=preg_replace('/.*value=/i','',$tmp[0][0]);
	$len=strlen($tmp[0][0]);
	$len-=1;
	$tmp[0][0]=substr($tmp[0][0],0,$len);
 
	preg_match_all("/name=(\"|'|[^\"'])[^\"']+(\"|'|[^\"'])?( |>|	)/",$botinput[0][$id],$tmpname);
	$tmpname[0][0]=preg_replace('/((\'|")?[^\'"]+)/','$1',$tmpname[0][0]);
	$tmpname[0][0]=preg_replace('/(\'|")/','',$tmpname[0][0]);
	$tmpname[0][0]=preg_replace('/.*name=/i','',$tmpname[0][0]);
	$len=strlen($tmpname[0][0]);
	$len-=1;
	$tmpname[0][0]=substr($tmpname[0][0],0,$len);
 
	if (strlen($tmpname[0][0])>0 && !in_array($tmpname[0][0],array('text','sl','tl')))
		{
		$vars.=$tmpname[0][0]."=".$tmp[0][0].'&';
		}
	unset($tmp);
	unset($tmpname);
	$id+=1;
}
$curl_handle=curl_init('http://translate.google.com/translate_t');
curl_setopt($curl_handle, CURLOPT_HEADER, true);
curl_setopt($curl_handle, CURLOPT_FAILONERROR, true);
curl_setopt($curl_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") );   
curl_setopt($curl_handle, CURLOPT_POST, true);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $vars.'text='.$sentence.'&sl='.$languagefrom.'&tl='.$languageto);
curl_setopt($curl_handle, CURLOPT_NOBODY, false);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,false);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
 
$buffer=strip_tags($buffer,'<div>');
preg_match_all("/\<div id\=result_box dir\=\"[^\"]+\"\>[^<]+\<\/div\>/",$buffer,$match);
$match[0][0]=strip_tags($match[0][0]);
return $match[0][0];
}

Then the language option and the abbreviations that you place into the function are as follows:

ar = Arabic
bg = Bulgarian
ca = Catalan
zh-CN = Chinese
hr = Croatian
cs = Czech
da = Danish
nl = Dutch
en = English
tl = Filipino
fi = Finnish
fr = French
de = German
el = Greek
iw = Hebrew
hi = Hindi
id = Indonesian
it = Italian
ja = Japanese
ko = Korean
lv = Latvian
lt = Lithuanian
no = Norwegian
pl = Polish
pt = Portuguese
ro = Romanian
ru = Russian
sr = Serbian
sk = Slovak
sl = Slovenian …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

hi,
In htaccess

RewriteEngine on
RewriteBase /project_test/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^projects/(.*)/$ project_detail.php?pname=$1 [L]

and my project_detail.php file at
http://localhost/demo/abc/index.php
http://localhost/demo/abc/project_detail.php
when click on link
http://localhost/demo/abc/projects/school-project/
IT gives page not found

I think some modification needed at this line

RewriteRule ^projects/(.*)/$ project_detail.php?pname=$1 [L]

plz tell me what to do??

Try making the following your .htaccess file:

RewriteEngine on

RewriteRule ^projects/(.*)/$ project_detail.php?pname=$1

Also make sure that mod_rewrite is enabled in the apachie configurations.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you are trying to retrieve 1 row of a mysql table via link then it is probably best to just have a unique number/hash column and link to the php page with that row id in it. Then when retrieving the row, you can just use SELECT * FROM `table` WHERE `id`='".mysql_real_escape_string($value)."' As for how to get the unique hash, just hash the date and time the the field was entered. Alternatively you could just make the id field the manufacturer field.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although I don't know about putting the picture into the database, I have made a function that will resize the picture for you. The script is:

<?php
function resize_image($filename,$newwidth,$newheight) {
    
    if (!file_exists($filename) || !in_array(preg_replace('/(.*)[.]([^.]+)/is','$2',basename($filename)),array('png','jpg','jpeg','gif','xbm','xpm','wbmp'))) {
        //note .wbmp is 'wireless bitmap' and not 'windows bitmap'.
        return false;
        } else {
        $ext=preg_replace('/(.*)[.]([^.]+)/is','$2',basename($filename));
        if ($ext=='jpg') { $ext='jpeg'; }
        $ext='imagecreatefrom'.$ext;
        list($width, $height) = getimagesize($filename);
        $thumb = imagecreatetruecolor($newwidth, $newheight);
        $source = $ext($filename);
        imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
        return $thumb;
        }
    }
$img = resize_image('file_from.jpg','320','280');
//save image to file
imagegif ($img,'file.gif');
?>

And the above function supports all the gd supported file formats which include png, jpg, jpeg, gif, xbm, xpm, and wbmp. Also note that wbmp is not windows bitmap but instead wireless bitmap. So many people including myself have found the name misleading when first discovering the function. Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you meen to check 4 more fields in the mysql query then you will need to specify them in one long string like the following:

mysql_query('SELECT * from dbname WHERE type="'.mysql_real_escape_string($type).'" AND location="'.mysql_real_escape_string($location).'" AND gender="'.mysql_real_escape_string($gender).'" AND married="'.mysql_real_escape_string($married).'" AND photo="'.mysql_real_escape_string($photo).'"');

I think that's what your talking about - is there any way of making the mysql_query shorter and the answer is not unless you want the query to be able to select a wider range of rows by specifying fewer columns after the where clause.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try this:

<?
$result=mysql_query('SELECT * FROM `table`');
$fields=mysql_fetch_array($result);
foreach($fields AS $field) {
    $string.=$field;
    } unset($field);
$kilobites=strlen($string);
$kilobites=$kilobites/1024;

echo $kilobites;
?>

Basically the string length is the number of bytes and there are 1024 bytes in a kilobite.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

There is a nice little article about it at http://stackoverflow.com/questions/254184/filter-extensions-in-html-form-upload
And a sample html code to accept files smaller than 60MB with only the extension jpg, jpeg and gif the code would be as follows:

<form enctype="multipart/form-data" action="uploader.php" method="POST">
Upload PNG File:
<input name="Upload Saved Replay" type="file" accept="image/gif, image/jpeg"/><br />
<input type="hidden" name="MAX_FILE_SIZE" value="60000000" />
<input type="submit" value="Upload File" />
</form>

Also note that you need to enter the mime types into the accept= parameter. More info on that can be found at http://www.w3schools.com/TAGS/att_form_accept.asp

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well I think what phpbb does is it writes to a text file each username as they log in and removes their username from that text file when they log out. Then to display the list of usernames, phpbb then simply just retrieves the contents of that text file with the explode function. But in my preference, I would say welcome to the twenty first century. I would use mysql databases to record how long ago each user last visited a webpage and if a user last visited a page longer than an hour ago, they are then removed off the list or if they visit a new webpage, the new webpage url overwrites the entry for the existing url on the list for that user.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try adding the following field to your html form to prevent uploads larger than 60MB

<input type="hidden" name="MAX_FILE_SIZE" value="60000000" />

Other than that, php has no way of validating the upload since php is server side an not client side. So the only real ways to validate an upload is with javascript, flash and java.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

So you are wanting one image to be displayed every 5 seconds, right?

If that is the case, why not use the sleep function. And doing the following should make the sleep function only effect the loop. So in your main page that the images need to be displayed on place the following:

<head><script>
function clientSideInclude(id, url) {
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id + 
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
}
function imagetrigger(var1) {
    clientSideInclude('dimages', 'images.php?id='+var1);
    }
function imageloader() {
    imagetrigger(1);
    setTimeout("imagetrigger(2)",5000);
    setTimeout("imagetrigger(3)",10000);
    setTimeout("imagetrigger(4)",15000);
    setTimeout("imagetrigger(5)",20000);
    }
</script></head>
<body onload="imageloader();">
Below the images<br>
<td>
<span id="dimages">
</span>
</td>
<br>Above …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

so then how does the server figure out which is intended for each website

You will find that with the design of the cookies system in general, every cookie in existance is set to serve one domain only. And of course, there is only one defined session per domain. So that is how the browser separates the cookies for the intended website.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

<td>
<?
$no = 1;
echo '<div id="pic">';
while( $no < 6 ) 
{ 
$pic = "pic".$no;
$R4[$pic]='';
echo $pic;
?>
<script> album(); </script>
<img src="images/journeys/gallery/<? echo $R4["$pic"]; ?>" width="200" height="200" />
<script> album_hide(); </script>									
<? 
$no+= 1;
$pic= "";
}
?>
</div></td>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

But what if cookies are disabled?
Wouldnt that create the same problem.

Then again, you can test if cookies are on and tell the user to put them on in order to access something. Whereas true, meta can be blocked.

Well if cookies are disabled, weather you use my code or not sessions will be blocked. That is why in the past there have been so many topics about sessions not working. Because unless you place the session id in the url which nobody does, there is no way for the server to know the computers identity. In other words, sessions use cookies to know which sessions go to which client computers. And to test this situation you need to both disable cookies and empty cookies so there are no active sessions available. I wish this was made clear to new php programmers.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

During the logout process (before new begins to load) add the following code:

$_SESSION=array();

That should flush the sessions data so the session will be empty after that point/line.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I checked some programers that I will not mention who and they quoted $950 USD just for the player. I think I will need to do a lot of browsing to find a programmer that can do it for around a third that due to the fact of when converting it to australian dollars. But for now I'll just need to keep on scanning the web for a freelancer see if they can offer a lower price.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi. I have an internet problem. I am using a laptop at home and it is saying that my wireless connection is connected, but i cannot use any of my web browsers. Although I cant use my web browsers I can still download things on limewire. Limewire is the only thing responding to the internet. Not my browsers or my msn messenger. I carried my computer to geek squad and they said its not my computer its my router. But I dont know what to do with my router to get it to work with my laptop again. The strange things is, two other laptops in the house are working well with the same wireless router but not mines. When I ask windows to diagnose the problem, they say sumfin is wrong with one of my network adapters. I tried unplugging it for a while but that did not work. When i asked msn messenger to diagnose the problem it says there are errors with my key ports and my DNS. I tried flushing my dns and it did not work. I also installed norton the same time this problem occured, but i tried uninstalling it to see if it would solve the prob but nothing is doing. PLEASE HELP ME!!!

Sounds like limewire has taken over your internet. I would suggest reconfiguring all of your internet settings weather it's manually or via wizard then under the new settings don't let limewire connect to the internet.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

From what I have read in the past, it is best to use Ajax to do the job. Although I don't know the first thing about ajax that's just what people have been told is the better option because with ajax you can retrieve the data from mysql via client side (I think).

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi
Would it not be easier to just use the following in your meta tags on each page?

<meta http-equiv="Refresh" content="300; url=http://www.site.com/logout_page.php" />

The only problem with that code is that some browsers do not always have the meta tags enabled. That is why it is by far better to use php and not html in this case. And the following code placed in each page will work the same way sessions work if the session id is not in the url:

<?
session_start();
setcookie(session_name(), $_COOKIE[session_name()], time()+600, '/');

If you do not place the session id in the url it will have no influence on the sessions reliance of cookies. That can easily be tested and prooved as mentioned earlier.
-_-

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Silly me. I didn't follow the tutorial properly. I just found out that javascript was meant to hide the menus and not css. There for my fixed code is as follows and this topic is solved.

<body>
<form method='post' style='margin:0px; padding:0px;' name='form1'>

Modify or Create:<select name='modify||create' size=1 onchange='javascript:showprojecttype(this.options[this.selectedIndex].value);'>
<option value=''>Select
<option value='divcreate'>Create
<option value='divmodify'>Modify
</select><br>
<select id='divmodify' name='divmodify' size=1>
<option value='1'>option a
<option value='1'>option b
<option value='1'>option c
<option value='1'>option d
</select>
<div id='divcreate' name='divcreate'>
If this text shows it probably works.
</div>
</form>
<script language=javascript type='text/javascript'>
if (document.getElementById) { // DOM3 = IE5, NS6 
    document.getElementById('divmodify').style.visibility = 'hidden';
    document.getElementById('divcreate').style.visibility = 'hidden'; 
    } else { 
    if (document.layers) { // Netscape 4 
        document.divmodify.visibility = 'hidden';
        document.divcreate.visibility = 'hidden';
        } else { // IE 4 
        document.all.divmodify.style.visibility = 'hidden';
        document.all.divcreate.style.visibility = 'hidden';
        } 
    }
function showprojecttype(var1) { 
if (document.getElementById) { // DOM3 = IE5, NS6 
    document.getElementById('divmodify').style.visibility = 'hidden';
    document.getElementById('divcreate').style.visibility = 'hidden'; 
    } else { 
    if (document.layers) { // Netscape 4 
        document.divmodify.visibility = 'hidden';
        document.divcreate.visibility = 'hidden';
        } else { // IE 4 
        document.all.divmodify.style.visibility = 'hidden';
        document.all.divcreate.style.visibility = 'hidden';
        } 
    }

if (var1=='divcreate') {
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById('divcreate').style.visibility = 'visible'; 
        } else if (var1=='divmodify') { 
        if (document.layers) { // Netscape 4 
            document.divcreate.visibility = 'visible'; 
            } else { // IE 4 
            document.all.divcreate.style.visibility = 'visible'; 
            } 
        } 
    } else {
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById('divmodify').style.visibility = 'visible'; 
        } else { 
        if (document.layers) { // Netscape 4 
            document.divmodify.visibility = 'visible'; 
            } else { // IE 4 
            document.all.divmodify.style.visibility = …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I was going to do it exactly as you wrote...but how to make it like: when you login you can edit that Excel file(which was imported from MySQL db) online or without downloading it?????????????

Well you should be able to use the library I posted earlier to import the data into mysql (from memory there might have even been a tutorial in the documentation somewhere). And when downloading the excel file, you can use the library again to send it through the browser. All of this functuallity is explained in the documentation for the library I sent earlier. If you have any problems understanding the documentation then I can help you there but you should really try using the library I mentioned earlier with the documentation.