Re: [PHP] Help with redeclare error
On Thu, 2011-10-27 at 17:40 -0700, UltraMega Admin wrote: On 10/27/2011 5:33 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 20:06, Jason Pruimli...@pruimphotography.com wrote: Most likely you have in included in 2 files... Look into it from that angle... It only needs to be included in 1 file to work throughout all the files. Prune is spot-on. That error generally happens when you include a file that has already been included, which contains function definitions. Look at the code in the files the error mentions, on the lines it specifies, and - most likely - you'll see an include. Changing them to include_once instead will resolve the issue, as PHP will just skip the order if it's already been done within the execution of the code. A function with that name already exists in PHP as of 5.3.0. You'll have to rename it or something. http://us2.php.net/manual/en/function.date-diff.php Or wrap it inside a function_exists() call assuming that both your function and the internal one do the same thing. -- Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Help with redeclare error
A function with that name already exists in PHP as of 5.3.0. You'll have to rename it or something. http://us2.php.net/manual/en/function.date-diff.php That looks like what happened that new function was added and we had written one with the same name from the stone age... Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with redeclare error
Hello All, I have some code that just broke with a PHP upgrade, the error says: PHP Fatal error: Cannot redeclare date_diff() the line of the error is the close bracket of the function which is below. Any ideas what's going on, I'm stuck? function date_diff($start_time, $stop_time) { $seconds = strtotime($stop_time)-strtotime($start_time); $days = intval($seconds/86400); $seconds -= $days*86400; $hours = sprintf(%02d,intval($seconds/3600)); $seconds -= $hours*3600; $minutes = sprintf(%02d,intval($seconds/60)); $seconds -= sprintf(%02d,$minutes*60); # $time_diff = Days= . $days . Hours= . $hours . Minutes= . $minutes . Seconds= . $seconds; $time_diff = $hours . : . $minutes; return($time_diff); } Everywhere I call the function it looks like this: date_diff($fldstart_time,$fldstop_time); Thanks! Jack
Re: [PHP] Help with redeclare error
Jason Pruim li...@pruimphotography.com On Oct 27, 2011, at 7:55 PM, Jack wrote: Hello All, I have some code that just broke with a PHP upgrade, the error says: PHP Fatal error: Cannot redeclare date_diff() the line of the error is the close bracket of the function which is below. Any ideas what's going on, I'm stuck? Most likely you have in included in 2 files... Look into it from that angle... It only needs to be included in 1 file to work throughout all the files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with redeclare error
On Thu, Oct 27, 2011 at 20:06, Jason Pruim li...@pruimphotography.com wrote: Most likely you have in included in 2 files... Look into it from that angle... It only needs to be included in 1 file to work throughout all the files. Prune is spot-on. That error generally happens when you include a file that has already been included, which contains function definitions. Look at the code in the files the error mentions, on the lines it specifies, and - most likely - you'll see an include. Changing them to include_once instead will resolve the issue, as PHP will just skip the order if it's already been done within the execution of the code. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with redeclare error
On 10/27/2011 5:33 PM, Daniel Brown wrote: On Thu, Oct 27, 2011 at 20:06, Jason Pruimli...@pruimphotography.com wrote: Most likely you have in included in 2 files... Look into it from that angle... It only needs to be included in 1 file to work throughout all the files. Prune is spot-on. That error generally happens when you include a file that has already been included, which contains function definitions. Look at the code in the files the error mentions, on the lines it specifies, and - most likely - you'll see an include. Changing them to include_once instead will resolve the issue, as PHP will just skip the order if it's already been done within the execution of the code. A function with that name already exists in PHP as of 5.3.0. You'll have to rename it or something. http://us2.php.net/manual/en/function.date-diff.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with _get error
Hello All, I'm having a problem with this line of code which worked fine for years: $l_url2 = ..$_GET[SERVER_NAME]; Here is the error: [Wed Mar 23 13:33:49 2011] [error] [client 16.139.201.61] PHP Notice: Use of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in /home//modules/jack.php on line 322 Thanks! J
Re: [PHP] help with _get error
Jack wrote: Hello All, I'm having a problem with this line of code which worked fine for years: $l_url2 = ..$_GET[SERVER_NAME]; Here is the error: [Wed Mar 23 13:33:49 2011] [error] [client 16.139.201.61] PHP Notice: Use of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in /home//modules/jack.php on line 322 Thanks! J You need to learn the differences in error reporting levels. My guess is you changed hosts recently. ;-) Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Jim Lucas wrote: Payne wrote: Jim Lucas wrote: So, to summarize everything said, with my own added notes. [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php The following wont work if you use this from the CLI. There is not remote addr. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); Loose the semi-colon at the end of your SELECT statements. The mysql extension for PHP will add it on its own. $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; You missed a semi-colon at the end of this line $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't do this within a function call. Like someone else said, you need to run the if/else and while portion before you mail call. Capture that data and then add it to the mail call. if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? So here is the code re factored. ?php # Setup your variables for later use. $recipient = '[EMAIL PROTECTED]'; $subject = 'The IP\'s that Attacked'; $add_headers[] = 'From: [EMAIL PROTECTED]'; $add_headers[] = 'Reply To: [EMAIL PROTECTED]'; $separator = \r\n; //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = SELECT ip, date, time, CONCAT(city, ', ',country) as location FROM ips WHEREcountry != '' ANDdate = current_date() ORDER BY date, time, country asc ; $result = mysql_query($query); ob_start(); echo TXT The following are ip's that have try to attack your system. TXT; //if that ran ok, display the record if ($result) { echo TABLE table width='150'trtdCountry/tdtd# of Attacks/td/tr TABLE; //fetch and print the records while ( $row = mysql_fetch_assoc($result) ) { echo ROW tr td align='left'{$row['ip']}/td tddiv align='right'[$row['date']}/div/td /tr ROW; } echo '/table'; //free up the resources mysql_free_result ($result); } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize for any incovenience./pp'. mysql_error() . '/p'; } $body = ob_get_clean(); $mailsend = mail($recipient, $subject, $body, join($separator, $add_headers)); print($mailsend); ? Jim, thanks, well I am still trying to work it out. Your scripts gives me this when I run it -- [EMAIL PROTECTED] to me show details 9:02 PM Reply Reply To: [EMAIL PROTECTED] The following are ip's that have try to attack your system. table width='150'trtdCountry/tdtd# of Attacks/td/tr/table And mine is doing this nowe-mails the html code and nothing from the db html head titleAttack's on $hostname/title /head body if ($result) { //if that ran ok, display the record echo table width='150'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align='left'$row[0]/tdtddiv align='right'$row[1]/div/td/tr; } echo /table; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo pThis could not be display due to a system error. We apologize fore any incovenience./pp. mysql_error() . /p; }
Re: [PHP] Help with an error...
On Jul 24, 2008, at 12:40 PM, Micah Gersten wrote: You cannot have commands in the middle of a string. Technically you can. ?php $str = Hi, my name is . $this-getName(); // or $str = Hi, my name is $this-getName(); echo $str; ? ~Philip Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country / tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Ooop! Didn't read the whole thread before I sent this. Disregard what I said earlier 'cuz others ripped before I did. ;) ~Phil On Jul 25, 2008, at 3:59 PM, Philip Thompson wrote: On Jul 24, 2008, at 12:40 PM, Micah Gersten wrote: You cannot have commands in the middle of a string. Technically you can. ?php $str = Hi, my name is . $this-getName(); // or $str = Hi, my name is $this-getName(); echo $str; ? ~Philip Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country / tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Philip Thompson wrote: On Jul 24, 2008, at 12:40 PM, Micah Gersten wrote: You cannot have commands in the middle of a string. Technically you can. ?php $str = Hi, my name is . $this-getName(); This is correct, but is not in the middle of the string. // or $str = Hi, my name is $this-getName(); echo $str; ? ~Philip This does not work. Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with an error...
Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
On Thu, Jul 24, 2008 at 1:52 PM, [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on You didn't include the line number in the message, but when you receive an error like that, look to the line of code prior. Usually, it's just a missing semicolon, which is the case in your situation here: $result = mysql_query($query) -- /Daniel P. Brown Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
You cannot have commands in the middle of a string. Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
On Thu, Jul 24, 2008 at 1:52 PM, [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] [EMAIL PROTECTED]\r\nReply To:[EMAIL PROTECTED] [EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php first off, you are missing the ending semi-colon from line 11 $result = mysql_query($query); // -- missing semi colon secondly, the whole mail thing is really f**ked up. I suggest that you buils the message body separately and then include it at the end. You just can't start off with a mail call and drop other stuff into the middle of it -- Bastien Cat, the other other white meat
Re: [PHP] Help with an error...
Daniel already answerd regarding your error, but... ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); ... if you call the script via cron I'm pretty sure $_SERVER won't be available since the script is not used in a running webserver process context. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Micah, Please provide an example of what your response was referring to in the original message. And it is possible to have commands in the middle of a string by using concatenation. $str = My name is .strtoupper($name).', but you can call me Sam.; ~Ted On 24-Jul-08, at 10:40 AM, Micah Gersten wrote: You cannot have commands in the middle of a string. Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country / tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
On Jul 24, 2008, at 1052AM, [EMAIL PROTECTED] wrote: $result = mysql_query($query) Missing a ; at the end of the line. $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't execute code inside of a function call the way you're trying to do. Instead do something like: $message = The following are ip's that have try to attack your system. \r\n\r\; Then in your code below, anywhere you have an echo statement, replace it with $message .= code here. For example: $message trtd align= \'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; Then after you're done building your $message for the email, mail([EMAIL PROTECTED],The IP's that Attacked $hostname, $message); I'd suggest taking another read of the manual page for the mail function: http://php.net/manual/en/function.mail.php - the email is sent when you make the call, not created and stored in a variable when executed. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
On 24 Jul 2008, at 18:43, Thorsten Suckow-Homberg wrote: Daniel already answerd regarding your error, but... ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); ... if you call the script via cron I'm pretty sure $_SERVER won't be available since the script is not used in a running webserver process context. Not entirely correct. $_SERVER will be available, but parts of it will not such as the REMOTE_ADDR since there is not remote entity. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
On Thu, Jul 24, 2008 at 1:45 PM, Ted Wood [EMAIL PROTECTED] wrote: $str = My name is .strtoupper($name).', but you can call me Sam.; Though ucfirst() would be preferred. ;-P -- /Daniel P. Brown Better prices on dedicated servers: Intel 2.4GHz/60GB/512MB/2TB $49.99/mo. Intel 3.06GHz/80GB/1GB/2TB $59.99/mo. Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Thanks guys. I will take everything that as been stated to heart. Thanks for the insight. I haven't don't much with mail. Payne On Jul 24, 2008, at 1052AM, [EMAIL PROTECTED] wrote: $result = mysql_query($query) Missing a ; at the end of the line. $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't execute code inside of a function call the way you're trying to do. Instead do something like: $message = The following are ip's that have try to attack your system. \r\n\r\; Then in your code below, anywhere you have an echo statement, replace it with $message .= code here. For example: $message trtd align= \'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; Then after you're done building your $message for the email, mail([EMAIL PROTECTED],The IP's that Attacked $hostname, $message); I'd suggest taking another read of the manual page for the mail function: http://php.net/manual/en/function.mail.php - the email is sent when you make the call, not created and stored in a variable when executed. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
He had code blocks in the middle of a string. That's what I was referring to. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Ted Wood wrote: Micah, Please provide an example of what your response was referring to in the original message. And it is possible to have commands in the middle of a string by using concatenation. $str = My name is .strtoupper($name).', but you can call me Sam.; ~Ted On 24-Jul-08, at 10:40 AM, Micah Gersten wrote: You cannot have commands in the middle of a string. Try building a string first, or use output buffering and then capture the buffer and use that as the string for the mail function. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Well all the insight were great, I am not getting and errors but I am not getting mail. I am looking but php -e isn't telling me anything, and php -l says there no syntax. What else can I do for debugged. Payne Thanks guys. I will take everything that as been stated to heart. Thanks for the insight. I haven't don't much with mail. Payne On Jul 24, 2008, at 1052AM, [EMAIL PROTECTED] wrote: $result = mysql_query($query) Missing a ; at the end of the line. $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't execute code inside of a function call the way you're trying to do. Instead do something like: $message = The following are ip's that have try to attack your system. \r\n\r\; Then in your code below, anywhere you have an echo statement, replace it with $message .= code here. For example: $message trtd align= \'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; Then after you're done building your $message for the email, mail([EMAIL PROTECTED],The IP's that Attacked $hostname, $message); I'd suggest taking another read of the manual page for the mail function: http://php.net/manual/en/function.mail.php - the email is sent when you make the call, not created and stored in a variable when executed. Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Have you set your SMTP server/port in your php.ini file? Have you checked your mail logs to make sure it is routing through? Have you verified it is sending from and to a valid email address?
Re: [PHP] Help with an error...
Have you set your SMTP server/port in your php.ini file? Checking Have you checked your mail logs to make sure it is routing through? Tailing the log as I run it. Have you verified it is sending from and to a valid email address? Yes, those are valid. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
[EMAIL PROTECTED] wrote: Well all the insight were great, I am not getting and errors but I am not getting mail. I am looking but php -e isn't telling me anything, and php -l says there no syntax. What else can I do for debugged. Payne !-- SNip -- 1. BOTTOM POST 2. mailq - this should display if you have any mail queued up to send on the server and possibly if it errored out 3. check your php error log. If you don't have one, modify your php.ini to create one, restart webserver if running via that, CLI should read it on the fly. Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
So, to summarize everything said, with my own added notes. [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php The following wont work if you use this from the CLI. There is not remote addr. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); Loose the semi-colon at the end of your SELECT statements. The mysql extension for PHP will add it on its own. $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; You missed a semi-colon at the end of this line $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't do this within a function call. Like someone else said, you need to run the if/else and while portion before you mail call. Capture that data and then add it to the mail call. if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? So here is the code re factored. ?php # Setup your variables for later use. $recipient = '[EMAIL PROTECTED]'; $subject = 'The IP\'s that Attacked'; $add_headers[] = 'From: [EMAIL PROTECTED]'; $add_headers[] = 'Reply To: [EMAIL PROTECTED]'; $separator = \r\n; //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = SELECT ip, date, time, CONCAT(city, ', ',country) as location FROM ips WHEREcountry != '' ANDdate = current_date() ORDER BY date, time, country asc ; $result = mysql_query($query); ob_start(); echo TXT The following are ip's that have try to attack your system. TXT; //if that ran ok, display the record if ($result) { echo TABLE table width='150'trtdCountry/tdtd# of Attacks/td/tr TABLE; //fetch and print the records while ( $row = mysql_fetch_assoc($result) ) { echo ROW tr td align='left'{$row['ip']}/td tddiv align='right'[$row['date']}/div/td /tr ROW; } echo '/table'; //free up the resources mysql_free_result ($result); } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize for any incovenience./pp'. mysql_error() . '/p'; } $body = ob_get_clean(); $mailsend = mail($recipient, $subject, $body, join($separator, $add_headers)); print($mailsend); ? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with an error...
Jim Lucas wrote: So, to summarize everything said, with my own added notes. [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php The following wont work if you use this from the CLI. There is not remote addr. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); Loose the semi-colon at the end of your SELECT statements. The mysql extension for PHP will add it on its own. $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; You missed a semi-colon at the end of this line $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't do this within a function call. Like someone else said, you need to run the if/else and while portion before you mail call. Capture that data and then add it to the mail call. if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? So here is the code re factored. ?php # Setup your variables for later use. $recipient = '[EMAIL PROTECTED]'; $subject = 'The IP\'s that Attacked'; $add_headers[] = 'From: [EMAIL PROTECTED]'; $add_headers[] = 'Reply To: [EMAIL PROTECTED]'; $separator = \r\n; //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = SELECT ip, date, time, CONCAT(city, ', ',country) as location FROM ips WHEREcountry != '' ANDdate = current_date() ORDER BY date, time, country asc ; $result = mysql_query($query); ob_start(); echo TXT The following are ip's that have try to attack your system. TXT; //if that ran ok, display the record if ($result) { echo TABLE table width='150'trtdCountry/tdtd# of Attacks/td/tr TABLE; //fetch and print the records while ( $row = mysql_fetch_assoc($result) ) { echo ROW tr td align='left'{$row['ip']}/td tddiv align='right'[$row['date']}/div/td /tr ROW; } echo '/table'; //free up the resources mysql_free_result ($result); } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize for any incovenience./pp'. mysql_error() . '/p'; } $body = ob_get_clean(); $mailsend = mail($recipient, $subject, $body, join($separator, $add_headers)); print($mailsend); ? Jim, thanks, well I am still trying to work it out. Your scripts gives me this when I run it -- [EMAIL PROTECTED] to me show details 9:02 PM Reply Reply To: [EMAIL PROTECTED] The following are ip's that have try to attack your system. table width='150'trtdCountry/tdtd# of Attacks/td/tr/table And mine is doing this nowe-mails the html code and nothing from the db html head titleAttack's on $hostname/title /head body if ($result) { //if that ran ok, display the record echo table width='150'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align='left'$row[0]/tdtddiv align='right'$row[1]/div/td/tr; } echo /table; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo pThis could not be display due to a system error. We apologize fore any incovenience./pp. mysql_error() . /p; }
Re: [PHP] Help with an error...
It seems like you're still calling functions inside the string. Instead of concatenating, try the output buffering like was mentioned before. Also, if you want HTML tags in your PHP code, you need to end and start the PHP tags again, or print them as output in quotes. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Payne wrote: Jim Lucas wrote: So, to summarize everything said, with my own added notes. [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php The following wont work if you use this from the CLI. There is not remote addr. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); Loose the semi-colon at the end of your SELECT statements. The mysql extension for PHP will add it on its own. $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; You missed a semi-colon at the end of this line $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't do this within a function call. Like someone else said, you need to run the if/else and while portion before you mail call. Capture that data and then add it to the mail call. if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? So here is the code re factored. ?php # Setup your variables for later use. $recipient = '[EMAIL PROTECTED]'; $subject = 'The IP\'s that Attacked'; $add_headers[] = 'From: [EMAIL PROTECTED]'; $add_headers[] = 'Reply To: [EMAIL PROTECTED]'; $separator = \r\n; //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = SELECT ip, date, time, CONCAT(city, ', ',country) as location FROM ips WHEREcountry != '' ANDdate = current_date() ORDER BY date, time, country asc ; $result = mysql_query($query); ob_start(); echo TXT The following are ip's that have try to attack your system. TXT; //if that ran ok, display the record if ($result) { echo TABLE table width='150'trtdCountry/tdtd# of Attacks/td/tr TABLE; //fetch and print the records while ( $row = mysql_fetch_assoc($result) ) { echo ROW tr td align='left'{$row['ip']}/td tddiv align='right'[$row['date']}/div/td /tr ROW; } echo '/table'; //free up the resources mysql_free_result ($result); } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize for any incovenience./pp'. mysql_error() . '/p'; } $body = ob_get_clean(); $mailsend = mail($recipient, $subject, $body, join($separator, $add_headers)); print($mailsend); ? Jim, thanks, well I am still trying to work it out. Your scripts gives me this when I run it -- [EMAIL PROTECTED] to me show details 9:02 PM Reply Reply To: [EMAIL PROTECTED] The following are ip's that have try to attack your system. table width='150'trtdCountry/tdtd# of Attacks/td/tr/table And mine is doing this nowe-mails the html code and nothing from the db html head titleAttack's on $hostname/title /head body if ($result) { //if that ran ok, display the record echo table width='150'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd
Re: [PHP] Help with an error...
Payne wrote: Jim Lucas wrote: So, to summarize everything said, with my own added notes. [EMAIL PROTECTED] wrote: Hi, I am currently working on a php script that will be called by cron. But I have an error that keeps coming up. Parse error: syntax error, unexpected T_VARIABLE inmail_report.php on What I am trying to do is a simple php script to send me a report everynight. Any clues as to why? Also does anyone know of a site with mail srcipts that are ran on the cli? - ?php The following wont work if you use this from the CLI. There is not remote addr. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); Loose the semi-colon at the end of your SELECT statements. The mysql extension for PHP will add it on its own. $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc;; You missed a semi-colon at the end of this line $result = mysql_query($query) $mailsend = mail([EMAIL PROTECTED],The IP's that Attacked $hostname, The following are ip's that have try to attack your system.\r\n\r\ You can't do this within a function call. Like someone else said, you need to run the if/else and while portion before you mail call. Capture that data and then add it to the mail call. if ($result) { //if that ran ok, display the record echo table width=\'150\'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align=\'left\'$row[0]/tdtddiv align=\'right\'$row[1]/div/td/tr; } echo '/table'; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize fore any incovenience./pp'. mysql_error() . '/p'; } ,From:[EMAIL PROTECTED] To:[EMAIL PROTECTED]); print($mailsend); ? So here is the code re factored. ?php # Setup your variables for later use. $recipient = '[EMAIL PROTECTED]'; $subject = 'The IP\'s that Attacked'; $add_headers[] = 'From: [EMAIL PROTECTED]'; $add_headers[] = 'Reply To: [EMAIL PROTECTED]'; $separator = \r\n; //This is a simple email to give me the status from yesterday. //This connect the script to the db require_once('mysql_connect.inc'); $query = SELECT ip, date, time, CONCAT(city, ', ',country) as location FROM ips WHEREcountry != '' ANDdate = current_date() ORDER BY date, time, country asc ; $result = mysql_query($query); ob_start(); echo TXT The following are ip's that have try to attack your system. TXT; //if that ran ok, display the record if ($result) { echo TABLE table width='150'trtdCountry/tdtd# of Attacks/td/tr TABLE; //fetch and print the records while ( $row = mysql_fetch_assoc($result) ) { echo ROW tr td align='left'{$row['ip']}/td tddiv align='right'[$row['date']}/div/td /tr ROW; } echo '/table'; //free up the resources mysql_free_result ($result); } else { //if did not run ok echo 'pThis could not be display due to a system error. We apologize for any incovenience./pp'. mysql_error() . '/p'; } $body = ob_get_clean(); $mailsend = mail($recipient, $subject, $body, join($separator, $add_headers)); print($mailsend); ? Jim, thanks, well I am still trying to work it out. Your scripts gives me this when I run it -- [EMAIL PROTECTED] to me show details 9:02 PM Reply Reply To: [EMAIL PROTECTED] The following are ip's that have try to attack your system. table width='150'trtdCountry/tdtd# of Attacks/td/tr/table And mine is doing this nowe-mails the html code and nothing from the db html head titleAttack's on $hostname/title /head body if ($result) { //if that ran ok, display the record echo table width='150'trtd Country /tdtd # of Attacks /td/tr; //fetch and print the records while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo trtd align='left'$row[0]/tdtddiv align='right'$row[1]/div/td/tr; } echo /table; mysql_free_result ($result); //free up the resources } else { //if did not run ok echo pThis could not be display due to a system error. We apologize fore any incovenience./pp. mysql_error() . /p; }
Re: [PHP] Help with an error...
!-- SNIP -- Here is the updated code Notice!! $message doesn't contain any PHP code within it $query only has a single ; within the whole line, right at the end of the ; to complete the PHP assignment string. Placing one inside it will barf the script typically. $headers are all concactenated together, you were overwriting them all with your last statement. ?php //VAR Are set here $hostname = `hostname -f`; //This is a simple email to give me the status from yester day. //This connect the script to the db //To use ',' between e-mail address for multiple recipents $to = '[EMAIL PROTECTED]'; //Set the Subject here... $subject = The IPs that Attacked .$hostname. report from Fyre; //Database Set is here... require_once('mysql_connect.inc'); $query = Select ip, date, time, CONCAT(city, ', ',country) as location from ips where country !=' ' and date = current_date() order by date,time,country asc; $result = mysql_query($query) ; if ($result) //if that ran ok, display the record { $data = table width='150'trth Country /thth # of Attacks /th/tr; //fetch and print the records while ($row = mysql_fetch_array($result,MYSQL_NUM)) { $data.= trtd align=left$row[0]/tdtddiv align=right$row[1]/div/td/tr; } $data.= /table; mysql_free_result ($result); //free up the resources } else //if did not run ok { $data=pThis could not be display due to a system error. We apologize fore any incovenience./pp.mysql_error()./p; } mysql_close(); //Close the database connection. //The Message goes here $message = html head titleAttack's on $hostname/title /head body; $message .=$data; $message .=/body /html; //To Send HTML Mail; The Content-type header must be set $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= 'From: FYRE REPORT [EMAIL PROTECTED]'; // Mail it mail($to, $subject, $message, $headers); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with this error message please
Mark wrote: Can anyone tell me why i am getting this message when trying to login to the admin section, i am running the script off my local machine. Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\VertrigoServ\_htdocs\mytipperV4.1\settings.php:2) in C:\VertrigoServ\_htdocs\mytipperV4.1\checkadmin.php on line 44 your code is outputting something before a redirect, check for echo statements or blank spaces Post your code and we can have a look at it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with this error message please
Can anyone tell me why i am getting this message when trying to login to the admin section, i am running the script off my local machine. Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\VertrigoServ\_htdocs\mytipperV4.1\settings.php:2) in C:\VertrigoServ\_htdocs\mytipperV4.1\checkadmin.php on line 44 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with this error message please
Can anyone tell me why i am getting this message when trying to login to the admin section, i am running the script off my local machine. Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\VertrigoServ\_htdocs\mytipperV4.1\settings.php:2) in C:\VertrigoServ\_htdocs\mytipperV4.1\checkadmin.php on line 44 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with this error message please
On 3/5/06, Mark [EMAIL PROTECTED] wrote: Can anyone tell me why i am getting this message when trying to login to the admin section, i am running the script off my local machine. Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at C:\VertrigoServ\_htdocs\mytipperV4.1\settings.php:2) in C:\VertrigoServ\_htdocs\mytipperV4.1\checkadmin.php on line 44 It tells you the problem: output started at C:\VertrigoServ\_htdocs\mytipperV4.1\settings.php:2 Maybe there's a space or blank line before a php open tag? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with parse error
I have a parse error on line 12 -- --- ?php include ('config.php'); $link = @mysql_pconnect($location, $username, $password) or die(Could not connect to the databaseserver. Please go back and try again or try again later.); @mysql_select_db($database,$link) or die (Could not select database. Please go back and try again or try again later.); $sql = SELECT Title, SubT, Author, Story FROM SiteNews; $news = mysql_query($sql,$link) or die(mysql_error()); if ($news){ if (mysql_num_rows($news)== 0){ echo(No newsitems found.); } else{ while ($row = mysql_fetch_assoc($news)){ echo(b); echo(font size=6); echo($row['Title']. br /); echo(/font); echo(font size=4); echo($row['SubT'].br /); echo(/font); echo(/b); echo($row['Author']. br /); echo($row['Story']); echo(hr noshade color=black size=1/); } } } else{ echo(Queryproblem); } ? -- Can anyone see what the error is?? I can't Thanks
RE: [PHP] help with parse error
Hi, Maybe.. $sql = SELECT Title, SubT, Author, Story FROM SiteNews; should be $sql = SELECT Title, SubT, Author, Story FROM SiteNews; -Original Message- From: Stevie D Peele [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 5:41 PM To: [EMAIL PROTECTED] Subject: [PHP] help with parse error I have a parse error on line 12 -- --- ?php include ('config.php'); $link = @mysql_pconnect($location, $username, $password) or die(Could not connect to the databaseserver. Please go back and try again or try again later.); @mysql_select_db($database,$link) or die (Could not select database. Please go back and try again or try again later.); $sql = SELECT Title, SubT, Author, Story FROM SiteNews; $news = mysql_query($sql,$link) or die(mysql_error()); if ($news){ if (mysql_num_rows($news)== 0){ echo(No newsitems found.); } else{ while ($row = mysql_fetch_assoc($news)){ echo(b); echo(font size=6); echo($row['Title']. br /); echo(/font); echo(font size=4); echo($row['SubT'].br /); echo(/font); echo(/b); echo($row['Author']. br /); echo($row['Story']); echo(hr noshade color=black size=1/); } } } else{ echo(Queryproblem); } ? -- Can anyone see what the error is?? I can't Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with parse error
Hi, I'm trying to figure out this error I'm getting in my code: Parse error: parse error in /home/.paco/campuscb/AdPayment.php on line 9 This is the code on line 9: $sDate = date('Y-m-d',time()); Does this look valid? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with parse error
Can you give us a couple lines either side of this? This could be due to a missing semicolon on the previous line. -- Peter James Editor-in-Chief, php|architect Magazine [EMAIL PROTECTED] php|architect The Magazine for PHP Professionals http://www.phparch.com - Original Message - From: James Johnson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 1:07 AM Subject: [PHP] Help with parse error Hi, I'm trying to figure out this error I'm getting in my code: Parse error: parse error in /home/.paco/campuscb/AdPayment.php on line 9 This is the code on line 9: $sDate = date('Y-m-d',time()); Does this look valid? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with parse error
Yup, that was it. Missing a semi-colon on line 8. Thanks, James -Original Message- From: Peter James [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 1:17 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Help with parse error Can you give us a couple lines either side of this? This could be due to a missing semicolon on the previous line. -- Peter James Editor-in-Chief, php|architect Magazine [EMAIL PROTECTED] php|architect The Magazine for PHP Professionals http://www.phparch.com - Original Message - From: James Johnson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 20, 2003 1:07 AM Subject: [PHP] Help with parse error Hi, I'm trying to figure out this error I'm getting in my code: Parse error: parse error in /home/.paco/campuscb/AdPayment.php on line 9 This is the code on line 9: $sDate = date('Y-m-d',time()); Does this look valid? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with an error I can't solve!
Hello all, I have been installing an easy webmail client (webmiau) which seems to work fine and is very light; but I keep receiving this error everytime I open a new session: Warning: Variable passed to reset() is not an array or object in /usr/..file.php on line 5 -- Line 5 of File.php: reset ($HTTP_POST_VARS); Can anybody help me solve this error? What's happening? Track vars are enabled...what else is missing? Thanks before hand... -- Lic. Carlos A. Triana Torres Webmaster. CIGET Sancti SpĂritus Email: [EMAIL PROTECTED] Tel: 23956, 27958 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with an error I can't find!
Can some one help fix this error? Warning: Variable passed to each() is not an array or object in /usr/local/.test.php on line 14 Here is the line: while(list ($key, $mid) = each ($HTTP_POST_VARS)) { -- Lic. Carlos A. Triana Torres. Webmaster. Centro de Informacion y Gestion Tecnologica Sancti Spiritus Email: [EMAIL PROTECTED] Tel: (53-41) 2 3956 http://www.magon.cu HamRadio: CO6TB Locator: FL01GW ICQ#: 137085816 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help with an error I can't find!
-Original Message- From: Lic. Carlos A. Triana Torres [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 4:25 PM To: [EMAIL PROTECTED] Subject: [PHP] Help with an error I can't find! Can some one help fix this error? Warning: Variable passed to each() is not an array or object in /usr/local/.test.php on line 14 Here is the line: while(list ($key, $mid) = each ($HTTP_POST_VARS)) { Is that line inside a function? If so, have a look through http://php.net/manual/en/language.variables.scope.php for information on how to access global-scope variables from inside a function. --- Mark Roedel | Blessed is he who has learned to laugh Systems Programmer | at himself, for he shall never cease LeTourneau University | to be entertained. Longview, Texas, USA| -- John Powell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Help with weird error..
Hey guys, anyone know what Fatal error: input in flex scanner failed in /home/k/kyle/public_html on line means? thanks
RE: [PHP] HELP with (Fatal Error: Call to a member function on a non-object)
This error suggests the $tpl is undefined i.e. you forget to create it using new. -Stewart -Original Message- From: g0thic [mailto:[EMAIL PROTECTED]] Sent: 12 April 2001 01:17 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [PHP] HELP with (Fatal Error: Call to a member function on a non-object) Hi guys, Below is the error message that I am receiving, and 3 or 4 lines around the code that seems to be causing the issue. Lines are numbered so it gives you a good idea of line 183. What I need to know, is in my context, what is the error saying, and if there is a variable (or function or class) to define, how can I tell which one it is? Fatal error: Call to a member function on a non-object in /home/httpd/www/g0thic/cawood_a4/edit_f.php on line 183 178- if($seditFileErr == "") 179- { 180-// Load primary key and form parameters 181-$fldf_id = get_param("f_id"); 182-$fldu_id = get_param("u_id"); 183-$tpl-set_var("Trn_u_id", get_param("u_id")); 184-$pf_id = get_param("f_id"); 185-$tpl-set_var("editFileError", ""); 186- } Get_param is a function to get the variable "u_id" that would have been sent back with the page url (e.g.: page.php?u_id=3993) Any ideas? Cheers, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HELP with (Fatal Error: Call to a member function on a non-object)
Thanks! That solved that one.. Now just a few more.. But with a different subject. On 4/12/01 12:34 AM, "Taylor, Stewart" [EMAIL PROTECTED] wrote: This error suggests the $tpl is undefined i.e. you forget to create it using new. -Stewart -Original Message- From: g0thic [mailto:[EMAIL PROTECTED]] Sent: 12 April 2001 01:17 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [PHP] HELP with (Fatal Error: Call to a member function on a non-object) Hi guys, Below is the error message that I am receiving, and 3 or 4 lines around the code that seems to be causing the issue. Lines are numbered so it gives you a good idea of line 183. What I need to know, is in my context, what is the error saying, and if there is a variable (or function or class) to define, how can I tell which one it is? Fatal error: Call to a member function on a non-object in /home/httpd/www/g0thic/cawood_a4/edit_f.php on line 183 178- if($seditFileErr == "") 179- { 180-// Load primary key and form parameters 181-$fldf_id = get_param("f_id"); 182-$fldu_id = get_param("u_id"); 183-$tpl-set_var("Trn_u_id", get_param("u_id")); 184-$pf_id = get_param("f_id"); 185-$tpl-set_var("editFileError", ""); 186- } Get_param is a function to get the variable "u_id" that would have been sent back with the page url (e.g.: page.php?u_id=3993) Any ideas? Cheers, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HELP with (Fatal Error: Call to a member function on a non-object)
Hi guys, Below is the error message that I am receiving, and 3 or 4 lines around the code that seems to be causing the issue. Lines are numbered so it gives you a good idea of line 183. What I need to know, is in my context, what is the error saying, and if there is a variable (or function or class) to define, how can I tell which one it is? Fatal error: Call to a member function on a non-object in /home/httpd/www/g0thic/cawood_a4/edit_f.php on line 183 178- if($seditFileErr == "") 179- { 180-// Load primary key and form parameters 181-$fldf_id = get_param("f_id"); 182-$fldu_id = get_param("u_id"); 183-$tpl-set_var("Trn_u_id", get_param("u_id")); 184-$pf_id = get_param("f_id"); 185-$tpl-set_var("editFileError", ""); 186- } Get_param is a function to get the variable "u_id" that would have been sent back with the page url (e.g.: page.php?u_id=3993) Any ideas? Cheers, Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HELP with (Fatal Error: Call to a member function on a non-object)
Hi g0thic, @ 8:17:24 PM on 4/11/2001, g0thic wrote: ... Fatal error: Call to a member function on a non-object in /home/httpd/www/g0thic/cawood_a4/edit_f.php on line 183 178- if($seditFileErr == "") 179- { 180-// Load primary key and form parameters 181-$fldf_id = get_param("f_id"); 182-$fldu_id = get_param("u_id"); 183-$tpl-set_var("Trn_u_id", get_param("u_id")); Is $tpl actually an defined as an object some place in the file? If this snippet is inside of a function, $tpl might need to be made global. 184-$pf_id = get_param("f_id"); 185-$tpl-set_var("editFileError", ""); 186- } Get_param is a function to get the variable "u_id" that would have been sent back with the page url (e.g.: page.php?u_id=3993) -Brian -- PGP is spoken here: 0xE4D0C7C8 Please do not carbon copy me on list replies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]