vaultdweller123 32 Posting Pro

thanks for all who replied. ill keep in mind all what you guys just said. thank you

vaultdweller123 32 Posting Pro

thanks for the reply sir. that surely clears my mind. thanks for the enlightenment

vaultdweller123 32 Posting Pro

hello people daniweb....just want to ask honest oppinions from you guys, because this has been bugging me for years. I've been a PHP developer for 5 year using windows. So far so good. i am able to accomplish the task at hand. but there's always back of my head saying, that i suck because i had zero knowledge on Unix or Linux. Is that ok? or do i really need to learn the unix/linux system to be able to call myself good programmer?

vaultdweller123 32 Posting Pro

aw thanks for the reply im gonna reserve your solution. because my htaccess code works but i edited the last part

RewriteRule (.*)$ /$1/ [R=301,L]

to

RewriteRule (.*)$ /$1/ [NC,P]
vaultdweller123 32 Posting Pro

i had an htaccess for that, but the problem is... it doesn't read $_POST variables

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Anyone know an htaccess that can remove the .php, add a trailing slash at the end and can read $_POST data. pls help

vaultdweller123 32 Posting Pro

hello im a little new to htaccess specially mod_rewrite, i know mod_rewrite allows us to rewrite request. Can anyone write me the exact code how to rewrite my path to files?. Before my files(jc,css,images..etc.) reside in example /images/image.png, but now it has a parent directory folder named "public" so my path now is /public/images/image.png. how can i rewrite it? i hope some will help me so i don't have to do the hard way and add all paths to /public.

vaultdweller123 32 Posting Pro

what is the value of $url? what is something?

$url = something; 

of course your $url only prints one values, because it is overwritten everytime it loops, it's called destructive readin, use array to store each values or concatenate it

vaultdweller123 32 Posting Pro

where did you learn OOP? that is just so wrong, that is a bad class structure. Your class has no constructor, you know what i recommend you must first learn the standards on how to create a class, specially from getters and setters etc. you can google tutorials on the net but you can try these
http://www.killerphp.com/tutorials/object-oriented-php/

vaultdweller123 32 Posting Pro

