Tuesday, July 26, 2011

Redirect Page to Index(Login) after Logout

If you had trouble to force your page to login page again after logout. I have the solution for you that I use in Javascript. It work fine in IE. You can try it out too.



<script>
function backButtonOverride()
{
// Work around a Safari bug
// that sometimes produces a blank page
setTimeout("backButtonOverrideBody()", 1);
}
function backButtonOverrideBody()>
{
// Works if we backed up to get here
try {
history.forward();
} catch (e) {
// OK to ignore
}
// Every quarter-second, try again. The only
// guaranteed method for Opera, Firefox,
// and Safari, which don't always call
// onLoad but *do* resume any timers when
// returning to a page
setTimeout("backButtonOverrideBody()", 500);
window.location = "index.php";
}
</script>

Friday, July 22, 2011

Google Buy G.co for URL shortener


Google has just bought the domain shortener G.co to provide a service on site URL address.

This treatment is later provided to cut the links the URL (Universal Resource Locator) of a range of services of Google, in order to be distributed to various social networks and services microblogs.

"We will use G.co to submit websites that are owned by Google. So, every time there is a link g.co, users can make sure that the link when clicked on will only lead to Google services," said Google is collected from the site PCWorld .

The emergence of this G.co services later will not affect shortener services  public url that had been operating Goo.gl. Not yet known what price incurred by Google to purchase this domain. However, generally the domain. Co beginning with the letters sold for more than U $ 1.5 million or around Rp 13 billion.

Some companies also have top domains. Co. Besides Google, Overstock has purchased the domain O.co. While Amazon has bought the domain A.co, Z.co, K.co, and Cloud.co. Twitter even do not want to miss, bought T.co as a service URL.

In fact, domain. Co initially provided as a domain for the Republic of Colombia. But with the permission of that country, commercialized as an alternative of growing domains is full. Now, domain registration. Co reported to have more than 1 million names.

Make Drop Down Menu From PHP Function

We use be writing a Drop Down with HTML...But I have found simple way to make it short...

Here the older one (HTML):-

<select name="P_State" class="textinput" id="P_State" onChange="display_district11(this.value)" tabindex=5> <option value="">--Please Select--</option>
<?php
do {
?>
<option value="<?php echo $row_state['CD_State']?>"<?php if (!(strcmp($row_state['CD_State'], $row_ins['CD_State']))) {echo "selected=\"selected\"";} ?>><?php echo $row_state['Desc_State']?></option>
<?php
} while ($row_state = mysql_fetch_assoc($state));
$rows = mysql_num_rows($state);
if($rows > 0) {
mysql_data_seek($state, 0);
$row_state = mysql_fetch_assoc($state);
}
?>
</select>


Here is the PHP code that I use...You just need to call this function only when you need to use the down drop..short isn't it?

<?php

$PP_State = '';
$js = "display_dis(this.value,'PP_District','panel_addr','8')";
 State_db('PP_State', 'PP_State', '7', $PP_State, $js);?>

The Code below, you need to put to some place that you can call it...
example : - Create a new page, and other page that you need the Drop Down just include this page...easy...

<?php
function State_db($name, $id, $tab, $exist, $java)
{
$sql = 'SELECT CD_State, Desc_State FROM LT_State ORDER BY Desc_State ASC';
$result = mysql_query($sql);
echo '<select name="'.$name.'" id="'.$id.'" class="textinput" tabindex="'.$tab.'" onchange="'.$java.'">';
echo '<option value="">Please Select</option>';
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$cd = $row['CD_State'];
$desc = $row['Desc_State'];
$selected = ($cd==$exist)?'selected':'';
echo '<option value="'.$cd.'" '.$selected.'>'.$desc.'</option>';
}
echo '</select>';

}
?>

LinkWithin

Related Posts Plugin for WordPress, Blogger...