Check here: http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx
And: http://uk.php.net/manual/en/ref.com.php
Search for: new COM("Outlook.Application") php
bye
Check here: http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx
And: http://uk.php.net/manual/en/ref.com.php
Search for: new COM("Outlook.Application") php
bye
Man, change your database password!
listrecord.php does not contain a form, so what you send to update.php is just the id through the link, so in update.php change $id=$_POST['id'];
to $id=$_GET['id'];
and remove the others $_POST, they are not defined.
If you are sending user and password in this form, I think the popup requesting user and password is not javascript, it's the apache web authentication system. Simple_html_dom is going to use file_get_contents to get the document, line 70 is:
$dom->load(call_user_func_array('file_get_contents', $args), true);
I can only think to use urlencode():
<?php
echo file_get_contents('http://user:pass@client_host/server/arms?...');
echo file_get_contents(urlencode('http://user:pass@client_host/server/arms?...'));
?>
I hope someone else can give you a better answer. Bye :)
The warnings you get are related to connection problems. Can you try to get the contents of a non protected page of that website?
In your array response, status is 200 and there is no redirect, otherwise you will see 302 instead of 200 (or 501) and Location with the landing url. What seems strange to me is the cookie path /server
because this means the cookie is valid only for pages inside http://xyz.com/server/. So, in your request link there is also a /server/ path?
More important: is the authentication method based on Apache web Authentication or there is a login form? If the case is a login form first you need to get an authentication cookie, save it with cURL and use it to access to a protected page. Something like:
# send request to the url where action form attribute is pointing and save cookie to cookie.txt file
curl -c cookie.txt "user=your_user&password=01234567" http://xyz.com/login/validate
# use cookie to get protected contents
curl -b cookie.txt http://xyz.com/restricted_area/content.html
Line 10, your input field has two name attributes, remove name="text"
. Bye.
Check the headers you get with that link:
<?php
$url = 'http://user:pwd@xyz.com/content.html?get1=x&get2=y';
print_r(get_headers($url,1));
?>
And then try to use cURL:
$useragent = "Mozilla Firefox ..."; # set valid user agent
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
There can be a filter for nonvalid user agents. Bye :)
Userfile is the name of the input field from which you upload the file. In your form the input field name (line 195 of your attached file) is gambar, so or you change that name or you change all the $_FILES reference from userfile to gambar. Bye :)
It is always the same, just make sure PHP can't be executed in destination directory and that is not directly accessible to web, so no one can upload a script and use it to hack your server. You can do that by placing a .htaccess file in the directory that will store files and writing just this:
order deny,allow
deny from all
php_flag engine off
Usually Windows doesn't allow filename starting with a dot, if you are uploading to a remote directory, just use ftp to rename the file. Bye :)
Note: you should also check the mime of the files and run an antivirus on the server to check the files submitted.
To who voted against my previous reply: explain me what I did wrong, at least I can learn ;D
When you upload a file you need to move it from temporary directory to a directory of the server, so you can store the file, use move_uploaded_file(): http://php.net/manual/en/function.move-uploaded-file.php
And then change this line, it seems wrong:
$mail->AddAttachment('file:///H:/ha.txt','a.txt');
with:
$mail->AddAttachment('h:/server_directory/files/ha.txt','a.txt');
From line 4 to 20 of your previous code:
if (isset($_POST['save'])){
$tgl_masuk = date("y-m-j");
if (empty($_POST['id'])){
$result = mysql_query("INSERT INTO produk(nama_produk, harga, deskripsi, tgl_masuk, gambar) VALUES('".$nama."', '".$harga."', '".$deskripsi."', '".$tgl_masuk."', '".$gambar."')");
echo "Data has been recorded in the database.";
} else {
$result = mysql_query("UPDATE produk SET nama_produk='".$nama_produk."', harga='".$harga."', deskripsi='".$deskripsi."', gambar='".$gambar."' WHERE id=".$_POST['id']);
$result = mysql_query($sqlstr) or die(mysql_error());
$confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";
}
}
Change it with this:
if (isset($_POST['save']) && $_FILES['userfile']['size'] > 0){
$nama = $_POST['nama'];
$harga = $_POST['harga'];
$deskripsi = $_POST['deskripsi'];
$tgl_masuk = date("y-m-j");
# get values from uploaded file
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
# read uploaded file, so you can save it to the database
$fp = fopen($tmpName, 'r');
$gambar = fread($fp, filesize($tmpName));
$gambar = addslashes($content); # image to save
fclose($fp);
# if you just want to save the name of the image, remove previous four lines,
# uncomment below and switch gambar field from blob to varchar
/*
$uploads_dir = "/images"; # this directory needs write permissions
$gambar = $fileName;
move_uploaded_file($tmpName, "$uploads_dir/$fileName");
*/
if (empty($_POST['id'])){
$result = mysql_query("INSERT INTO produk(nama_produk, harga, deskripsi, tgl_masuk, gambar) VALUES('".$nama."', '".$harga."', '".$deskripsi."', '".$tgl_masuk."', '".$gambar."')");
echo "Data has been recorded in the database.";
}
else
{
$result = mysql_query("UPDATE produk SET nama_produk='".$nama_produk."', harga='".$harga."', deskripsi='".$deskripsi."', gambar='".$gambar."' WHERE id=".$_POST['id']);
$result = mysql_query($sqlstr) or die(mysql_error());
$confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";
}
}
And if you still want to save images to database, add a field …
The platforms supported by ffmpeg-php are linux and bsd: http://sourceforge.net/projects/ffmpeg-php/
If you want to use ffmpeg in Windows first you need a porting, check here: http://ffmpeg.org/download.html
And then you can use ffmpeg in command line, with exec() function:
<?php exec("ffmpeg.exe -i video.avi video.mpg"); ?>
bye
Both RSS 2.0 and Atom use GUID and ID to identify unique items/entries inside the feed, use those values associated with each source to check what you have already included.
Bye :)
@daniel you can use it to submit data to a script just as you're submitting a form, automatically. This script sends his request as a Firefox user, so it can bypass a filtering by User-Agent.
But it becomes useless if the receiving script expects also a captcha or a CSRF value.
The usage is simple:
$random=rand(1, 100000);
$cookie=$random . ".txt";
$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
# where to submit data
$url = 'http://website.tld/data.php';
# the page from which is supposed to submit data
# this is fake information, just as User-Agent
$referer = 'http://website.tld/form.php';
# form input fields and values to submit
$vars = array(
'field_name_1' => 'value 1',
'field_name_2' => 'value 2'
);
echo post($url, $referer, $agent, $cookie, $vars);
bye.
Post the code. Bye.
My headache is gone now:)
that's great, bye ;D
Have you tried flush query cache? Bye.
I made few tests. The first one is faster than the second, but still eats a lot of memory (~170MB in ~14 seconds):
<?php
$file = '20111212realtime_gen.csv';
$f = fopen($file, "r");
$ln= 0;
$nyc = array();
$millwood = array();
$hudvl = array();
$dunwood = array();
$arr = array('nyc' => array(23512,23513,23515,23516,23517,23518,23519,23520,23523,23524,23533,23534,23535,23538,23540,23541,23657,23660,23729,23770,23786,23810, 23816,23817,23820,24077,24078,24079,24080,24084,24094,24095,24096,24097,24098,24099,24100,24101,24102,24103,24104,24105,24106,24107, 24108,24110,24111,24112,24113,24114,24115,24116,24117,24118,24119,24120,24121,24122,24123,24124,24125,24126,24127,24128,24129,24130, 24131,24132,24133,24134,24135,24136,24137,24138,24149,24152,24155,24156,24157,24158,24159,24160,24161,24162,24163,24168,24195,24196, 24202,24225,24226,24227,24228,24229,24230,24231,24232,24233,24234,24235,24236,24237,24238,24239,24240,24241,24242,24243,24244,24245, 24246,24247,24248,24249,24250,24251,24252,24253,24254,24255,24256,24257,24258,24259,24260,24261,323558,323559,323566,323567,323568,323569,323581,323582,323595,323610,323651,323677,323678,923512,923533,923568,924077,924094,924106,924149,924156,924157,924158,924160,924162,924228),
'millwood' => array(23530,23531,23653,23659,23776,24019,24139,24193,24198,323649),
'hudv1' => array(23526,23586,23587,23588,23589,23590,23591,23592,23593,23595,23607,23608,23609,23610,23611,23612,23632,23639,23640,23641,23642,23654,23754,23765,23769,24000,24148,24192,323565,323602,323613,323627,323648,923586,923587),
'dunwood' => array(23655,24194,323650));
#while($line = fgets($f)) { # both give same results and similar performance
while($line = stream_get_line($f,10000,"\n")) {
$ln++;
$b = explode(',',$line);
if(in_array($b[2],$arr['millwood']))
{
$millwood[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
}
elseif(in_array($b[2],$arr['hudv1']))
{
$hudv1[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
}
elseif(in_array($b[2],$arr['dunwood']))
{
$dunwood[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
}
else
{
$nyc[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
}
if($ln == 7500)
{
$ln = 0;
usleep(500000);
}
}
fclose($f);
echo "done\n";
echo memory_get_peak_usage(); # you can remove this
?>
Here I "split" the parsing sequence so the script can run using less memory, ~60MB in ~48seconds:
<?php
ini_set('memory_limit', '64M'); # you can remove this
function my_parser($f,$codes,$var)
{
$array = array();
$ln = 0;
while($line = stream_get_line($f,10000,"\n")) {
$ln++;
$b = explode(',',$line);
if(in_array($b[2],$codes[$var]))
{
$array[] = array($b[0],$b[1],$b[2],$b[3],$b[4],$b[5]);
#$array[$b[0]][$b[1]][$b[2]] = array($b[3],$b[4],$b[5]); # ~50MB instead of 70MB
}
if($ln == 7500)
{
$ln = 0;
usleep(500000); # half second break each 7500 lines, be kind with CPU
}
}
return $array;
}
$file = '20111212realtime_gen.csv';
$arr = array('nyc' => array(23512,23513,23515,23516,23517,23518,23519,23520,23523,23524,23533,23534,23535,23538,23540,23541,23657,23660,23729,23770,23786,23810, 23816,23817,23820,24077,24078,24079,24080,24084,24094,24095,24096,24097,24098,24099,24100,24101,24102,24103,24104,24105,24106,24107, 24108,24110,24111,24112,24113,24114,24115,24116,24117,24118,24119,24120,24121,24122,24123,24124,24125,24126,24127,24128,24129,24130, 24131,24132,24133,24134,24135,24136,24137,24138,24149,24152,24155,24156,24157,24158,24159,24160,24161,24162,24163,24168,24195,24196, 24202,24225,24226,24227,24228,24229,24230,24231,24232,24233,24234,24235,24236,24237,24238,24239,24240,24241,24242,24243,24244,24245, 24246,24247,24248,24249,24250,24251,24252,24253,24254,24255,24256,24257,24258,24259,24260,24261,323558,323559,323566,323567,323568,323569,323581,323582,323595,323610,323651,323677,323678,923512,923533,923568,924077,924094,924106,924149,924156,924157,924158,924160,924162,924228),
'millwood' => array(23530,23531,23653,23659,23776,24019,24139,24193,24198,323649),
'hudv1' => array(23526,23586,23587,23588,23589,23590,23591,23592,23593,23595,23607,23608,23609,23610,23611,23612,23632,23639,23640,23641,23642,23654,23754,23765,23769,24000,24148,24192,323565,323602,323613,323627,323648,923586,923587),
'dunwood' => array(23655,24194,323650)
);
$a = array('nyc','millwood','hudv1','dunwood');
foreach($a as $row)
{
$f = fopen($file, "r");
$varname = $row;
$res = my_parser($f,$arr,${$varname} = …
This is related to register globals*, you were using $text[$i]
, if you don't define variable $text, then you get an error:
<?php
if(isset($_GET['check']))
{
$sel_cars="";
$count=count($_GET['text']);
for($i=0;$i<$count;$i++)
{
echo $_GET['text'][$i]." ";
}
}
?>
Or use:
$text = $_GET['text'];
echo $text[$i]." ";
Bye :)
* http://php.net/manual/en/language.variables.predefined.php
Quick suggestion: when login is true I prefer to set a session which enables users rights. So, at least, I can stop bugging the database for that. Otherwise I will have an extra query for each reserved page and each user logged. Bye :)
Exactly. The function time() gives you the number of seconds since 1970-1-1, so if you want to expire your cookie after a week write:
$time2=$time1+ (7 * 24 * 60 * 60); # days * hours * minutes * seconds
bye.
Hmm. Apache is running, right?
A variable cannot start with a number, you have to use an alphabetic character instead, so $0 and $1 are wrong. For example use $a0 and $a1.
Anyway, in your case a bi-dimensional array can be written as below:
$a = array(
array(40,60,20),
array(278,102,173)
);
To display data, then write:
echo $a[0][1]; # will display 60
If you want to assign specific keys you can write:
$a = array(
'alfa' => array(40,60,20),
'beta' => array(278,102,173)
);
echo $a['alfa'][2]; # output 20
bye.
Try to simplify the problem, create an empty file, without MySQL, write:
<?php
echo "<br>Tables were set up correctly.";
?>
And see what it happens. Bye.
The problem is related to the double quotes, rewrite that line 19:
$img = $info['photo'];
echo '<img width="240" height="240" alt="Wonky Buildings" src="images/'. $img .'>';
Or:
echo "<img width=\"240\" height=\"240\" alt=\"Wonky Buildings\" src=\"images/".$img ."\">";
Or:
echo "<img width='240' height='240' alt='Wonky Buildings' src='images/$img'>";
bye
I agree with Ardav and Chrishea, also you never know who is trying to retrieve a password, and if I forget a password how should I remember a secret question and a related secret answer? If you don't want to deal with passwords, allow your users to log in with OpenID http://en.wikipedia.org/wiki/OpenID
bye
First you need a valid chart id, otherwise, even if you match one, it could be private and you won't be able to save it.
Then check this thread: http://www.daniweb.com/web-development/php/threads/256243
The solutions proposed there may save time for you, bye.
Hmm.. Are you trying to save random charts? Why?
$url = 'https://chart.googleapis.com/chart?chid=' . md5(uniqid(rand(), true));
You're welcome! :)
Change the path for the images, for example:
<img src="C:/wamp/www/site/images/milk.jpeg" width="175" height="175" /> # wrong
<img src="/images/milk.jpeg" width="175" height="175" /> # ok
Just as for the css file. Bye :)
I'm not sure to understand what you asking for but if you want an automatic and general execution maybe you can use something like:
# $stop: get value from db or file for this action
if(date('d') == '01' && $stop == false)
{
# execute insert query
}
And run it with crontab.
First problem is include.php file, you're going to include another header section to your main file. So if you look at the output source in your browser you will see two header sections.
This means: in your include.php write only:
<table border=1 cellspacing=0 align ="center" >
<tr>
<td><a href="home.php"> <b>home</b> </a></td>
<td><a href=""> <b>more information</b> </a></td>
<td><a href=""> <b>login</b> </a></td>
<td><a href=""> <b>feedback</b> </a></td>
</tr>
</table>
Then check if you are able to view the css file through your browser by typing http://your_server_link/site.css
bye
Then post the code you're using. Not only this tag. Bye :)
Use an absolute path:
<link rel="stylesheet" href="/site.css">
This is way I suggested...
My bad English! Among other mistakes I meant "why" not "way".. I'm sorry this is not my first language :D
Yes I know, this mainly depends on how the browser determines the mime-type, for example Firefox use different methods to determine mime-types, on MacOS it uses type and creator code:
- https://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types
This is way I suggested you to use finfo or exec/file, both use magic file which is used in *nix box to determine file mime-types:
- http://en.wikipedia.org/wiki/File_(command)
You may want to wait for someone else solution. Bye :)
Yes. If you have contact.php make /contact/index.php, and so on, this will give you the ability to write http://www.your_server.tld/contact/
And for a while you can set an header redirect on the original files, just like in root index.php, so the spiders will save the new position.
Make a directory named index and place an index.php there.
Probably the configuration of your server needs an index.php in the root, you can place an header redirect in this file:
<?php header("Location: /index/",TRUE,301); ?>
So your structure will be:
/index.php
/index/
/index/index.php
bye
Great :)
then mark it as solved, this will help other users with your same problem, bye :)
If you can, use file command through exec():
exec("file -b --mime-type $file");
Or finfo_file():
<?php
$file = 'test.pdf';
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$result = finfo_file($finfo, $file); # echo mime-type
finfo_close($finfo);
?>
finfo_file(): http://www.php.net/manual/en/function.finfo-file.php
bye :)
Have you solved? You need to build a callback script, where you check if the value is already stored or not. In order to speed up you can build an index related to that column. Bye.
When? Did you tried to run this example script?
<?php
include('whois.main.php');
$whois = new Whois();
$query = 'daniweb.com';
$result = $whois->Lookup($query,false);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
It works if the script example is in the same directory of the PHPWhois Class.
Check the README file, there you find instructions and examples:
- http://phpwhois.cvs.sourceforge.net/viewvc/phpwhois/phpwhois/README?revision=1.22&view=markup
bye.
@cereal Im struggling to see how I could fetch the data from the sql table and format it in such a way.
<?php
# ...
# mysql connection
# ...
$q = mysql_query("select dateline, posts from mybb_stats limit 30 order by dateline desc"); # last 30 days
$arr = array();
while($row=mysql_fetch_object($q))
{
$arr[$row->dateline] = $row->posts;
}
foreach($arr as $key)
{
echo current($arr) - next($arr);
}
?>
bye :)
Each one of these nama_produk, harga, deskripsi, tgl_masuk, gambar
should refer to a field name in the form from which you send information to save, in the PHP script you need to use the $_POST array in order to connect them to variables:
$nama = $_POST['nama'];
$harga = $_POST['harga'];
$deskripsi = $_POST['deskripsi'];
// and so on
In your form tag you wrote "not" remove that.
In order to store an image directly into the database you need to:
a) create a blob field in the table database
b) use $_FILES array to collect info about the uploaded file
c) use fread()
Search php insert image to mysql blob you will find a lot of tutorials on this. A suggestion, save only the name of the file in the database. Bye.
In both you need to use mysql_query:
$query=mysql_query($sql);
yep. just leave the table block into include.php
Great :)
On the two headers, it seems to me that you have an html header on main page, and another one on include.php, that will output two headers.
Bye :)