cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Edit: Didn't read the previous post and said the same thing

Carrots commented: Thanks for the help :) +2
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

So what exactly is the problem. I see on line 2 you need to add the second quote into the function input but other than that the code looks fine. Could you please explain what the question is as I see a pretty script with a description but no mention on any problems.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Do you mean to select from the database and count how many are selected. If that is the case then use the following:

<?php
$result=mysql_query('SELECT * FROM `table` WHERE `Location`="City1"') or die(mysql_error());
echo mysql_num_rows($result);

Hope that helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

To unset a session simply use the following.

<?php session_start(); //first line of file
//blah...
$_SESSION=array(); //unset session
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

...when you have got 101 emails about replies on this topic.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I'm no Joomla expert but I would suggest googling around for a pre made solution such as a patch.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It can be done on some sites simply by sending the same http request as the normal login process would send but many sites have security protocols in place which make it a little harder. I believe there is a firefox plugin that can record the http request info when you login the normal way then you can program curl to send the same data and fingers crossed for if it works.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

With all due seriousness, the world time at your disposal... ;)

Why doesn't it say Easter Time in Honolulu? Still Sunday in Honolulu where it should still be Easter time.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Wherever the bug is it isn't in that piece of code. But as the previous post states it usually means a missing curly bracket { or }.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you want to make or edit an xml file then you can use the xml writer library. Also if your only updating sections then you can use the str_replace() function.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

No.

Could you please elaborate on that. Is it that you want to order by the $_POST or what exactly is it you want done because it is hard to see what the problem is.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi, I have got a laptop, a desktop and soon will have a server but want to share the cpu between all of these machines so that if one computer crashes they all crash. In additon if a computer exceeds it current ram/cpu usage then it would grab cpu/ram from another computer on the network. I have two XP Pro 32-bit machines and soon will have a Ubuntu 9.04 64-bit machine. It is only the Ubuntu machine that needs to be able to get the additional cpu and ram from the other machines but does anybody know how to do this when there are different operating systems involved? Also the Ubuntu machine will need to be able to detect when a computer is turned off so it knows if it can get additional recourses. And I am hoping that there is a free solution. Thanks.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

She already has taken action. This topic has been discusses several times over the last 5 years that I have been a member. Dani has consistently stated she will not do it.

Is there any reason why because it would solve a lot of moderation problems. Or if dani thinks not having the post box would mean having fewer new members then perhaps when the post is made on a topic older than 4 months a question pops up "Are you already a member" and if the answer is yes then the post is ignored/deleted or if they aren't a member then a new topic would automatically be created after the registration process. Would that be a probable solution?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Good to hear. Could you please mark this thread as solved by clicking the solved link as it gives others on the topic credit and shows the status as solved in the forum.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

That error normally indicates that there is a missing curly backet { or } but according to the code I posted it looks like it's all there. Perhaps when you copied and paste you missed the last two lines? Is that true?

[Edit]
I guess in your mistake your forgot to place one of the brackets.
[/Edit]

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following.

<?php
include ("dbConfig.php");
require ("check.php");

