please suggest any sample script.
please suggest any sample script.
Hi,
I want to upload files from one remote server to another using CURL
I used following to upload a text file in "localhost/uploads/example.txt" to another machine http://192.168.0.202/example/
<?php
$ch = curl_init();
$data = array('name' => 'Foo', 'file' => '@localhost/uploads/example.txt');
curl_setopt($ch, CURLOPT_URL, 'http://192.168.0.202/example/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
?>
The code is not working.
How to disable close button of a pop up window using javascript?
Hi..
I am using tinymce editor for mathematical and graphical functions.
The graph in editor content which is inserted into the database is not showing in firefox and chrome.
But it can be viewed in Explorer.
I have downloded script from
http://www.imathas.com/editordemo/demo.html
There is demo is provided in the above link.
The demo has also the same problem.
After submitting the content(with graph) it will not shown in
http://www.imathas.com/editordemo/output.php
Hi...
Is there any PHP rich text editor with mathematical functions?
Use
<?php
session_start();
session_destroy();
?>
for clearing all sessions
Try following example
image_ajax.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title></head>
<body>
<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
<script type="text/javascript">
function get1()
{
alert('inside fun');
var dgroup=$("#int_entry_id").val();
alert(dgroup);
$.post("test1.php",{dval:dgroup},function(data)
{
alert("ajax_loaded");
//alert("data="+data);
var image = new Image();
image.onload = function(){
document.body.appendChild(image);
};
image.src = data;
});
}
</script>
<form name="f">
<select name="int_entry_id" onChange="get1()" id="int_entry_id" >
<option value="" selected="selected">Select One</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</form>
<p id="img"></p>
</body>
</html>
test1.php
<?php
$group=$_POST['dval'];
if($group==1)
echo "p2.jpg";
if($group==2)
echo "p1.jpg";
?>
Redirect to another page other than header("Location:http://bannistermarketinggroup.co.uk/site_optimization/");
Write down the thank u message and use a button or hyper link to redirect to header("Location:http://bannistermarketinggroup.co.uk/site_optimization/"); page.Or use a timer to redirect to header("Location:http://bannistermarketinggroup.co.uk/site_optimization/"); after printing message.
I have tried it with 1.7.2 and other versions.but not working
Not entering into the jquery post.
Not printing "ajax_loaded" and other outputs.
Firefox version is 12.0,my JQuery version jquery-1.3.1-min.js
Hi,
I have used the following code to load data from a php page using AJAX with JQuery.The script running well in all browsers except Firefox.
The script I used is as follows.
test_ajax.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title></head>
<body>
<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
<script type="text/javascript">
function get1()
{
alert('inside fun');
var dgroup=$("#int_entry_id").val();
alert(dgroup);
$.post("test1.php",{dval:dgroup},function(data)
{
alert("ajax_loaded");
alert("data="+data);
});
}
</script>
<form name="f">
<select name="int_entry_id" onchange="get1()" id="int_entry_id" >
<option value="" selected="selected">Select One</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</form>
</body>
</html>
test1.php
<?php
$group=$_POST['dgroup'];
echo "Inside php";
?>
I have tried to connect to ftp server it windows. It works well with. But when I used the same with red hat i was unable to connect to server.
ftp service is already running in redhat.
$con_id=ftp_connect("192.168.0.8")or die("Couldn't connect to"); ;
$login_result = ftp_login($con_id, "newuser", "wampp");
// check connection
if ((!$con_id) || (!$login_result)) {
echo "connection has failed!";
} else {
echo "Connected to $ftp_server, for user ".".....";
}
I want to count files from a directory which is stored in a remote server .
I used the following code . But obtained warning
<?php
$url='192.168.0.138/img/12/12N69/';
$dir = opendir($url);
//List files in images directory
while (($file = readdir($dir)) !== false)
{
echo "filename: " . $file . "<br />";
}
closedir($dir);
?>
Warning:
Warning: opendir(http://192.168.0.138/img/12/12N69/) [function.opendir]: failed to open dir: not implemented in C:\xampp\htdocs\divya\remote_files\remote.php on line 3
Warning: readdir() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\divya\remote_files\remote.php on line 6
filename:
How to count number of files in a directory from a remote server using curl?
I used the code given below to take the count of files in a folder which is in another machine. On my localhost the glob() is working fine, BUT on the server it displays the array size as 0.
$dir_path ="http://192.168.0.202/img/$sub_code/$sub_code".N."$churunano/*.jpg*";
$count = count(glob($dir_path));
How to find the count of the files?
Sorry Its my code mistake.Actually the code is
<?php
> if(isset($_POST['st']))
> {
> while ($item = current($_POST))
> {
$key=key($_POST);
> echo $_POST[$key];
> next($_POST);
> }
> }
> ?>
Thanks for help
Hi...
I want to display associative using variable as its key value.
I used the following script.
But it is not functioning.
<body>
<?php
if(isset($_POST['st']))
{
while ($item = current($_POST))
{
echo $_POST[$key];
next($_POST);
}
}
?>
<form id="form1" name="form1" method="post" action="mysql_inj.php">
<p>
<label for="textfield"></label>
<input type="text" name="t1" id="textfield" />
</p>
<p>
<input type="text" name="t2" id="textfield2" />
</p>
<input type="submit" name="st" id="textfield3" />
</form>
</body>
</html>
Is their any way to count the files in network share?
The "img" folder in 192.168.0.138 is shared.
Hi..
How to count no of files in a directory which is in another machine?
I used the following code.But it is not working.
<?php
$dir_path ="file://192.168.0.138/img/$sub_code/$sub_code".N."$churunano/*.*";
$count = count(glob($dir_path));
$files = glob($dir_path);
?>
The above code returns the count as 0.
I have already completed the application.
Is it possible to hide url without changing url path in my php code.
Hi..
I want to hide/rewrite the URL of my php project.
I found many forums regarding this.
I have a doubt in .htaccess file.
Is it need to create a new .htaccess inside my project folder ?
Thank u.Its working
I have a shared folder with images in a machine. How can I display images from that machine in a web page in another machine. I used the follwing code but obtained no output
** <?php $img_src="file://192.168.0.138/E:/img1/12/12N69/12N69$0001A1.JPG"; ?>
<img src="<?php echo $img_src ?>" alt="" width="1000" height="220" id="myimg" />**
Is it possible to open the e-book in client machine's flashplayer without downloading ?
I want to open an e-book which is stored on server in exe format. Client want to open and view the e-book without downloading in the client machine.
I can run the exe from server side using PHP.But on client machine I can't run the exe.
Is it possible to run an exe file which is saved on server machine using exec() function?
I
Hi..
Anyone please help me to find the duration between two date-times in following format?
format is
Date1="23-03-2012 04:25PM"
Date2="26-09-2013 08:26AM"
I want to find out the diffence between Date1 and Date2 in following format.
The Result ="no of Years:no of Days:no of Hours:no of Mintues:no of Seconds"
Hi...
I want a to print a receipt using dot matrix printer such that the paper should not eject fully out from printer after printing. Any idea ?
You can refresh the page by using meta tag
<meta http-equiv="refresh" content="5; url=home.html">
This will refresh the current page after 5 seconds and will load home.html
Use for loop to access tables.
for($i=1;$i<=12;$i++)
{
$q="SELECT * FROM table".$i;
/*
Do ur table processing
*/
}
This means that your user account does not have the necessary privileges to create a database.Contact the administrator.Try to create the database using phpMyadmin or SQL YOG.
Use the PHP delimiters before starting HTML tags.Change your code as to
<?php
if ($_POST["page"] == "confirm")
{
confirmPage ();
}
else
{
orderForm();
}
function orderForm()
{
$script = $_SERVER['PHP_SELF'];
?>
<html>
<head>
<title> Online Sign Up </title>
</head>
<body>
<h3> Online Sign Up</h3>
<form method = "post" action = "$script">
<p>
<table border = "2" width="400">
<th>Time</th>
<th>Name</th>
<?php
$schedule = getSchedule();
for($i = 0; $i<count($schedule); $i+=2)
{
$index = $i+1;
print("<tr>");
print("<td> <center> $schedule[$i] </center> </td>");
if($schedule[$index]=="")
{
print("<td> <center> <input type = \"text\" name = \"$index\" size = \"30\"> </center> </td>");
}
else
{
print("<td> <center> $schedule[$index] </center> </td>");
}
print("</tr>");
}
?>
</table>
<input type = "hidden" name = "page" value = "confirm" />
</p>
<p>
<input type = "submit" value = "Submit" />
</p>
</form>
</body>
</html>
<?php
}
function getSchedule()
{
$lines = file("./signup.txt", FILE_IGNORE_NEW_LINES);
$schedule = array();
foreach ($lines as $line_num => $line)
{
$schedule[$line_num] = $line;
}
return $schedule;
}
function setSchedule($schedule)
{
$file = fopen ("./signup.txt", w);
for($i=0; $i<count($schedule); $i++)
{
fwrite($file, $schedule[$i]."\n");
}
fclose($file);
}
function confirmPage()
{
$script = $_SERVER['PHP_SELF'];
$schedule = getSchedule();
?>
<html>
<head>
<title> Sign Up </title>
</head>
<body>
<h2> Confirmation </h2>
<p>
<?php
for($i=1; $i<=count($schedule); $i+=2)
{
if($_POST[$i])
{
if($schedule[$i] == "")
{
$index = $i-1;
$schedule[$i] = $_POST[$i];
print("$schedule[$i] is now scheduled for $schedule[$index] \n");
}
else
{
echo " Unable to add $schedule[$i] to $schedule[$index]. Please enter another time.";
?>
<form>
<input type = "hidden" name = "page" value = "" /> …
Try this code
<body>
<form id="form1" name="form1" method="post" action="display.php">
<table width="200" border="1">
<tr>
<td>Name</td>
<td><input name="t1" type="text" id="t1" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Submit" />
</div></td>
</tr>
</table>
</form>
</body>
display.php
<?php
$name=$_REQUEST['t1'];
echo $name;
?>
Use AJAX technologies.
It helps u to call a php page from javascript.
Also u can pass the values from javascript to php.
Hi...
I want to move an uploaded file to another machine.I had given the file path to move_uploded_file() function including IP address .The folder is a shared folder.My code shown below.
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
move_uploaded_file($_FILES["file"]["tmp_name"],"192.168.0.23/E:/pdf/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
?>
I am getting the error like as
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to access 192.168.0.23/E:/pdf/Picture 240.jpg in C:\xampp\htdocs\divya\fileupload\upload_file.php on line 11
Check out the spelling of kategori and id'.It should be match with table field name.
Use AJAX.
Refer following Sites.
http://www.w3schools.com/php/php_ajax_database.asp
http://www.ajaxf1.com/tutorial/ajax-php.html
It is difficult to extract the address into three components.Because all the words are separated by space character.There is no other character is for string extraction.
Add , to your address like 252 westend drive, Sommerset west, 0185 before insertion.
Then split the string into array elements using explode() function.
I suppose you are misspelled the form fields "kategori","id".
Check out your previous page for correct spelling.
It is clear , if you post the previous page code.
Try to execute the exe of apache & mysql.
Go to "C:\wamp\bin\apache\Apache2.2.17\bin" ,then run "httpd.exe" and go to "C:\wamp\bin\mysql\mysql5.5.8\bin\" run "mysql.exe" .
There is an error in your query .
So the mysql_query function returns a boolean, and not a resource.
mysql_fetch_array() cannot works with a boolean value.
You can check the error in mysql query by using following code
$result = mysql_query("SELECT * FROM event");
if ($result != false) {
// use $result
} else {
// an error has occured
echo mysql_error();
die; // note : echoing the error message and dying
// is OK while developping, but not in production !
}
Print all your query statements and execute it using phpmyadmin(or any mysql browser).
Submit your form and retrieve the check box value as
$store_id=$_REQUEST['store_id'];
Change is as
}
}</form>
?>
</body></html>
to
}
}
?>
</form>
</body></html>
Where r u calling class functions?Can you post entire code?
Change the code
$arr=unserialize($_REQUEST['pname']);
to
$arr=unserialize(clean_slweg($_REQUEST['pname']));