FlashCreations 20

I'd suggest a simple variable that increments with each iteration of the foreach loop. With something like the code below, you can access the number of the element with the counter variable.
[code=PHP]
// +--
// | Loop through the products.
// +--

$counter = 0; //Init the counter

foreach ($prodlist as $num => $prod) {
//Leave the below line at the top of the loop
$counter++; //Increment the counter with each product
//The counter starts at 1 and counts up

  // +--
  // | Print a table row opener.
  // +--

  print '<tr class="' . $trclass . '">' . $eol . $eol;

  // +--
  // | Print the tds and their content.
  // +--

  $prodname  = $this->xhtml_encode($prod['name']);
  $prodid    = $this->xhtml_encode($prod['id']);
  $prodlink  = $this->link_namespace($app,'prodshow',$prod['id']);
  $proddesc  = $this->xhtml_encode($prod['descshort']);
  $imgname   = $prod['imgsm'];

  $add_ok = 1;

  if (($prod['useinv']) && (!($prod['invlevel'] > 0))) {$add_ok = 0;}
  if ($prod['pricestatus'] == 'D') {$add_ok = 0;}

  $quandisp = 0;
  $quanform = $this->globals('khxc_cgi.' . $formid . '--' . $prodid . '--quantity');

  if (isset($quanform)) {$quandisp = $quanform;}

  if ($add_ok) {

       print '<td class="' . $tdclass . '">' . $eol . $eol;
       print '<label for="' . $formid . '--' . $prodid . '--quantity';
       print '" class="hidden">Quantity</label>' . $eol;
       print '<input class="khxc_formfield" type="text" name="';
       print $formid . '--' . $prodid . '--quantity';
       print '" id="' . $formid . '--' . $prodid . '--quantity';
       print '" value="' . $quandisp . '" size="5" maxlength="5" />' . $eol;
       print '</td>' . $eol . $eol;

  } else {

       print '<td class="' . $tdclass . '">&nbsp;' ...

FlashCreations 20

Sure it is. As long as you don't have any includes or extensions that could access this global. My guess would be that you won't be including and malicious scripts on your site intentionally, so with the details you gave, I would say you're safe!
-PhpMyCoder

FlashCreations 20

You don't, well technically you can, but there's a better way in my mind to store avatars. Simply upload them to a writeable directory (and be sure to check their name for validity: ensure to remove and null characters) and rename them to the user's name. You can also rewrite the writeable directory so that the URL to access a user's picture.

If you absolutely insist on storing an image in a MySQL database, [URL="http://www.phpriot.com/articles/images-in-mysql"]check out this tutorial on PhpRiot[/URL].

FlashCreations 20

Yes,
If you could send me the full files that would help in the debugging process. Also, would you mind sending over a few more samples of the CSS styles & URL's so I can ensure I've tailored the Regexes to work with everything you throw at them.
Cheers,
PhpMyCoder

FlashCreations 20

It all depends on what you are looking for. Java has the best implementation of OOP, but requires the JRE (Java Runtime Environment) to be installed for applications to work. It should be used for cross-OS programs or to server web content (JSP).
PHP is best suited for web applications since most of its features are targeted towards database and user interaction. It's my choice of language for dynamic web content (hence the name PhpMyCoder).
C++ is just a good language to know, period. It gives you, the developer, a lot of power and control over your applications, but sometimes requires you to define functionalities that other higer-level-languages might have by default. That said C++ has it's applications. You could use it for a Windows Program, but it wouldn't be my first choice for developing an online forum or blog. Also note, that C++ is [b]very[/b] popular as pretty much every application has some part of it written in it or C.

FlashCreations 20

I think the question is not Flash/PHP vs. AJAX/PHP. Since Flash also designs content I would argue the debate is actually Flash vs. HTML5/CSS/JavaScript. The latter is an inseparable and pretty much unbeatable trio.
Besides the open source benefits of HTML, CSS, and JavaScript, the big seller for most font end developers and designers is that they are one-hundred percent free. Some don't have the $500 to drop on products from Adobe to develop Flash content for their site.
The other big reason for HTML/CSS/JavaScript over Flash in my mind is that HTML/AJAX/JavaScript has a fall back. AJAX (or JavaScript) is only meant to extend the experience of a static HTML page, so when it's not supported, the browser just falls back to links and static content contained in the HTML. Flash, on the other hand, has no easy fall back. If a user doesn't have Flash, they might see a message similar to Youtube's "Javascript is not enabled or you need to install Flash" message. To create a fall back for a fully Flash site you would need to code it in HTML/CSS, which defeats the purpose of creating it in Flash in the first place.

As I've made it quite obvious by now, I'm on the HTML/AJAX side of the argument, but there are some valid points for Flash. Currently, there is no open source video format supported by HTML5 that includes live video or audio, so until the day that becomes available, sites like Justin.tv and UStream.tv ...

FlashCreations 20

[QUOTE=garryamin;1318061]The limits are based on characters and not with words. LongText allows 4GB of characters, so in theory it depends on how long your words are. It is possible to have ten words that contain characters more than 100 words. But I doubt it is. Some possible restrictions could fontend backend script trimming and / or server limitations.[/QUOTE]
This sounds awfully familiar, almost like this was a post I wrote. In fact it is (the first post in this thread after the author's post).

"Limits are based on characters and not by words. Longtext allows for 4GB of characters, so in theory it depends on how long your words are. It is possible to have ten words that contain more characters than 100 words. But I doubt this is the case. Some possible limitations could be fontend scripts, backend trimming, and/or server limitations.
It would really help to see some code. As a rule, I would always post some relevant code unless your question involves theory."

Besides the thread is already solved, garryamin. Maybe you can contribute to another thread.

FlashCreations 20

Great! Please make sure to mark this thread as solved so other users know you don't require further assistance. Thanks :)

FlashCreations 20

It's also important to note that overuse (Multiple requests made in under a couple seconds) of websites such as Yahoo, Google, or Bing can get your IP banned from accessing their services. Furthermore, if you are on a shared IP your chances of being blocked are higher since there is a chance of multiple cURL connections to one site in a short amount of time.

FlashCreations 20

[QUOTE=PhilEaton;1317049]Yeah I saw that and changed it but in my original code it still didn't work. But it's all good now thanks a lot![/QUOTE]
No problem! Glad it's all fixed! :)

FlashCreations 20

Well first, there's [URL="http://www.pdflib.com/"]PDFLib[/URL]. It's the popular choice (it's the library [URL="http://php.net/manual/en/book.pdf.php"]listed on PHP.NET[/URL]), but depending on usage, you might have to pay for it.
Some other notable choices a [URL="http://www.fpdf.org/"]FPDF[/URL] and [URL="http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf"]TCPDF[/URL].
There are also a few HTML2PDF converters such as [URL="http://www.digitaljunkies.ca/dompdf/"]dompdf[/URL], but if you aren't going to use the CSS property described in my link, they kind of defeat the purpose.
If you want help with the information provided in my original link, write back and I'll explain.

FlashCreations 20

[QUOTE=britoniah3480;1316693]Lol because of this

[CODE=php]
$id = $_GET['id']; //you forgot to put the $id =

$username = "root";
$password = '123456';
$hostname = "localhost";
$db = mysql_connect($localhost, $username, $password)
or die ("Unable to connect to mySQL".mysql_error());
mysql_select_db('mynewdbase');

$del = "DELETE FORM newdbase WHERE id = $id";

$nres = mysql_query("$del);

?>[/CODE]

you should try my site it might help you better :)[/QUOTE]

It also might be useful to note that once quotes are opened, they must be closed. But in your instance, quotes aren't necessary on this line.
[CODE=PHP]
<?php
$id = $_GET['id']; //you forgot to put the $id =

$username = "root";
$password = '123456';
$hostname = "localhost";
$db = mysql_connect($localhost, $username, $password)
or die ("Unable to connect to mySQL".mysql_error());
mysql_select_db('mynewdbase');

$del = "DELETE FORM newdbase WHERE id = $id";

$nres = mysql_query($del); //Much better
?>[/CODE]

FlashCreations 20

[QUOTE=chrishea;1317011]If you create the output as a Word file, you can tell it where you want the page breaks. I don't have the details handy but if you want to go that way I can dig up some details (I have done it but I would need to dig through a program to remember how).[/QUOTE]
If your users don't mind the hassle of opening a word document, you might consider a PDF for compatibility. I know a lot of people, myself included, hate them, but there are a bunch of PDF libraries for PHP, probably a lot more than there are word document libraries for PHP.

FlashCreations 20

If you are using this code to download an image to [i]your[/i] computer (and not a server), I would use Python instead since it is suited for server side development as well as little scripts you want to schedule on your computer.
If you would like to continue with PHP, hielo has the right idea. Although I think cURL can handle FTP if you use an FTP URL like [url]ftp://user:pass@host:port[/url], but I'm not sure.
On second glance I noticed that you provided us with port 22, which happens to be the port for SSH (most likely for SFTP use). If you are using SSH/SFTP, you will need to use [URL="http://www.php.net/manual/en/ref.ssh2.php"]PHP's SSH functions[/URL].

FlashCreations 20

You probably couldn't find anything because this is not a PHP specific feature. It only requires some HTML & CSS. I found [URL="http://www.chami.com/tips/internet/052898I.html"]this tip on adding printer-only page breaks[/URL]. Is this what you're looking for?

FlashCreations 20

Props to you for using something other than MD5.
Now on to business. The basic way to validate a password stored in a database is to use a one way encryption such as SHA1. This involves hashing the password the user provides at registration and storing it in a database. To check if login credentials are valid, simply run the given password through the same hash function and compare the hashes. If the hashes are the same, the passwords match.

The code snippet you provided is not valid, nor does it validate. Please provide a better snippet that shows your problem.

FlashCreations 20

[URL="https://www.google.com/adsense/"]Google Adsense[/URL] is nice, free too. It's not PHP, but it should work.

FlashCreations 20

Regarding for your original code, the reason why the IP displayed but you couldn't click the link is because you were missing an = between the href and the first quote. Try this:
[code=HTML]

FlashCreations 20

If application/octet-stream works, why not use it? The only problem you mentioned is that Opera reports the file as 1.2MB instead of 1.12MB. This is probably not an error on your part. Opera usually rounds up all sizes to the tenths place so a file might be 12.56 MB but Opera will show it as 12.6 MB for succinctness. As long as the file downloads properly and reports the correct size when you view it in Explorer (as in viewing files on your computer, not Internet Explorer), why bother?

FlashCreations 20

[QUOTE=vibhadevit;1316560]The function will not internally parse it.
But lets say i have one php page : [url]http://www.mysite.com/register.php[/url]
And i use file_get_contents('http://www.mysite.com/register.php') then html source will be returned by file_get_contents function.

Simply we can have 'View Source' type of functionality.[/QUOTE]

From the PHP.net documentation:
"file_get_contents() is the preferred way to [b]read[/b] the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance."

If the file is stored locally, [icode]file_get_contents()[/icode] basically does the following:
[code=PHP]
$fp = fopen($file, "r");
$contents = fread($fp, filesize($file));
fclose($fp);
[/code]
It will not execute any PHP contained within the file. For any PHP code within the file to execute you will have to use output buffering and include the file, as mschroeder suggested, or grab the file with cURL (which is similar to grabbing the source from a browser). By far, including the file is faster since it doesn't require any socket connections like cURL does.

FlashCreations 20

Well the most basic way in PHP would be to simply use the header function to report the 301 and then notify the user of the new location. That can be done like so:
[code=PHP]
<?php
//301 Redirect
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://sub.domain.com/index.php?product='.urlencode($_GET['product']));
?>
[/code]

Though, if you want every query in the form of index.php?product= to be redirected to the subdomain, htaccess is your best choice. If you have it enabled, use it over PHP if at all possible since the rules in it are executed before PHP parses and runs any scripts. What you are looking for can be done with:
[code=.htaccess]

RewriteEngine On RewriteRule ^index.php?product=(.*)$ http://sub.domain.com/index.php?product=$1 [L,R=301]

[/code]

[b]EDIT:[/b] DaniWeb bug above? I set the code type in the above tag to htaccess. Are unknown types being defaulted to PHP or is there some kind of language detector (if so, .ht files look nothing like PHP source)?

FlashCreations 20

The problem probably doesn't involve the user's internet settings, but you never know. Why not try something like this to process the form:
[code=PHP]
<?php
//Protect email's reader by sanitizing all data
array_walk($_POST, 'htmlentities');

//Ensure Taxed Field is filled
if($_POST['Taxed'] != 'No' && $_POST['Taxed'] != 'Yes') {
//Send user back to form asking for taxed field
//Don't fill the form because it is impossible for a user to not submit
//An answer to taxed. Only a hacker or exploiter would be able to do this
header('Location: http://www.n-v-m.co.uk/Booking.html');
die('No taxed option selected'); //You can change this text if you want
}

//Fields to grab
$fields = array('company', 'name', 'phonenum', 'email', 'vman', 'vreg', 'colladd', 'collconname', 'collconnum', 'deladd', 'delconname', 'delconnum', 'collectiondt', 'deliverydt', 'Taxed', 'billadd', 'custordnum', 'addcom');

//Construct message
$message = '';
for($x = 0; $x < count($fields); $x ) {
$message .= $_POST[$fields[$x]];
if($x != count($fields) - 1) {
$message .= '|';
}
}

//Send message and redirect to Thank You Page
mail('info@n-v-m.co.uk', 'Order from '.$_POST['company'].' ('.$_POST['name'].')', $message, "From: NVM Booking Form\r\n");
header('Location: http://www.n-v-m.co.uk/Thankyou.html');
?>
[/code]

FlashCreations 20

A few years back I made a simple Pagination Class w/ documentation. I'm not trying to pedal my script, but if want to take a look you can [URL="http://files.phpmycoder.net/1209da/"]find it on my site[/URL].

FlashCreations 20

[QUOTE=hielo;1315970]then just get rid of the last part where you are appending the time:
[icode]$dd = substr($d_var['weekday'],0,3) .','. $d_var[mday] .' '.substr($d_var[month],0,3).' '. $d_var[year];[/icode][/QUOTE]
That was my first thought, but then I assumed the solution wasn't as simple as that. I don't know though, it might be. In which case, we all would look like total idiots for making it so difficult. :P

FlashCreations 20

You will need to edit your theme (this can be done in Wordpress) and find your footer.php file. Locate the appropriate code, in this case some kind of heading for a bookmarking list, and remove it. Save the file and refresh a blog page. Your undesired content should be gone!
Cheers,
PMC

FlashCreations 20

To be absolutely sure, you could split the string into the date and time part with [icode]explode()[/icode]:
[code=PHP]
//Split it and eliminate the time
list($date,) = explode(' ', $date);
//Show the result
echo $date;
[/code]

On the off change that the date format does not add leading zeros to one digit months/days (I believe the standard does), this would be one way around that and would still work with two digit months and/or days.

FlashCreations 20

Since you're new we'll cut you some slack! But if you noticed there is a pinned thread at the top of the forum that talks specifically about this error. Be sure to [URL="http://www.daniweb.com/forums/thread191031.html"]check out this great thread[/URL]. It's bound to have your solution!

FlashCreations 20

Props to you for having the most creative greeting I've seen on DaniWeb! :D
Ahoy Captain Syphilis (Sounds a little strange, but anyway),
I'd suggest registering [icode]socket_close()[/icode] as a shutdown function after the child makes a connection. This way any early exits will close the socket before ending the script. I'm not sure if this will fix your problem, but give it a shot. It's my best guess at the current time.

[code=PHP]
//Create the close socket function
function closeSock() {
//Grab the global sock variable & close it
global $sock; //Make this $socket if in the parent
socket_close($sock);
}

//Register yee function as when the user abandons ship
register_shutdown_funtion('closeSock');
[/code]

Also, while were on that subject, why not close the register the [icode]socket_close()[/icode] function as a shutdown function in the parent, just for good measure.
Good Luck Mate,
PhpMyCoder

FlashCreations 20

So is it solved? If not, can you give us a sample of some of the URL's you try? The URL you gave in the first post should work fine and did work fine when I tried it. If it doesn't, have you set your charset to the appropriate one with the meta charset tag?

FlashCreations 20

I'm no Wordpress expert, but I'll give it a shot. My guess is that your functions are being called before Wordpress outputs a header (such as a redirect). This will cause problems because headers are sent after the first character of content has been outputted. It might help to actually echo the values instead of end the PHP and insert them in the file. Try something like this:

[code=PHP]
<?php
function test() {
global $whatever;
echo 'some html hereand lets add that global: '.$whatever.'';
}
?>
[/code]

Instead of:

[code=PHP]
<?php
function test() {
global $whatever;
?>
some html hereand lets add that global: <?= $whatever ?>
<?php
}
?>
[/code]