if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
   if (!isset($_POST["submit"]))
   {
      $id2 = $_GET["id2"];
      $sql = "SELECT * FROM contacts WHERE id2=$id2";
      $result = mysql_query($sql);        
      $myrow = mysql_fetch_array($result);
      ?>
	  
      <form action="<?php $v=explode('?',$_SERVER['PHP_SELF']); echo $v[0]; ?>" method="post">
      <input type=hidden name="id2" value="<?php echo $myrow["id2"]; ?>">
   
      Name:<INPUT TYPE="text" NAME="name" VALUE="<?php echo $myrow["name"]; ?>" SIZE=30><br>
      Email:<INPUT TYPE="text" NAME="email" VALUE="<?php echo $myrow["email"]; ?>" SIZE=30><br>
      Who:<INPUT TYPE="text" NAME="age" VALUE="<?php echo $myrow["age"]; ?>" SIZE=30><br>
      Birthday:<INPUT TYPE="text" NAME="birthday" VALUE="<?php echo $myrow["birthday"]; ?>" SIZE=30><br>
      Address:<TEXTAREA NAME="address" ROWS=10 COLS=30><?php echo $myrow["address"]; ?></TEXTAREA><br>
      Number:<INPUT TYPE="text" NAME="number" VALUE="<?php echo $myrow["number"]; ?>" SIZE=30><br>
   
      <input type="hidden" name="cmd" value="edit">
   
      <input type="submit" name="submit" value="submit">
   
      </form>
      
<?php      
   }
}
   if (isset($_POST['submit'])) {
   	  $id2 = mysql_real_escape_string(stripslashes($_POST["id2"]));
      $name = mysql_real_escape_string(stripslashes($_POST["name"]));
	  $email = mysql_real_escape_string(stripslashes($_POST["email"]));
	  $age = mysql_real_escape_string(stripslashes($_POST["age"]));
	  $birthday = mysql_real_escape_string(stripslashes($_POST["birthday"]));
	  $address = mysql_real_escape_string(stripslashes($_POST["address"]));
	  $number = mysql_real_escape_string(stripslashes($_POST["number"]));
 
	  $sql = "UPDATE contacts SET name='$name', email='$email', age='$age', birthday='$birthday', address='$address', number='$number' WHERE id2=$id2";
 
      $result = mysql_query($sql) or die(mysql_error());
      echo "Thank you! Information updated.";
	}
?>
kunyomi commented: Patient and just simply genius! +1
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I changed to position of some brackets and fixed the php short tags. Also fixed some echo bugs for future versions of php. I also prevented sql injections. Fixed the additional slashes from being inserted into the mysql database. Also make parts of the code look pretty. And made the form to post to the the same php file the user is currently viewing.

So does that all work or are there still errors?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

This gives me an error. You took away the

<? } ?>
<?php

at line 32 to 33 right?

It renders the php code below useless. Hmm.

Oops, line 31 needs <?php

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following.

<?
include ("dbConfig.php");
require ("check.php");

if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
   if (!isset($_POST["submit"]))
   {
      $id2 = $_GET["id2"];
      $sql = "SELECT * FROM contacts WHERE id2=$id2";
      $result = mysql_query($sql);        
      $myrow = mysql_fetch_array($result);
      ?>
	  
      <form action="<?php $v=explode('?',$_SERVER['PHP_SELF']); echo $v[0]; ?>" method="post">
      <input type=hidden name="id2" value="<?php echo $myrow["id2"]; ?>">
   
      Name:<INPUT TYPE="text" NAME="name" VALUE="<?php echo $myrow["name"]; ?>" SIZE=30><br>
      Email:<INPUT TYPE="text" NAME="email" VALUE="<?php echo $myrow["email"]; ?>" SIZE=30><br>
      Who:<INPUT TYPE="text" NAME="age" VALUE="<?php echo $myrow["age"]; ?>" SIZE=30><br>
      Birthday:<INPUT TYPE="text" NAME="birthday" VALUE="<?php echo $myrow["birthday"]; ?>" SIZE=30><br>
      Address:<TEXTAREA NAME="address" ROWS=10 COLS=30><?php echo $myrow["address"]; ?></TEXTAREA><br>
      Number:<INPUT TYPE="text" NAME="number" VALUE="<?php echo $myrow["number"]; ?>" SIZE=30><br>
   
      <input type="hidden" name="cmd" value="edit">
   
      <input type="submit" name="submit" value="submit">
   
      </form>
      
      
   }
}
   if (isset($_POST['submit'])) {
   	  $id2 = mysql_real_escape_string(stripslashes($_POST["id2"]));
      $name = mysql_real_escape_string(stripslashes($_POST["name"]));
	  $email = mysql_real_escape_string(stripslashes($_POST["email"]));
	  $age = mysql_real_escape_string(stripslashes($_POST["age"]));
	  $birthday = mysql_real_escape_string(stripslashes($_POST["birthday"]));
	  $address = mysql_real_escape_string(stripslashes($_POST["address"]));
	  $number = mysql_real_escape_string(stripslashes($_POST["number"]));
 
	  $sql = "UPDATE contacts SET name='$name', email='$email', age='$age', birthday='$birthday', address='$address', number='$number' WHERE id2=$id2";
 
      $result = mysql_query($sql) or die(mysql_error());
      echo "Thank you! Information updated.";
	}
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Does column id2 equal the html form field named id2? That could be a problem if name=id2 doesn't exist in your html form and same with name=submit.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try replacing lines 33 to 50 with the following