Hi all, i had a problem, i don't know what caused this but everytime i logged here in daniweb and browsed the forum, sometime i get logged out all of a sudden, don't know why, and my pages are not updated, i had to refresh the page(ctr+f5 or f5) evertime i view a page so the content will be updated. this is really weird, though it's ok on my PC at home but here at work i had this problem, i tried clearing all my cache too but it didn't resolve my problem, please help :(

vaultdweller123 32 Posting Pro

now that makes sense why your getting an error, why do you have to make the checkbox as an array? if you only had one checkbox? changed your checkbox
from

 <input name="check[]" type="checkbox" id="tos" value="Agreed." />

to

<input name="check" type="checkbox" id="tos" value="Agreed." />

then into your php code
from

foreach($_POST['check'] as $value) {
    $check_boxes .= $value." ";
}

to

$check_boxes = $_POST['check'];
vaultdweller123 32 Posting Pro

@mitch oh i thought you want the period to go in another array? incase you want word by word i can simplify my code and remove the str_replace

 <?php
    $str = 'I like to eat Strawberry Cheesecake.';
    $words = explode(" ", $str);
    var_dump($words);
    ?>

the reason i put the str_replace is because you said you want the period into the array @_@

vaultdweller123 32 Posting Pro

there's is nothing wrong with your code now if you followed their suggestions, try printing out the checkbox first to see if it has values or not, use print_r(), like

print_r($_POST['check']);

and make sure it's POST not GET and try posting here your html form here, so we can see if you mad some mistakes there

vaultdweller123 32 Posting Pro

try this mitch

$str = 'I like to eat Strawberry Cheesecake.';
$str2 = str_replace("."," .",$str);
$words = explode(" ", $str2);
LastMitch commented: Thanks for the example! +0
vaultdweller123 32 Posting Pro

no not your gmail account, what im trying to say is you need a working SMTP for you to be able to send mail, if im correct you already had a working mail system? http://www.daniweb.com/web-development/php/threads/438404/image-will-not-display-and-html-tags-display
as you already received it in your email

vaultdweller123 32 Posting Pro

the reason you recieved html tags is because you did not include an html header, and the reason the image is not displayed it's because your did not specify an absolute path. this is the simple example of how to send html email

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</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";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

source : http://php.net/manual/en/function.mail.php

vaultdweller123 32 Posting Pro

first you need to install a working email system inorder for you to send mail

vaultdweller123 32 Posting Pro

honestly, i don't know what are you trying to achieve.... im confused why you have two arrays with the same values? well based on your comment, you want to echo the "Blueberry Cheesecake"? then you could just

echo "I am going to eat a ".$cake[1]. "<br />";
LastMitch commented: Thanks for the solution! +5
vaultdweller123 32 Posting Pro

first i wanna ask, can you clarify this line

$cake("Apple Cheesecake", "Blueberry Cheesecake", "Strawberry Cheesecake", "Mango Cheesecake", "Raspberry Cheesecake");

is that an array? it yes
it should be

$cake = array("Apple Cheesecake", "Blueberry Cheesecake", "Strawberry Cheesecake", "Mango Cheesecake", "Raspberry Cheesecake");
vaultdweller123 32 Posting Pro

@lastmitch thanks for the link, i think you are right, based on the article

php > $tz = new DateTimeZone("America/New_York");
php > $dt->setTimezone($tz);
php > print $dt->gt;format("r");
Tue, 20 Dec 2011 15:57:45 -0500

Notice the -0500 offset for the month of December. If you change the the time value to a summer date, such as July 1, you’ll see it is aware of Daylight Savings Time (EDT)

php > $tz = new DateTimeZone("America/New_York");
php > $july = new DateTime("7/1/2011");
php > $july->setTimezone($tz);
php > print $july->>format("r");
Thu, 30 Jun 2011 20:00:00 -0400

it is aware of the DST :D

vaultdweller123 32 Posting Pro

@lastmitch thank you for the reply, and yes im using php's list of supported timezone, by using PHP's date_default_timezone_set, my only concern is the DST. example

date_default_timezone_set('America/Los_Angeles');

so it automaticaly computes for DST? i don't have to manually trap it? to add 1 hour on DST enabled month? and btw thanks for the link, ill read your 3rd link :D

vaultdweller123 32 Posting Pro

hey guys... just wanna ask, is setting timezone on php automatically computes for daylight saving times? i mean does it autmatically detect DST and automaticaly add +1 hour on specific month? thanks in advance

vaultdweller123 32 Posting Pro

"When using localhost, the server is your PC. On the internet it's a PC somewhere in a hosting centre" OMG im so dumb, what am i thinking.... sorry i got so messed up, because i was working with the staging server and localhost simultaneously, thank you so much for the help and enlightenment sir

vaultdweller123 32 Posting Pro

@pritaeas thank you for the reply sir, i thought using php date() will use the server time, not unlike javascript that uses the computer's time. Im not that good when it's comes to "time", i thought it was something about daylight saving time that causes it. i had a trouble understanding that too, this is what i tested

timezone = "America/New_York"
in my localhost = October 23, 2012 05:15:22 AM
on the internet = October 23, 2012 05:36:43 AM
so you mean, it's ok if they're not in sync?

vaultdweller123 32 Posting Pro

hey guys.... anyone here know why my time here in localhost is different from the internet, let's say even though i already set my timezone to "America/New_York" the time is still different

vaultdweller123 32 Posting Pro

hey guys, anyone here know how to format word doc using PHP?, i already got how to create one, but the formatting is my problem, like setting bold letters, btw i tried html markup it works but the problem though is how to set the page width? it's taking up the whole page, this problem doesn't happen when word doc is created by default not in html

vaultdweller123 32 Posting Pro

Hello guys i had a problem logging in here in daniweb, i don't know what happen but i can't seem to log-in in my computer at work, but here in my home i can successfully log-in, even though the accounts entered are correct. please help

vaultdweller123 32 Posting Pro

1st set session upon log-in, ex.

$_SESSION['id'] = $id // id come from database

then when you are redirected to the inner pages then query the username of the logged in user, the query whould be

mysql_query("SELECT username FROM users WHERE id=".$_SESSION['id']);

then in your page

<div id="after_login">Welcome <?php $row['username'];  ?> <a href="logout.php">logout</a></div>
vaultdweller123 32 Posting Pro

try this

<?php

$useryquery = "SELECT * FROM  `members` ORDER BY id DESC ";
$useryquery = mysql_query($useryquery);
$i=0; // added start count
	while($row = mysql_fetch_assoc($useryquery)){
	$id = $row['id'];
	$firstname = $row['firstname'];
	$lastname = $row['lastname'];
	$verified = $row['eamailactivated'];
	$userinfo = $row['Blocked'];
	$usertype = $row['Usertype'];
	if($usertype == '1'){
	$usertype = "<td colspan='2' align='center'>Unavailable.</td>";
	}else{
	$usertype = "<td width='50'><center><a href='index.php?block=$id'>Block</a></center></td><td width='60'><center><a href='index.php?unblock=$id'>Unblock</center></td>";
	}
	if ($userinfo == '0'){
	$userinfo = "<font color='green'>Active</font>";
	}else{
	$userinfo = "<font color='red'>Blocked</font>";
	}
	if($verified == '0'){
	$verified = "<font color='red'>Unverified</font>";
	}else{
	$verified = "<font color='green'>Verified</font>";
	}
	$name = "$firstname $lastname";
	
	if($i%2==0){
		echo "<tr style='background-color:red;'>"; // sample color red, replace it with the color of your choice, you use hex number
	}else{
		echo "<tr style='background-color:blue;'>"; // sample color blue, replace it with the color of your choice, you use hex number
	}
	echo "<td><a href='http://www.daparadise.com/profile.php?id=$id'>$name</a></td>
	<td width='80' align='center'>$userinfo</td>
	<td width='80' align='center'>$verified</td>
	<td width='130'><center><a href='index.php?cp=$id'>Change Password</a></center></td>$usertype</tr>";
	
	$i++; // increment by 1
	
}


?>
karthik_ppts commented: Useful Post +7
vaultdweller123 32 Posting Pro

then make a checkbox for vote, after that add new field for table anketa, named it "votes"data type int default 0, then every submission increment it by one, you can do it my having this query = "UPDATE anketa SET votes=votes+1 WHERE location='your_location'"

vaultdweller123 32 Posting Pro

show us the code

vaultdweller123 32 Posting Pro

session id's are unique

vaultdweller123 32 Posting Pro

wow what a difficult problem, worth asking

vaultdweller123 32 Posting Pro

i don't get it, why would you escape double quotes(") when it's not even conflicting with your string statement, you wrap them with single quotes, not double quotes that would cause conflict that's why you had to escape them

vaultdweller123 32 Posting Pro

what?

vaultdweller123 32 Posting Pro

you mean there's an htaccess already and it's ruining the normal operation? because if there's no htaccess, then the path /htdocs/emp/emp.php will be viewed in http://localhost/emp/emp.php, take note of the folder "emp".

vaultdweller123 32 Posting Pro

try this

$replace1 =str_replace('hreflang="'.$arr['variantslang1hid'].'" lang="'.$arr['variantslang1hid'].'"','hreflang="'.$arr['variantslang1'].'" lang="'.$arr['variantslang1'].'"',$replace1);
vaultdweller123 32 Posting Pro

i'm sure that error means there is wrong with your query, have you tried checking if your query really works? try running your query on phpmyadmin's SQL tab

vaultdweller123 32 Posting Pro

what is the error?

vaultdweller123 32 Posting Pro

1st you need to add additional field on book table, let's say the name of the field is 'status' data type is int, then it has two values, 1 = on loan, 0 = available, when someone borrow a book, then that book will have it's status updated also you should add another field for borrower.

vaultdweller123 32 Posting Pro

where is your form?

vaultdweller123 32 Posting Pro

what do you mean by parsed out? you mean how to get the value? then use @hag++ code, use $_GET

vaultdweller123 32 Posting Pro

you only need one table and put status on books if it's still on loan, example 1=on loan, 0 = available

vaultdweller123 32 Posting Pro

have you tried echoing the $datefrom and $dateto results? they could be empty. Does your query work? try running your query on phpmyadmin SQL to test if it works

vaultdweller123 32 Posting Pro

so you just want to include your iframe on every page? well you don't have to use PHP to do that, a simple javascript can do the work

<html>
<head>
<script type="text/javascript" src="test2.js"></script> 
</head>
<body>
</body>
</html>

test2.js

document.write("<table border='0' cellpadding='0' cellspacing='0' style='border-collapse:collapse' bordercolor='#111111' width='100%' id='AutoNumber1' bgcolor='#FFFFFF'><tr><td width='100%'><iframe width='100%' scrolling='no' height='400' frameborder='0' src='http://www.w3schools.com/' name='I1'></iframe></td></tr><tr><td width='100%'><p align='center'><font face='Arial' style='font-size: 6pt'><a target='_blank' href='http://www.w3schools.com/' style='text-decoration: none'><font color='#FFFFFF'>My Website link</font></a></font></td></tr></table>");

replace the sample url(i use w3schools :D) on the iframe's src and on anchor's href attribute with your own url

vaultdweller123 32 Posting Pro

you include a php file using a javascript include tag? now that's weird man, php include() and require() are used in php to include files. so nevertheless what's the problem? what do you want to achieve?

vaultdweller123 32 Posting Pro

no the error is in front-page.php that inside the IE folder, what is on line 42?

vaultdweller123 32 Posting Pro

of course total not gonna return anything because it's empty, it has no value on the 'total' field on the table. Unless you want to compute the total based on some formulas

vaultdweller123 32 Posting Pro

or you can put condition on every includes

<html>
	<head>
	<?php
	
	include('get_browser.php');
	$browser=getBrowser();

	?>
	
	<?php
	
	switch ($browser['name'])
	{
		case 'Google Chrome':
			echo '<link rel="stylesheet" type="text/css" href="/your_google_chrome_style.css" />';
			echo '<script type="text/javascript" src="/your_google_chrome_javascript.js"></script>';
			break;
		case 'Internet Explorer':
			echo '<link rel="stylesheet" type="text/css" href="/your_ie_style.css" />';
			echo '<script type="text/javascript" src="/your_ie_javascript.js"></script>';
			break;
		case 'Mozilla Firefox':
			echo '<link rel="stylesheet" type="text/css" href="/your_mozilla_style.css" />';
			echo '<script type="text/javascript" src="/your_mozilla_javascript.js"></script>';
		        break;
		default:
	}
	
	?>
	</head>
	<body>
	<?php

	switch ($browser['name'])
	{
		case 'Google Chrome':
			echo '<p>google chrome content</p>';
			break;
		case 'Internet Explorer':
			echo '<p>Internet Explorer content</p>';
			break;
		case 'Mozilla Firefox':
			echo '<p>Mozilla Firefox content</p>';
			break;
		default:
	}
	
	?>
	</body>
	</html>
vaultdweller123 32 Posting Pro

you know what you can use @emclodon code, it is much better

<?php

	include('get_browser.php');
	$browser=getBrowser();
	switch ($browser['name'])
	{
		case 'Google Chrome':
			include('your_google_chrome_page.php'); // your separate google chrome page
			break;
		case 'Internet Explorer':
			include('your_ie_page.php'); // your separate ie page
			break;
		case 'Mozilla Firefox':
			include('your_mozilla_page.php'); //your separate mozilla page
			break;		
		default:	
	}

?>
vaultdweller123 32 Posting Pro

did you change the name of radios to 'tools'?