nonshatter 26 Posting Whiz

Cool, I'm glad you got it working!
Please mark the thread as solved if the solution was adequate.
Regards,
ns

nonshatter 26 Posting Whiz

Isn't ereg_replace() deprecated now? Take a look into using preg_quote() instead.

Here's an example:

<?php
// In this example, preg_quote($word) is used to keep the
// asterisks from having special meaning to the regular
// expression.

$textbody = "This book is *very* difficult to find.";
$word = "*very*";
$textbody = preg_replace ("/" . preg_quote($word) . "/",
                          "<i>" . $word . "</i>",
                          $textbody);
?>

This should work the same with asterisks as it does for double quotes

nonshatter 26 Posting Whiz

This is a multi-dimensional array. The parent index (ddc) is an associative array and the child (price) is also associative. This would have a single value assigned to it:

$_SESSION['ddc']['price'] = "144";

Note: Unlike a real PHP array, $_SESSION keys at the root level must be valid variable names.

<?php 
$_SESSION[1][1] = 'cake'; // fails

$_SESSION['v1'][1] = 'cake'; // works
?>
nonshatter 26 Posting Whiz

Hmm, that's strange. Are you running in sudo mode?

sudo apt-get install emacs

If that still fails, try creating a new sources.list file. And save your original one as sources.list.1 so you don't lose it. Here's what mine has (I'm using the same version of Ubuntu (I am in the UK)):

#deb cdrom:[Ubuntu 10.04.1 LTS _Lucid Lynx_ - Release i386 (20100816.1)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://gb.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ lucid universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid universe
deb http://gb.archive.ubuntu.com/ubuntu/ lucid-updates universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid multiverse
deb 
       
nonshatter 26 Posting Whiz

And the name of the package you're trying to download?

nonshatter 26 Posting Whiz

Okay, What package are you trying to install exactly?

Can you post the output of the following:

cat /etc/apt/sources.list

and

uname -a

Another idea is to use 'Synaptic package manager' to download the package. This is found in system >> administration >> synaptic (if you're using the Gnome desktop environment)

nonshatter 26 Posting Whiz

This is most likely because you're echo-ing out stuff before you're header() statement.

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.

<html>
<?php
/* This will give an error. Note the output
 * above, which is before the header() call */
header('Location: http://www.example.com/');
?>
<?php
echo "something";
/* This will also give an error. Note the output
 * above, which is before the header() call */
header('Location: http://www.example.com/');
?>
nonshatter 26 Posting Whiz

Okay, it's good that you're interested!

Let's take an example:
You have a file which is 1Gb in size. You know that opening the file in the shell (e.g using 'cat') is going to be inefficient, as you'll have to scroll through a lot of lines to get to where you want to look. So less and more are basically alternatives to save resources and/or to only select the information that you're interested in.

The default behaviour of more is that the file content scrolls up one screen height at a time, and the space bar is used to advance to the next page. The command less is a more sophisticated version of more. Less can scroll backwards and has many more options over more. (There is plenty of information about this on the web).

If you're viewing a large log file and are only interested in what's happened most recently, then I would usually recommend using 'tail -f file.log' which would display the last 'x' number of lines of that file.

nonshatter 26 Posting Whiz

Shama,
You'll need to be a bit more specific. What Linux are you running? What command are you issuing to get that error? I guess you're using Ubuntu?

You could try

sudo apt-get update               // This will update your repository

and then

sudo apt-get install < name of package >
nonshatter 26 Posting Whiz

Well an .exe is an executable built for the windows environment, so getting it to run on any linux box isn't always possible.

However, there is some emulation software you can try. The most well known is Wine:

Wine is a program that offers a compatibility layer allowing Linux users to run some Windows-native applications inside of Linux. Wine is not the ideal. Ideally, you should find native Linux applications. You can use Ubuntu's software package manager to search for easily installable native Linux apps, or you can explore OSalt or Linux App Finder to find alternatives for specific Windows programs.

Not all Windows applications run in Wine. And some that do require extra configuration in order to work. You may want to consult the Wine HQ app database to see if the Windows application you're thinking of installing through Wine will work well with Wine or not. Platinum-rated applications will work with no extra configuration. The example on this page is a platinum-rated application.

nonshatter 26 Posting Whiz

This is one I've used before, with the 'remember me' feature

Depending on what your site is for, you may want to change the md5 hashing bit for something a bit more solid

nonshatter 26 Posting Whiz

Go to your cPanel, under the Files tab click 'Another File Manager'. Click through public_html directory, click a file or directory ONCE, then in the left panel there IS a permissions option. I'll leave it up to you to decide which files you will want to use file handles on.

nonshatter 26 Posting Whiz

Okay, go to your FTP access to browse your directories, then in the left panel there should be a link for permission settings. Tick all the boxes

nonshatter 26 Posting Whiz

Yes you're correct. I remember doing this on an old legacy system (SLES 9.3).

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql

Where prefix is the target installation directory, and the apxs2 switch is mandatory. But be wary, if you forget to add a specific module (e.g. php5-mysql, mod_ldap etc) at some point, then you'll have to go round the loop again (re-configure and re-make), adding the new switch options. I remember it being a bit of a pain to get all aspects of functionality to work!

Perhaps save your final configure command in a text file so you can refer back to it if you need to.

Hope that helps,
ns

nonshatter 26 Posting Whiz

Firstly, what Linux distro are you using? And in what format is the source in? rpm/deb/tar?

nonshatter 26 Posting Whiz

Yes this is possible. But the solution will depend on whether the $from variable always starts with INTERVAL, or whether it changes...

If it is always going to start with INTERVAL, then you could use a simple substr() function to cut off the first word. This simply says to print everything after the 8th character, counting I as 0, N as 1, T as 2 etc.

<?php
    $new_from = substr($from, 8);
    echo $new_from;
?>

The syntax for substr is

string substr ( string $string , int $start [, int $length ] )

Alternatively, if the first word changes you could look into using explode() (using space as the delimiter)

<?php
// Example
$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2 
?>
nonshatter 26 Posting Whiz

Okay, the error your getting means that fopen can't open the file you're requesting because the permissions of that file (or directory) won't allow it.

If you're server is on Linux:
From the shell cd to the directory where that file resides, and issue

chmod 777 *

This will give you full read/write/execute permissions to all files in the directory, and prevent the error from occurring again.

If you're running your site from a web host, check with them for how to change your permissions.

nonshatter 26 Posting Whiz

Finding a secure hash function is quite a challenging and often overlooked task, so thanks for this share! I haven't tested this yet, but I'm sure this will come in handy for many of us.

nonshatter 26 Posting Whiz

Not to worry, I managed to solve it using a for loop, although this doesn't allow me to use more descriptive names for the table ids:

onload = function() {
	cookie = new Cookie('sections', 200000);
	cookie.load();
	for(x=0; x < 4; x++) {
		var table = getItem("table_" + x);
	    if(table) {
		    var sections = table.getElementsByTagName('tbody');
		    var sectionRef;
		    for(var i=0; i<sections.length; i++) {
			    if(!sections[i].id || sections[i].id.indexOf(prefixes.section) == -1) { continue; }
			        sectionRef = sections[i].id.replace(prefixes.section, '');
			    if(cookie[sectionRef] === '0') { toggleItem(sectionRef); }
		    }
		}
	}
}

Let me know if you have a better solution. Consider it solved.
Cheers, ns

nonshatter 26 Posting Whiz

Works perfectly! Thanks again.

Just one last thing - When I add more than one table to the page, I can't seem to get more than one table state (collapsed/open) to be remembered upon page refresh. This probably has a simple solution.

I guess it's this function here that's causing the problem. Is it possible to make this more dynamic.

onload = function() {
	cookie = new Cookie('sections', 200000);
	cookie.load();
	var table = getItem('table1');   //This needs to cater for 2+ tables
	if(table) {
		var sections = table.getElementsByTagName('tbody');
		var sectionRef;
		for(var i=0; i<sections.length; i++) {
			if(!sections[i].id || sections[i].id.indexOf(prefixes.section) == -1) { continue; }
			sectionRef = sections[i].id.replace(prefixes.section, '');
			if(cookie[sectionRef] === '0') { toggleItem(sectionRef); }
		}
	}
}

The tables/images have test id names for now:

<table id="table1" width="100%">
           <tr>
	       <td>
                    <a href="#" onclick="return toggleItem(1)"><img id="image_1" src="/minus.gif" href="" align="left"></a>Backup Information:
               </td>
           </tr>
	   <tbody id="section_1">
	   <tr class="headers">
			<td><strong>Backup Date:</strong></td>
			<td><strong>Total Size Backed Up:</strong></td>
	   </tr>
	   <tr>
			<td>Gb</td>
			<td>cho $backup['duration']</td>
	   </tr>
	   </tbody>
	</table>

	<table id="table2" width="100%">
           <tr>
		<td>
                     <a href="#" onclick="return toggleItem(2)"><img id="image_2" src="/minus.gif" href="" align="left"></a>Backup Information:
                </td>
           </tr>
	 <tbody id="section_2">
		<tr class="headers">
			<td><strong>Backup Date:</strong></td>
			<td><strong>Total Size Backed Up:</strong></td>
		</tr>
		<tr>
			<td>Gb</td>
			<td>cho $backup['duration']</td>
		</tr>
	   </tbody>
      </table>
nonshatter 26 Posting Whiz

perhaps your form values aren't being passed correctly.
Perform a check to see if they're set first:

if(isset($_SESSION['user_id']))
{
   echo "it's set";
}

Or alternatively simply echo out each of the $_POST values to see if they're all there

nonshatter 26 Posting Whiz

This might be a long shot, but try:

. configure

instead of

./configure

I had a similar hiccup with a recent version of Ubuntu

tagazin commented: very kind and helpful +0
nonshatter 26 Posting Whiz

Are you sure you're wanting to update an existing record? Or are you trying to add a brand new record (in which case you want an 'INSERT INTO' statement rather than an 'UPDATE'). I can't seem to see any immediate errors here... Do you get a mysql error printed to the browser? or do you see the 'Record updated'

nonshatter 26 Posting Whiz
<?php
 $values = array(1,1,1,1,2);
   $i=0;
   $x=1;
   while(isset($values[$i]))
   {
     if($values[$i] == 1)  //you could use a strcmp or regex here instead
     {
         $number_of_matches = '$count'."$x";
         $number = $values[$i];
         echo "$number_of_matches = $number <br>";
         $x++;
     }
     $i++;
   }
?>
nonshatter 26 Posting Whiz

That's why I said "it's just an example"

nonshatter 26 Posting Whiz

Hi there, Have a look at this: This is just an example of how you can inter-mingle php and js.
The function is actually PHP, but what's contained inside of it is JS

<?php
	Redirect("page.html");
?>
 
/**
 * JavaScript Redirect Function - Redirects the user should the result data be empty
 * @param string $url the dynamic url to redirect to
 */
function Redirect($url) 
{ ?>
	<script type="text/javascript">
		window.location = "<?php echo $url ?>"
	</script>
<?php 
}
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>AES (Rijndael) Encryption Test in JavaScript</title>
<script src="aes-enc.js" type="text/javascript" language="JavaScript"></script>
<script src="aes-dec.js" type="text/javascript" language="JavaScript"></script>
<script src="aes-test.js" type="text/javascript" language="JavaScript"></script>
</head>

<body>
<?php
    mysql_connect("localhost","root","");
    mysql_select_db("encryption") or die(mysql_error());
    $userId = $_POST['userId'];


        if (($_SERVER['REQUEST_METHOD'] == 'POST') && ($_POST['key'] == ""))
        {

            $query = mysql_query("select * from employee_details where id = '$userId'");
                if($row=mysql_fetch_assoc($query))
                    {
                        echo '<tr>';
                        foreach($row as $value)
                        echo '<td>'.$value.'</td>';
                        echo '</tr>';
                    }

                else { echo "No rows returned"; }}
        else if (($_SERVER['REQUEST_METHOD'] == 'POST') && ($_POST['key']))
            {

               $columname = "ciphertext";
               $tablename = "employee_details";
               
               

                    function getField($field, $tbl_name, $condition)
                {
                    
                    $result = mysql_query("SELECT $field FROM $tbl_name WHERE id = ".$condition);

                     return @mysql_result($result, 0);
                }

                    $myValue = getField($columname,$tablename,$userId);

                    echo "$myValue";
                    doDecryptionPHP();   //call the php function
            }

function doDecryptionPHP()
{ ?>
<script type="text/javascript">
    doDecryption();    

    function doDecryption()
    {
                document.write("Inside Javascript");
                var ct, key;
                
      ct = hex2s(<?php echo $myValue; ?>);
      document.write("Inside Javascript");
      document.write(ct);
     // key = hex2s(theForm.key.value);
     // theForm.plaintext.value = byteArrayToHex(rijndaelDecrypt(ct, key, "ECB"));
     }
</script>
<?php
}            
?>
</body>
</html>

Perhaps something like that? I have no idea if that will work, …

nonshatter 26 Posting Whiz

That's great!

Thanks Airshow. I have the image change working now. Previously, I was using cookies to remember if the user had certain table open or hidden.

Here's the code I was using for that (I was calling <body onload="init()"> to call the function):

function init()
    	{
        	var cookie = getCookie('collapse_obj');
        	if(cookie)
        	{
        		var values = cookie.split(',');

            		for(var i = 0; i < values.length; i++)
            		{
                		var itm = getItem(values[i]);
                		if(itm)
                    			itm.style.display = 'none';
            		}
        	}
    	}

    	function makeCookie(name, value)
    	{
        	var cookie = name + '=' + escape(value) + ';';
        	document.cookie = cookie;
    	}	

    	function getCookie(name)
    	{
        	if(document.cookie == '')
            		return false;
        var firstPos;
        var lastPos;
        var cookie = document.cookie;

        	firstPos = cookie.indexOf(name);

        	if(firstPos != -1)
        	{
            		firstPos += name.length + 1;
            		lastPos = cookie.indexOf(';', firstPos);
            		if(lastPos == -1)
                		lastPos = cookie.length;
            		return unescape(cookie.substring(firstPos, lastPos));
        	}
        	else
            		return false;
    	}
  	function getItem(id)
    	{
        	var itm = false;
        	if(document.getElementById) { itm = document.getElementById(id); }
        	else if(document.all) { itm = document.all[id]; }
        	else if(document.layers) { itm = document.layers[id]; }
        	return itm;
    	}

    	function toggleItem(id)
    	{
        	itm = getItem(id);
        	if(!itm) { return false; }
	        if(itm.style.display == 'none') { itm.style.display = ''; }
        	else { itm.style.display = 'none'; }	
	
		 cookie = getCookie('collapse_obj');
        	values = new Array();
       		newval = new Array();
        	add    = 1;

        	if(cookie)
        	{
        		values = cookie.split(',');

            		for(var i = 0; i < values.length; i++)
            		{
                		if(values[i] == id)
                    			add = 0;
                		else
                    			newval[newval.length] = values[i];
            		}
        	}
        	if(add)
            		newval[newval.length] = id;
        		makeCookie('collapse_obj', newval.join(','));
        	return false;
    	}

So my …

nonshatter 26 Posting Whiz

Could you please, please post your code in (CODE) tags in future. In your second script, your input fields aren't enclosed in <form> tags. Here, you need to define the form action (post the form to the name of the file you want to process the information) and secondly define the form method (either 'get' or 'post'). You should probably read up on html forms and get vs post

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Words for Jumble</title>
</head>
<body>
<h3>Please enter 4 words between 4 and 7 characters long</h3>
<form action="name-of-file-to-pass-these-fields.php" method="post">
<p>word 1: <input type="text" name="word 1"></p>
<p>word 2: <input type="text" name="word 2"></p>
<p>word 3: <input type="text" name="word 3"</p>
<p>word 4: <input type="text" name="word 4"</p>
<?php
   $word 1 = word 1; //You don't need these here. The form values can only be retrieved and printed on the page your passing these values to 
   $word 2 = word 2;
   $word 3 = word 3;
   $word 4 = word 4;
?>
<input type="reset" value="Clear Form" />&nbsp;
&nbsp;<input type="submit" name="submit" value="send form" />
</form>
<?php
   echo $word 1;             //also you don't need these here
   echo $word 2;
   echo $word 3;
   echo $word 4;
?>
</body>
</html>

Your also mixing up HTML with PHP code. Remember to enclose PHP code in <?php ?> tags (html should be outside of these tags), and also finish all php lines with a semi-colon!

nonshatter 26 Posting Whiz

Hi all,

I have a simple problem. I have this javascript code which I'm using for collapsible tables:

<html>
<head>
   <script type="text/javascript">
    function getItem(id)
    	{
        	var itm = false;
        	if(document.getElementById) { itm = document.getElementById(id); }
        	else if(document.all) { itm = document.all[id]; }
        	else if(document.layers) { itm = document.layers[id]; }
        	return itm;
    	}

    	function toggleItem(id)
    	{
        	itm = getItem(id);
        	if(!itm) { return false; }
	        if(itm.style.display == 'none') { itm.style.display = ''; }   //display minus.gif
        	else { itm.style.display = 'none'; }	//display plus.gif
                return false;
        }
 </script>
</head>
<body>
<table width="100%">
		<tr>
                        <td><img src="/images/add.gif" href="javascript:;" onclick="toggleItem('info')" align="left">Backup Information:</td>
                </tr>
	<tbody id="info">
		<tr class="headers">
			<td><strong>Backup Date:</strong></td>
		</tr>
		<tr>
			<td><?php echo $formatted_date; ?></td>
		</tr>
	</tbody>
</table>
</body>
</html>

So what I'm trying to do is display the image /path/to/plus when the table is closed, and then display the image /path/to/minus when the table is open.

Can anyone help me?
Thanks, ns

nonshatter 26 Posting Whiz
$messageproper = "<table>
                   <tr>
                      <td>name</td>
                      <td>email</td>
                      <td>message</td>
                   </tr>
                   <tr>
                      <td>".ucwords($_POST['name'])."</td>
                      <td>".ucwords($email)."</td>
                      <td>".$_POST['message']."</td>
                   </tr>
                 </table>";

echo $messageproper;

Something like this should work but check the syntax, you might need to play around with the quotes to get it working properly...

nonshatter 26 Posting Whiz

Hey, if you want a visual counter look here: http://www.hashemian.com/tools/javascript-countdown.htm

A countdown timer is something that needs to be done client-side e.g. in javascript.

This is one I've used previously. Once you get it counting down from 60 seconds post your code and we can implement the redirect.

nonshatter 26 Posting Whiz

That's still wrong Cossay. Tables are block-level elements, thus you can't be aligned. The syntax doesn't look right either

nonshatter 26 Posting Whiz

Can you post all your code so far and put your separate pages in separate code tags with their file name at the top. This will make it easier to help you.

nonshatter 26 Posting Whiz

So you want the table with the values in, and then assign them to $messageproper? What are you using messageproper for?

You can do it exactly the same way as you'd done previously. I'm not sure if you still want the line breaks in there or not though.

// table with the values goes here...


//then assign the values to the messageproper variable.
$messageproper ="\n\n" .
		"Name: " .
		ucwords($_POST['name']) .
		"\n" .
		"Email: " .
		ucwords($email) .
		"\n" .
		"Message: " .
		$_POST['message'] .
		"\n" .
		"\n\n" ;
nonshatter 26 Posting Whiz

But name message and email are individual variables being assigned to $messageproper. So my code should work.

nonshatter 26 Posting Whiz

You have no html in that code!...

<?php

  // ---- your code ---- //

?>
<html>
<table>
  <tr>
      <td>name</td>
      <td>email</td>
      <td>message</td>
  </tr>
  <tr>
      <td><?php ucwords($_POST['name']); ?></td>
      <td><?php ucwords($email); ?></td>
      <td><?php $_POST['message']; ?></td>
  </tr>
</table>
</html>

tr creates a new row, td creates a new cell

nonshatter 26 Posting Whiz

You shouldn't need a template to do this! Just look at the CSS.

The easiest way to do this is to create a <div> tag that wraps around all your content, then specify the width of it using CSS.

<html>
<head>
<style type="text/css">
  container {
    width: 100%;
}
  </style>
</head>
<body>
    <div id="container">
        ------PUT ALL YOUR CONTENT HERE-----
    </div>
</body>
</html>
nonshatter 26 Posting Whiz

Hi Vego, this shouldn't be a problem if they're making the file readily available to you! wget shouldn't have a problem downloading large files either.
First install wget (if it isn't already installed by default), then play around with the syntax options. When you can download the file you want, you can set up the scheduled task so that it will automate the download.
Hope that helps

nonshatter 26 Posting Whiz

If you are using Linux, you can set up a cron job. The cron daemon provides the ability for a system administrator or any other user (if permitted to do so) to automate the routine running of scripts, tasks or any other server function on a regular basis. You can use 'crontab -e' to set up your scheduled task. Or on windows you can use the "scheduled tasks" tool, although I don't think this is as good.
Then you will also need some sort of script or program to execute and download your file every X number of hours or X number of days.
Do you know where the file is located? Do you have access to their web server directories? FTP?

There is a tool I use for this sort of thing called wget (again, I use linux for this). An example command you could use would be something like:

wget -c -r –passive-ftp -nH ftp://:@//ftp_dir/*.zip

Look here for more example usage: http://www.editcorp.com/Personal/Lars_Appel/wget/v1/wget_7.html

nonshatter 26 Posting Whiz

So if this is your edit page: I have changed the form action to post the form to the same page as it is clearer to explain this way:

<form action="<?php $SERVER['PHP_SELF'] ?>" method="post" >
Name:<br />
<input type="text" name="Name" size="30" /><br />
Email:<br />
<input type="text" name="Email" size="30" /><br />
Comment:<br />
<input type="text" name="Comment" rows="80" cols="80" /><br />
<input type='submit' name="save" value="save" />
</form>

<?php
if(isset($_POST['save']))    //determine whether the button is clicked
{
    $name = $_POST['Name'];       //gather the form values
    $email = $_POST['Email'];
    $comment = $_POST['Comment'];
    
    //update query
    $update = mysql_query("UPDATE table SET name='$name', email='$email', comment='$comment' WHERE userID='12'") or (mysql_error());      
}
?>

You could also pre-populate these fields with the users existing details using the value attribute, but you'd have to pass them from the previous page or get their details from the database.

<input type="text" name="Name" size="30" value="$name"/>
nonshatter 26 Posting Whiz

So what's the error you're getting? Try this and report back with the error message:

$Query = mysql_query("INSERT INTO products (title, url, finalurl, category, owner, shortdescription, longdescription, price, rank, tag1, tag2, tag3) VALUES ('$Title','$Random_Number','$url','$Category','$Username','$SD','$LD','$Price','0','$Tag1','$Tag2','$Tag3')") or die(mysql_error());

echo "Yes! Your product was created I hope " . $Title . " will rank high!";

If there's a syntax error in the mysql statement, the code will stop executing (or die()). If there is no error, then it will echo the success message.

nonshatter 26 Posting Whiz

Okay, the correct way to do this will depend on what your form action and method are set to do. If you could post your form code I should be able to help.

nonshatter 26 Posting Whiz

You get this error message because you're trying to retrieve $_GET from the URL when it doesn't exist. Why not check whether the variable exists before deciding what to do with its value.

E.g.

<?php
    if (isset($_GET['start'])) { $start = $_GET['start']; } 
    else { $start = 0; }  
?>

Alternatively, add the start variable in the URL that links to the first page, then you wouldn't have this problem.

<a href="/VIEW_in_STEPS5b.php?start=0"
nonshatter 26 Posting Whiz

I don't see a question :O

I suggest you start small, rather than jump in the deep end. First download and install apache web sever, mysql + php. Or download XAMPP - it is an easy install and will give you all the software you need to start developing on your local machine.

Then create a small database table and connect to it using PHP, then try pulling and pushing data in/out of it. There is mounds of information online on how to do this.

nonshatter 26 Posting Whiz

So what exactly are you asking?

nonshatter 26 Posting Whiz

I can help, but I'm not doing all your work for you!

Do some coding, then post a more specific question that we can actually help you with.

nonshatter 26 Posting Whiz

I developed an online auction website for my final yr project. It's a pretty good project to do - lots of potential for interactive and business-like features.

And to add to that - in my opinion, for a final year project it shouldn't really matter if a jQuery feature doesn't work with a certain version of a web browser... So long as you can explain why it may not work, perhaps providing an alternative feature or workaround for older/incompatible browsers!

nonshatter 26 Posting Whiz

If it's books you want, I'd recommend PHP and MySQL Web Development by Luke Welling and Laura Thomson (try and get the 3rd edition).
I managed to pick up a 2nd hand copy for £5 on Amazon.
Otherwise tiztag and w3schools are good places to start.

somedude3488 commented: Please look at the date before posting. The thread is over 2 years old. -1
nonshatter 26 Posting Whiz

Never mind. I ended up using Perl instead - it worked straight away!

nonshatter 26 Posting Whiz

Hi all,
How can I execute an external program (wget) on a linux box? I assume I should be using exec() or something similar.
The command I'm trying to execute is:

wget -p 'x.x.x.x/inventory.ssi?mag_0=1&mag_1=1'

Which returns the html page of inventory. I am then parsing the file using DOMDocument to extract the relevant text.
Running this in the terminal yields the result I want.

If I simply do this:

exec("wget", $ret);
	foreach($ret as $value)
	{
		echo $value;
	}

Then it prints the wget usage options to the browser, but issuing my command seems to do nothing?
Cheers