<?php
   if (isset($_POST["$submit"]))
   {
   	  $id2 = mysql_real_escape_string(stripslashes($_POST["id2"]));
      $name = mysql_real_escape_string(stripslashes($_POST["name"]));
	  $email = mysql_real_escape_string(stripslashes($_POST["email"]));
	  $age = mysql_real_escape_string(stripslashes($_POST["age"]));
	  $birthday = mysql_real_escape_string(stripslashes($_POST["birthday"]));
	  $address = mysql_real_escape_string(stripslashes($_POST["address"]));
	  $number = mysql_real_escape_string(stripslashes($_POST["number"]));
 
	  $sql = "UPDATE contacts SET name='$name', email='$email', age='$age', birthday='$birthday', address='$address', number='$number' WHERE id2=$id2";
 
      $result = mysql_query($sql) or die(mysql_error());
      echo "Thank you! Information updated.";
	}
}
?>
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The normal way of redirection which even cpanel uses is making a .htaccess file. I would suggest following a few tutorials on making redirects with a .htaccess file.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The http referrer information is not very accurate and is best to ignore whenever possible. Why are you trying to get the referrer information because perhaps there is a better way of doing the job such as sessions.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

It seems to be pretty correct but is it just the order that they are in which is incorrect or is it something else?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

So I assume it is @yoursite.com. This would mean you will need to use the imap library to create their mailboxes and you can provide them with essential information via the echo function. Let me know if you have any troubles using the imap library.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

The following will count how many songs:

echo 'There are ';
echo count($array[0]['value']);
echo ' songs.';

Then to display each link use the following

for ($i=0;$i<count($array[0]['value']);$i++) {
echo $array[0]['value'][$i]['attributes']['URL'];
}

Also the styled version of your array output can be viewed with the following.

echo '<xmp>';
print_r($array);
echo '</xmp>';

That will add new lines and spacing.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well $output is an array and if you intend to only ever have 1 match then use the following.

<?php
$html_input='<img class="a" title="htc-pure-1" src="http://www.site.com/wp-content/uploads/2010/03/htc-pure-1.jpg" alt="">';

preg_match_all('@\<img[^\>]+src\="([^"]+)"[^\>]+\>@Uis',$html_input,$output);

$output=$output[1];
echo $output[0];
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Nice picture and can't wait until I get to the white chocolates. They taste so good. I wonder if a rabbit trap will catch the bunny this year.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Although I rarely use xml there is a xml reader library and perhaps that will be the key to solving your problem. I haven't used the xml libraries before since I haven't used xml much but hopefully that link should be of some use to you.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.*)$ /index.php?page=$1 [L]
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I see your new to daniweb and all but could you please explain in a little more detail. I mean like a paragraph of english with only small code snippets that demonstrate the problem instead of the entire source. I'll be waiting for the second post in the morning but until then I don't even know what the question is or where the problem is.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

My question is; I am trying to create an associative array in which each element of $matches[1] is keyed to it's corresponding $matches[2]. What is the best way to do this?

Could you elaborate on that or explain in more detail because some of those terms don't make any sense.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I came to this question a looong time ago. In fact I wanted free sms but never happened. I would suggest googling for online php sms providers as you will need to find a provider which you can a- send an email to which delivers the sms or b- use their php script which connects with the providers servers sending the sms. But in the end you need to pay per sms and they don't come cheap.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

