If u r still getting error, post ur error.
Viruthagiri commented: Thanks buddy +1
Viruthagiri commented: one word... vibhadevit is awesome +1
If u r still getting error, post ur error.
lets you have three tables in database.
You can manually check in all tables by placing if-else.
you can combine all above 3 inputs and make select query to generate output.
post your required date format.
e.g. default you have $date = '2010-12-31 10:00:00';
Now in what format you would like to display?
There was minor mistakes.
I have removed it.
Check with below code.
Surely it will work.
database.php
<?php
class database{
function __construct() {
$db_name = 'Lakkam';
$db_host = 'localhost';
$db_user = 'root';
$db_password = '';
$con = mysql_connect ($db_host,$db_user,$db_password)
or die("Could not connect to MySQL server. Please try again.");
mysql_select_db($db_name,$con)
or die("Could not connect to the database. Please try again");
}
function login($uname,$pass)
{ // after creating the database object you have to pass username & password
// username and password sent from form
$myusername=$_POST['username'];
$mypassword=md5($_POST['password']);
// To protect MySQL injection
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT user_id,user_name,user_password FROM tbl_admin WHERE user_name = '$myusername' AND user_password ='$mypassword'";
$query = mysql_query($sql);
if(mysql_num_rows($query) == 1) // checks if a user name with that password exsists
{
$row = mysql_fetch_assoc($query); // Put it to an associative array
return $row['user_id'];
}
else
{
return false;
}
}
}
?>
login.php
<?php session_start();
include_once ('database.php'); // This is the location of your database class in your server
$con= new database(); // create the database object
if(isset($_POST['Submit'])){ // Check if the form is actually submitted
if($_POST['username']!='' && $_POST['password']!='')
{
$output = $con->login($_POST['username'],$_POST['password']);
if($output)
{ //check the username & password
$_SESSION['user_id'] = $output;
$_SESSION['logged_in'] = "ok";
header("Location: menu.php");
exit;
}
else
{
$error = 'Incorrect Login Details ...Try again later!<br>';
}
}
else
{
$error = 'Username Or Password Field is Empty..Please Check again!<br>';
}
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Lakkam Trade …
You can use javascript code that if user select any other option other than 'Any' then make js code will make 'Any' unchecked.
This way you can implement your requirement.
do one thing.
export your db table and post it here.
i will check it local and will post exact code.
Check with below code.
This code will generate $sql based on your requirement.
you can modify as per your want.
if user have selected "Any" then no need to consider it as no filtration required for that in select query.
<?
if(isset($_REQUEST['submit']))
{
$str = ' 1=1 ';
if( count($_POST['bdrm']) > 0 )
{
$bdrm = implode(',',$_POST['bdrm']);
$str.= ' AND beds IN ('.$bdrm.')';
}
if( count($_POST['btrm']) > 0 )
{
$btrm = implode(',',$_POST['btrm']);
$str.= ' AND baths IN ('.$btrm.')';
}
if( count($_POST['pets']) > 0 )
{
$pets = implode(',',$_POST['pets']);
$str.= ' AND pets IN ('.$pets.')';
}
echo $sql = "SELECT * FROM apartments WHERE ".$str;
exit;
}
?>
<form name="form" id="form" method="post" action="">
beds:
<input type="checkbox" checked="checked" name="bdrmAny[]" value="Any">Any
<input type="checkbox" name="bdrm[]" value="1">1
<input type="checkbox" name="bdrm[]" value="2">2
<input type="checkbox" name="bdrm[]" value="3">3
<br>
baths:
<input type="checkbox" checked="checked" name="btrmAny[]" value="Any">Any
<input type="checkbox" name="btrm[]" value="1">1
<input type="checkbox" name="btrm[]" value="2">2
<br>
pets:
<input type="checkbox" checked="checked" name="petsAny[]" value="Any">Any
<input type="checkbox" name="pets[]" value="1">1
<input type="checkbox" name="pets[]" value="2">2
<input name="submit" value="Search" type="submit">
</form>
Try with below code.
database.php
<?php
class database{
function __construct() {
$db_name = 'Lakkam';
$db_host = 'localhost';
$db_user = 'root';
$db_password = '';
$con = mysql_connect ($db_host,$db_user,$db_password)
or die("Could not connect to MySQL server. Please try again.");
mysql_select_db($db_name,$con)
or die("Could not connect to the database. Please try again");
}
function login($uname,$pass)
{ // after creating the database object you have to pass username & password
// username and password sent from form
$myusername=$_POST['username'];
$mypassword=md5($_POST['password']);
// To protect MySQL injection
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql=sprintf("SELECT user_id,user_name,user_password FROM 'tbl_admin' WHERE user_name = '$myusername' AND user_password ='mypassword'");
$query = mysql_query($sql);
if(mysql_num_rows($query) == 1) // checks if a user name with that password exsists
{
$row = mysql_fetch_assoc($query); // Put it to an associative array
return $row['user_id'];
}
else
{
return false;
}
}
}
?>
Login.php
<?php session_start();
include_once ('database.php'); // This is the location of your database class in your server
$con= new database(); // create the database object
if(isset($_POST['Submit'])){ // Check if the form is actually submitted
if($_POST['username']!='' && $_POST['password']!='')
{
$output = $con->login($_POST['username'],$_POST['password']);
if($output)
{ //check the username & password
$_SESSION['user_id'] = $output;
$_SESSION['logged_in'] = "ok";
header("Location: menu.php");
exit;
}
else
{
$error = 'Incorrect Login Details ...Try again later!<br>';
}
}
else
{
$error = 'Username Or Password Field is Empty..Please Check again!<br>';
}
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Lakkam Trade Center</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<div id="Layer1"><img src="images/login.jpg" alt="" …
Here is you code(with example form filled) to insert all URL at a time:
<?php
//File Snatcher 2.7
define('_ALLOWINCLUDE',0);
include 'setting.php';
$version = '2.7';
//////////////////////////////////////////////
//Do Not Change Below Here////////////////////
//////////////////////////////////////////////
if (function_exists('curl_init'))
{
$snatch_system = 'curl';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>File Snatcher <?php echo $version; ?> - © http://noveis.net</title>
</head>
<body>
<div id="main">
<?php
$submit = $_POST['submit'];
if ($submit)
{
if (isset($password))
{
if ($_POST['password'] != $password)
{
die('<p><strong>Password incorrect!</strong></p>');
$error = true;
}
}
if (!$defaultDest)
{
$defaultDest = 'snatched';
}
if (!file_exists($defaultDest))
{
mkdir($defaultDest);
}
$sizelimit = $sizelimit * 1024;
$files = $_POST['file'];
$news = $_POST['new'];
$allfiles = $_POST['allfiles'];
$separateby = $_POST['separateby'];
if($allfiles != "")
{
$files = explode($separateby,$allfiles);
}
for($i=0;$i<count($files);$i++)
{
$file = trim($files[$i]);
$uploadfile = explode('/', $file);
$filename = array_pop($uploadfile);
$newfilename = $news[$i];
if (!$newfilename)
{
$newfilename = $filename;
}
if (!isset($file))
{
echo '<p><strong>Please enter a URL to retrieve file from!</strong></p>';
$error = true;
}
if (!isset($newfilename))
{
echo '<p><strong>Please enter a new file name!</strong></p>';
$error = true;
}
if ($error == false)
{
$dest = $defaultDest;
$ds = array($dest, '/', $newfilename);
$ds = implode('', $ds);
$newname_count = 0;
if (file_exists($ds))
{
echo '<p><strong>File already exists!</strong></p>';
$newname_count++;
$newfile = array($newname_count, $newfilename);
$newfile = implode('~', $newfile);
$newfile_ds = array($dest, '/', $newfile);
$newfile_ds = implode('', $newfile_ds);
while($renamed == false)
{
if (file_exists($newfile_ds))
{
$newname_count++;
$newfile = array($newname_count, $newfilename);
$newfile = implode('~', $newfile);
$newfile_ds = array($dest, '/', $newfile);
$newfile_ds = implode('', $newfile_ds); …
anybody knows how to integrate gmail account information ???
Here is code for index.php.
check it, hope it is what you want.
<?php
//File Snatcher 2.7
define('_ALLOWINCLUDE',0);
include 'setting.php';
$version = '2.7';
//////////////////////////////////////////////
//Do Not Change Below Here////////////////////
//////////////////////////////////////////////
if (function_exists('curl_init'))
{
$snatch_system = 'curl';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>File Snatcher <?php echo $version; ?> - © http://noveis.net</title>
</head>
<body>
<div id="main">
<?php
$submit = $_POST['submit'];
if ($submit)
{
if (isset($password))
{
if ($_POST['password'] != $password)
{
die('<p><strong>Password incorrect!</strong></p>');
$error = true;
}
}
if (!$defaultDest)
{
$defaultDest = 'snatched';
}
if (!file_exists($defaultDest))
{
mkdir($defaultDest);
}
$sizelimit = $sizelimit * 1024;
$files = $_POST['file'];
$news = $_POST['new'];
for($i=0;$i<count($files);$i++)
{
$file = $files[$i];
$uploadfile = explode('/', $file);
$filename = array_pop($uploadfile);
$newfilename = $news[$i];
if (!$newfilename)
{
$newfilename = $filename;
}
if (!isset($file))
{
echo '<p><strong>Please enter a URL to retrieve file from!</strong></p>';
$error = true;
}
if (!isset($newfilename))
{
echo '<p><strong>Please enter a new file name!</strong></p>';
$error = true;
}
if ($error == false)
{
$dest = $defaultDest;
$ds = array($dest, '/', $newfilename);
$ds = implode('', $ds);
$newname_count = 0;
if (file_exists($ds))
{
echo '<p><strong>File already exists!</strong></p>';
$newname_count++;
$newfile = array($newname_count, $newfilename);
$newfile = implode('~', $newfile);
$newfile_ds = array($dest, '/', $newfile);
$newfile_ds = implode('', $newfile_ds);
while($renamed == false)
{
if (file_exists($newfile_ds))
{
$newname_count++;
$newfile = array($newname_count, $newfilename);
$newfile = implode('~', $newfile);
$newfile_ds = array($dest, '/', $newfile);
$newfile_ds = implode('', $newfile_ds);
}
else
{
$renamed = true;
}
}
$newfilename = $newfile;
$ds = $newfile_ds; …
You can also use below reduced code.
<option <?=($question1 == "Gone to Competitor")?'selected="selected"':''?> >Gone to Competitor</option>
and when i use above link for sending mail from gmail account, i got below error.
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (24)
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.
I got below error when i connect with different machine.
Warning: mail() [function.mail]: SMTP server response: 550-(TEST-PC) [xx.xx.xx.xx]:50406 is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client. in C:\wamp\www\email.php on line 9
I think my working pc's ip address is allowed on that mydomain.com.
How can i check on mydomain.com?
Check folder permission and run below code and post output.
I think the file you want to copy is not there in source folder.
<?
$source = "../upload/".$img;
$destination = "../gallery/pic/".$img;
if(file_exists($source))
echo '<br />Source exists:'.$source;
else
echo '<br />Source not exists:'.$source;
if(file_exists($destination))
echo '<br />Destination exists:'.$destination;
else
echo '<br />Destination not exists:'.$destination;
?>
I have integrated it once as below.
register.php is page where user register to the site.
and forum is a sub folder for phpbb placed at root.
<?
/*======================================
my register.php code goes here
========================================*/
//--- phpbb code start ------
echo '<form method="post" style="display:none;" name="frmfrm" id="frmfrm" action="forum/ucp.php?mode=login">
<label for="username">Username: </label> <input type="text" name="username" id="username" value="'.$_POST['username_login'].'" size="40" /><br /><br />
<label for="password">Password: </label><input type="password" name="password" id="password" value="'.$_POST['password_login'].'" size="40" /><br /><br />
<label for="autologin">Remember Me?: </label><input type="checkbox" name="autologin" id="autologin" /><br /><br />
<input type="hidden" value="Log In" name="login" />
<input type="hidden" name="redirect" value="[B]../register.php[/B]" />
</form>
<script language="javascript">document.frmfrm.submit();</script>';
?>
What above code do, it will goes to phpbb and user entry will be done for forum and it will be backed to page as shown in bold.
Try this and let me know your result.
It is better to upload image on server.
Then you can resize image to new thumb image.
And use that thumb image when you want to display on page.
Here is some logic:
1) in register.php give all fielsa like name, address, city, state..etc.
2) When form is submitted store all values in table and get last inserted id $lastid with mysql_insert_id.
3) write header now.
header("Location:success.php?lastid=".$lastid);
exit;
4) now on success.php you have $lastid = $_GET.
you can have one select query where id = $lastid. and you can show all information.
Thanks all for help and time.
This issue is solved.
Even i don't know exact reason but one linux server guy have installed firewall and some software on dedicated server and issue is solved.
Debug with this below code.
post your output and current error you are getting.
<?
$source = "../upload/".$img;
$destination = "../gallery/pic/".$img;
if(file_exists($source))
echo '<br />Source exists'.$source;
if(file_exists($destination))
echo '<br />Destination exists'.$destination;
copy($source , $destination);
?>
lets say list.php is a page where all article title are shown.
<?
$q="select * from article";
$rs = mysql_query($q);
while($sar = mysql_fetch_assoc($rs))
{
?>
<a href="article.php?aid=<? echo $sar['id'];?>"><? echo $sar['title'];?></a>
<?
}
?>
When user click on that title you can redirect user to article.php with some unique id. and on article.php page you can show article.
<?
$aid = $_REQUEST['aid'];
$q="select * from article where id =".$aid;
$rs = mysql_query($q);
$sar = mysql_fetch_assoc($rs);
?>
Title : <? echo $sar['title'];?>
Article : <? echo $sar['article_description'];?>
When your data is inserted to table you should redirect user to new page.
header("Location:success.php");
exit;
Because if you wont then when you press refresh form will be again submitted and again data will be inserted to table.
So its better practice to use header when php code is completed.
What you exactly want?
Does your posted code works? even partially?
And where is html portion?
Echo query below and run in sql window.
Does it returning result??
echo "SELECT * FROM albums WHERE userid='".$_SESSION['id']."'";
I have one website name e.g. www.mydomain.com
Now i want to configure smtp setting in my local pc.
Below is the phpini code i have set.
Here i have not used any username and password.
[mail function]
; For Win32 only.
SMTP = mail.mydomain.com
smtp_port = 25
And it is working.. Strange !!!!
How this can work?
I mean if this is the only required info then anyone can set this detail and can use my domain's smtp.
What is the reason behind working of it?
If i want to use my gmail account info for smtp. Is it works?
what is the steps to follow?
Any help will be appreciated.
This is complete date code.
Try with this.and let me know output.
<html>
<meta content= "text/html; charset= utf-8" http-equiv="Content-Type"/>
<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<link rel="stylesheet" href="jquery.datepick.css" type="text/css" />
<script type="text/javascript" src="jquery.datepick.js"></script>
<script type="text/javascript" src="fbDateTime.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Prevent selection of invalid dates through the select controls
function checkLinkedDays() {
var daysInMonth = $.datepick.daysInMonth(
$('#selectedYear').val(), $('#selectedMonth').val());
$('#selectedDay option:gt(27)').attr('disabled', '');
$('#selectedDay option:gt(' + (daysInMonth - 1) +')').attr('disabled', 'disabled');
if ($('#selectedDay').val() > daysInMonth) {
$('#selectedDay').val(daysInMonth);
}
}
function updateSelected(dates) {
$('#selectedMonth').val(dates.length ? dates[0].getMonth() + 1 : '');
$('#selectedDay').val(dates.length ? dates[0].getDate() : '');
$('#selectedYear').val(dates.length ? dates[0].getFullYear() : '');
checkLinkedDays();
}
$('#selectedPicker').datepick({
yearRange: '1980:2010',
alignment: 'bottomRight', onSelect: updateSelected, altField: '#setDate',
showTrigger: '#calImg'});
// Update datepicker from three select controls
$('#selectedMonth,#selectedDay,#selectedYear').change(function() {
$('#selectedPicker').datepick('setDate', new Date(
$('#selectedYear').val(), $('#selectedMonth').val() - 1,
$('#selectedDay').val()));
});
$('#selectedDay,#selectedMonth,#selectedYear').change(function() {
var date = $.datepick.day(
$.datepick.month(
$.datepick.year(
$.datepick.today(), $('#selectedYear').val()),
$('#selectedMonth').val()),
$('#selectedDay').val());
$('#setDate').val($.datepick.formatDate(date));
});
// change();
$().fbDateTime({
date:'#selectedDay',
month:'#selectedMonth',
year:'#selectedYear',
yearStart:1980
});
});
</script>
</head>
<body>
<?php
$username="root";
$password="";
$database="getdates";
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "SELECT aadate FROM `date` WHERE id = '1'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$temp_mydate = explode("-",$row['aadate']);
$year = $temp_mydate["0"];
$month = round($temp_mydate["1"]);
$day = round($temp_mydate["2"]);
?>
<form id = "list" action="" method="post">
<select id = 'selectedMonth' name = 'selectedMonth' onchange="showSelected();" >
</select>
<select id = 'selectedDay' name = 'selectedDay' >
</select>
<select id = 'selectedYear' name = 'selectedYear' >
</select>
<input size="10" id = "selectedPicker" value="<?php echo $row['aadate']; ?>" type="text" />
<div style="display:none"><img src="makemycalendar.png" width="16" height="15" alt="Popup" id = "calImg"/></div> …
Hi all,
My site is on dedicated server by fasthosts.co.uk.
i get email from host server that my site has been placed on the Spamhaus SBL.
below is the content for that:
>> Web bot: port 80
>> IP address 217.174.241.205: on fasthosts.co.uk/live-servers.net
>> Canadian Pharmacy spammer[s] are using a botnet consisting of
>> compromised systems on which NGINX is installed listening on port 80
>> to proxy their pages unless the system, itself, is making use of that
>> port in which case nginx listend on port 8080. The nameservers
>> resolve hostnames which are spamvertized as port 80 (http://hostname)
>> to IP addresses of systems with nginx listening on port 80 and
>> resolve other hostnames, spamvertized on port 8080,
>> http://hostname:8080, to IP addresses with nginx listening on that port.
>>
>> The nameservers and hosts quickly rotate (double fast-flux) though
>> the nameserver IP addresses listed in the root servers ('glue'
>> records) may not change so quickly.
>>
>> If you know a hostname you can find it at both port 80 and port 8080
>> bots by forcing the resolution.
>>
>> Canadian Pharmacy is running a counterfeit luxury good ('replicas')
>> site along with their pharmacy site at these IP addresses.
>>
>> A currently resolvable (for some reason they seem often to lose
>> domains!) is discountprowatch.com (replicas site, spamvertized on
>> port 80) and a recent (unresolvable) pharmacy hostname is
>> buyviagraworld.com (spamvertized on …
vibhadevit,
I am accessing a stored date in my database so basically what I posted at the top was working but you did manually select a date, so is there any possible to access a date that came from my database and as soon as my page loads, it will display the date from my drop-downs and to a textfield. Thank you.
If you are using jquery you have to write js code to let dropdown selected.
Its nothing wrong to write js code.
I posted is just for month remain selected.You can write it for textbox,day,year same way.
Thanks rch1231.
Sent you Private Message.
Please all.....Get me out of this.
Hi all,
My site is on dedicated server by fasthosts.co.uk.
i get email from host server that my site has been placed on the Spamhaus SBL.
below is the content for that:
>> Web bot: port 80
>> IP address 217.174.241.205: on fasthosts.co.uk/live-servers.net
>> Canadian Pharmacy spammer[s] are using a botnet consisting of
>> compromised systems on which NGINX is installed listening on port 80
>> to proxy their pages unless the system, itself, is making use of that
>> port in which case nginx listend on port 8080. The nameservers
>> resolve hostnames which are spamvertized as port 80 (http://hostname)
>> to IP addresses of systems with nginx listening on port 80 and
>> resolve other hostnames, spamvertized on port 8080,
>> http://hostname:8080, to IP addresses with nginx listening on that port.
>>
>> The nameservers and hosts quickly rotate (double fast-flux) though
>> the nameserver IP addresses listed in the root servers ('glue'
>> records) may not change so quickly.
>>
>> If you know a hostname you can find it at both port 80 and port 8080
>> bots by forcing the resolution.
>>
>> Canadian Pharmacy is running a counterfeit luxury good ('replicas')
>> site along with their pharmacy site at these IP addresses.
>>
>> A currently resolvable (for some reason they seem often to lose
>> domains!) is discountprowatch.com (replicas site, spamvertized on
>> port 80) and a recent (unresolvable) pharmacy hostname is
>> buyviagraworld.com (spamvertized on …
In below code i have just make drop down selected as 'July'.
You can set accordingly.
Let me know for further help.
<html>
<meta content= "text/html; charset= utf-8" http-equiv="Content-Type"/>
<head>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<link rel="stylesheet" href="jquery.datepick.css" type="text/css" />
<script type="text/javascript" src="jquery.datepick.js"></script>
<script type="text/javascript" src="fbDateTime.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Prevent selection of invalid dates through the select controls
function checkLinkedDays() {
var daysInMonth = $.datepick.daysInMonth(
$('#selectedYear').val(), $('#selectedMonth').val());
$('#selectedDay option:gt(27)').attr('disabled', '');
$('#selectedDay option:gt(' + (daysInMonth - 1) +')').attr('disabled', 'disabled');
if ($('#selectedDay').val() > daysInMonth) {
$('#selectedDay').val(daysInMonth);
}
}
function updateSelected(dates) {
$('#selectedMonth').val(dates.length ? dates[0].getMonth() + 1 : '');
$('#selectedDay').val(dates.length ? dates[0].getDate() : '');
$('#selectedYear').val(dates.length ? dates[0].getFullYear() : '');
checkLinkedDays();
}
$('#selectedPicker').datepick({
yearRange: '1980:2010',
alignment: 'bottomRight', onSelect: updateSelected, altField: '#setDate',
showTrigger: '#calImg'});
// Update datepicker from three select controls
$('#selectedMonth,#selectedDay,#selectedYear').change(function() {
$('#selectedPicker').datepick('setDate', new Date(
$('#selectedYear').val(), $('#selectedMonth').val() - 1,
$('#selectedDay').val()));
});
$('#selectedDay,#selectedMonth,#selectedYear').change(function() {
var date = $.datepick.day(
$.datepick.month(
$.datepick.year(
$.datepick.today(), $('#selectedYear').val()),
$('#selectedMonth').val()),
$('#selectedDay').val());
$('#setDate').val($.datepick.formatDate(date));
});
// change();
$().fbDateTime({
date:'#selectedDay',
month:'#selectedMonth',
year:'#selectedYear',
yearStart:1980
});
});
</script>
</head>
<body>
<?php
$row['aadate'] = '2010-07-10';
$temp_mydate = explode("-",$row['aadate']);
$year = $temp_mydate["0"];
$month = round($temp_mydate["1"]);
$day = $temp_mydate["2"];
?>
<form id = "list" action="" method="post">
<select id = 'selectedMonth' name = 'selectedMonth' onchange="showSelected();" >
</select>
<select id = 'selectedDay' name = 'selectedDay' >
<option><?php echo $day ?></option>
</select>
<select id = 'selectedYear' name = 'selectedYear' >
<option><?php echo $year ?></option>
</select>
<input size="10" id = "selectedPicker" value="<?php echo $row['aadate']; ?>" type="text" />
<div style="display:none"><img src="makemycalendar.png" width="16" height="15" alt="Popup" id = "calImg"/></div>
<input type="text" size="10" id = "setDate" …
Below is php code example.
If $value is 'c' then it will remain selected ..
same for 'a','c','d'.
<html>
<body>
<?
$value = 'c';
?>
<select>
<option <?=($value == 'a')?'selected="selected"':''?> >a</option>
<option <?=($value == 'b')?'selected="selected"':''?> >b</option>
<option <?=($value == 'c')?'selected="selected"':''?> >c</option>
<option <?=($value == 'd')?'selected="selected"':''?> >d</option>
</select>
</body>
</html>
it was working at my end.. try this.
<?php
$content = file_get_contents("http://192.168.0.1/domain/test.txt");
$content = ereg_replace("[\n\r]", "##", $content);
$ar = explode('##',$content);
$rand_keys = array_rand($ar, 1);
$random = $ar[$rand_keys];
echo $random;
?>
php code for you:
<?php
$content = file_get_contents("http://192.168.0.1/domain/test.txt");
$content = ereg_replace("[\n\r]", "##", $content);
$ar = explode('####',$content);
$rand_keys = array_rand($ar, 1);
$random = $ar[$rand_keys];
echo $random;
?>
test.txt :
Computer
World
Hello
Monday
File
Mouse
Tree
Take care that all words in test.txt must be in next line.
I think you don't know how to use function.
<?php
function getRandomAlphaNumeric($intpLength = 16)
{
$arrAlphaNumeric = array();
$arrAlpha = range('A','Z');
$arrNumeric = range(0,9);
$arrAlphaNumeric = array_merge($arrAlphaNumeric, $arrAlpha, $arrNumeric);
mt_srand((double)microtime() * 1234567);
shuffle($arrAlphaNumeric);
$strAlphaNumeric = '';
for($x=0; $x<$intpLength; $x++)
$strAlphaNumeric .= $arrAlphaNumeric[mt_rand(0, (sizeof($arrAlphaNumeric)-1))];
return $strAlphaNumeric;
}
$sourcepath = "C:/my/path/"; // this must be local pc path not LIVE URL
$oldfilename = "myfile.txt";
$newfilename = getRandomAlphaNumeric(10);
rename($sourcepath.$oldfilename, $sourcepath.$newfilename );
echo "file ".$oldfilename." is now renamed to ".$newfilename;
?>
<?php
$sourcepath = "C:/my/path/";
$oldfilename = "myfile.txt";
$newfilename = getRandomAlphaNumeric(10);
rename($sourcepath.$oldfilename, $sourcepath.$newfilename );
echo "file ".$oldfilename." is now renamed to ".$newfilename;
?>
Hope this will help.
No changes in function.
you can use this function as:
$filename = getRandomAlphaNumeric(10);
So that you can have one random number in $filename.
what exactly ur scenario is??
Do you have txt files already on server or you want to upload txt file and rename it??
session is stored per user wise.
So u can not store chat in session as the other user chatting with user can not use each other's session.
What is $form in insert query?
Bcz it doesn't defined in above code.
-> You can read your text file and from text file's content you can take first three or four words and use it as file name.
-> or use php random function to create random name.
function getRandomAlphaNumeric($intpLength = 16)
{
$arrAlphaNumeric = array();
$arrAlpha = range('A','Z');
$arrNumeric = range(0,9);
$arrAlphaNumeric = array_merge($arrAlphaNumeric, $arrAlpha, $arrNumeric);
mt_srand((double)microtime() * 1234567);
shuffle($arrAlphaNumeric);
$strAlphaNumeric = '';
for($x=0; $x<$intpLength; $x++)
$strAlphaNumeric .= $arrAlphaNumeric[mt_rand(0, (sizeof($arrAlphaNumeric)-1))];
return $strAlphaNumeric;
}
create one session array.
when user click on link you can pass veh_id to ajax page.
where in ajax page you will add veh_id in session array.
And when user checkout it will use session array.
Advance search depends on your records to be searched.
so first make a list of fields and options which are there in your search result.
I got solution....
If htaccess is applied for language then
www.domain.com/english/test.php?name=abc
should be
www.domain.com/english/test.php&name=abc
without question mark.
This solved my problem.
RewriteRule ^(.*)/test.php\?(.*)$ test.php?language=$1&$2 [NC] RewriteRule ^(.*)/test.php$ test.php?language=$1 [NC]
Nope still this is not working.
Hi all,
Here is my htaccess code for url rewrite:
RewriteRule ^(.*)/test.php$ test.php?language=$1 [NC]
which will redirect
www.domain.com/english/test.php
to
www.domain.com/test.php?language=english
It is working fine...
But when i have extra variable with that url then it doesn't work.
e.g. www.domain.com/english/test.php?name=abc
should work like:
www.domain.com/test.php?language=english&name=abc
But it is not working..
Help !!
mysql_query function must be inside foreach loop.
// Check if button name "Submit" is active, do this
if($_POST['Submit']){
foreach($checkbox as $i){
$sql2 = "INSERT INTO assignments SET firstName = '$firstName[$i]', lastName = '$lastName[$i]', AP = '$AP[$i]', last_teacher = '$last_teacher[$i]', description = '$description', subject = '$subject'";
$result2=mysql_query($sql2) or die(mysql_error());
}