May I suggest following my pagination tutorial because your code looks like a mess and needs a rewrite.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Yes, php can read open delete change and close email boxes just like gmail or hotmail can. The library that does this is the imap library. Also if you are planning on creating 50+ email's via php then I would suggest getting a managed vps as you might get into a few complications with your web host about recourse usage and spam. As for creating inboxes you can use the imap_createmailbox() function.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Could you give us an example of your problem. A demonstration of how to use new lines in php is as follows.

$text='This is the first line\n';
$text.="This is appended to the first line\n";
$text.='This is the second line separated by a \n';
$text.="\nThis is the last line.";

As you can see new lines are separated by \n but are only separated by \n when in double quotes. So in the above example, 2 of those lines showed a literal \n instead of a \n because they were in single quotes. So if you place a \n in double quotes then that will give you a new line and you can use file_put_contents to place the data into a text file.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you want somebody to embed bbcode for you then I don't think many people will offer unless you put some effort into it. I have read that there is a bbcode library or alternatively if that library isn't available on your webhost then you can use the recourse hungry regex.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

As well explained your post was I didn't exactly get the problem. From my understanding you want to use regex to extract links from html input. If that is correct then the following would be your solution.

<?php
$html_input='<img class="a" title="htc-pure-1" src="http://www.site.com/wp-content/uploads/2010/03/htc-pure-1.jpg" alt="">';

preg_match_all('@\<img[^\>]+src\="([^"]+)"[^\>]+\>@Uis',$html_input,$output);

$output=$output[1];
print_r($output);
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
$time_start = microtime(true);
$r=mysql_query($sql);
sleep(1); //let the server relax after such a big query.
$time_end = microtime(true);

$time_for_mysqlquery = $time_end - $time_start;
$number_of_rows=mysql_num_rows($r); //works only for SELECT in mysql query
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi, I have made an encryption and decryption script for those who want to encode data and decode the encoded data. This script may especially be useful for those who do not have the mbstring library installed as it uses a math grid. So for example you can store the encoded data in a text file where nobody can translate it then get php to translate it with the decode function. Enjoy.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

O' and I forgot to mention Survivor. Did everybody see the twist when Russell gave the immunity idle to that other person saving both of them and voting off someone very few in the tribe expected. That was so cool. Haven't seen a twist in any show like it. I like Russell and hope he wins the $1,000,000.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Your regex should be as follows:

$replace = "#\[vimeo[^\]]+([0-9]+)\]#is";
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I used to watch Big Brother but it was cut off the air. I hope Big Brother (Australia) comes on in the near future as it was a great show. I still remember the ending "This program is brought to you by Dreamworld, the home of Big Brother". Wish it were still on or that I could get live streaming of an international Big Brother.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Macgyver, Stargate Atlantis

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well why don't you upload them to your own site? That would be the ideal solution but if you wish to use youtube then post your code and the link to the tutorial you used and I shall attempt to debug it.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I do too, but the file is simply an image generatior and should be using the session established in the calling file, (shouldnt it??)

O' I see. As it is sessions are used in both files (the $_SESSION array) but I believe that since the second file is an image there is a chance that the session header is colliding with the image header. So perhaps use hashes/encryption and url variables instead.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You have two session_start() line 1, line 174
fix it

I assume it is 2 files.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Did you make sure that there is no white spacing before the <?php . Also what IDE are you using. Try opening your file in the old fashion windows notepad and delete any invisible white spacing before the < symbol at the beginning of the file. Some IDE's place a binary identification code at the beginning of the file making it impossible to use headers without a secondary editor. If that doesn't work then it's like being between a rock and a hard place. I don't know why so many people experience this glitch even when there is no ascii output before the headers and I would like to hear some of the suggestions too.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Yes and this thread is 12 days old and still Dani has taken no action. How long do we need to wait before such a feature will be introduced?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Thanks for all your opinions then. I'll get Netbean then :)

@cwarn23: I've done it before myself but thanks for the offer. Can I not use it with IIS though?

If you mean use Netbeans without IIS then although I have no idea what IIS is chances are that Netbeans wouldn't require such an api but I could be wrong. So perhaps try it and see if it works without IIS and if that doesn't work then do a few google searches.