Jump to content
xisto Community
farsiscript

Request: Php Submit Script With Save In Host Get Picture form url

Recommended Posts

Hi all i want make one form whit php , when users submit there urls , then my site give one picture form url and save on my host !
how can do that ?
thanks


I'm sorry, but I'm not exactly sure what you mean.

I've gotten this far: You want a form that people can enter urls into. But what do you want to do with it afterwards? Do you want to save the url in a text file or data base? Are the urls links to images that you want to save? Please try to be more clear in your request, and I'll do my best to help you with it.

Share this post


Link to post
Share on other sites

No no ,
I want make one form , and then peoples come and post there url
when people send url by this form i want make one code to give url of website and gete picture form site
look's like this
at first i post my url in page
2 - the page give one picture form my site and save in host
3 - show the thats picture form my host

i want make this script to help gave pic form url

i want make this script for buy and sale templates
so , users login at site then post there url ( for exam : http://ww38.yoursite.com/index.htm) then my script must give one picture form index.htm
and save in my host at mysite/picure/httpyoursite.comindex.htm.jpg

thanks if you know some think about this project tell me please ,

Edited by farsiscript (see edit history)

Share this post


Link to post
Share on other sites

Hi mr gaea do You have an Idea for this project ?I have 2 choose :1 - Tell Users To Take Picture form Web and Upload2 - Make one PHP robot how you think about this project ?This project is web template sale Script , plz help me and guide me :) thanks , :)

Share this post


Link to post
Share on other sites

farsiscript,Best advise I can give you is to search for this script on the free sites like http://www.hotscripts.com/. If you want to learn some php in the process, there is a book written by Larry Ullman that includes the source code for a nearly identical application (log-in/log-out, registration, and error-checking functions) but you would still have to know some php to personalize it. The name of the book is "PHP and MYSQL for Dynamic Web Sites, Second Edition". Chapter twelve has the application you want. Check your Local Library.

Share this post


Link to post
Share on other sites

Hi mr gaea do You have an Idea for this project ?
I have 2 choose :
1 - Tell Users To Take Picture form Web and Upload
2 - Make one PHP robot
how you think about this project ?
This project is web template sale Script , plz help me and guide me :)
thanks , :)


Sorry for the late reply, i've been really busy with my finals. Both of those solutions would work, but the easier version would deffinatly be number 2.

How much php do you know? I can give you the basic code you'll need for each...but you really should customize it for your individual purposes.

Anyways, for #1 you'd have a form that asks for the url of the photograph. You should really insert some error checking to make sure that it is infact an image (.jpg, .gif, or .png) instead of an exicuitable. The code would look something like this:
<?phpfunction http_get_file($url)  {   $url_stuff = parse_url($url);   $port = isset($url_stuff[port]) ? $url_stuff[port]:80;   $fp = fsockopen($url_stuff[host], $port);   $query  = GET  . $url_stuff[path] .  HTTP/1.0\n;   $query .= Host:  . $url_stuff[host];   $query .= \n\n;   fwrite($fp, $query);   while ($line = fread($fp, 1024)) {	  $buffer .= $line;   }   preg_match(/Content-Length: ([0-9]+)/, $buffer, $parts);   return substr($buffer, - $parts[1]);}?>
(take from http://forums.xisto.com/no_longer_exists/).
You'd then take the binary value that is returned, and write it into a file.

As far as #2 goes, there are lots and lots and lots of tutorials out there about how to make an image upload form. I find that htmlgoodies is usually a good resource for those first learning how to code. Check out their version of the tutorial at: http://www.htmlgoodies.com/beyond/php/article.php/3472551 The one problem that i can find in that code is it doesn't check the file extention either.

If you have any more questions please feel free to post again.

Share this post


Link to post
Share on other sites

Hi Dear gaea and other friends
thanks about your help
i find this script and i thing i posting here to help u :
for storing image in sql without upload on hositng
i think storing image in sql is better uploading :

at first make form.htm :
" with this file you can post image

<form action="sql.php" enctype="multipart/form-data" method="post">  <input type="file" name="image" /><br />  <input type="submit" name="upload" value="Upload" /></form>

at 2 make sql.php :

<?// check wether the user pressed the upload buttonif(isset($_POST['upload'])){// below two lines connect to mysql and the mysql database// change it according to your informationmysql_connect("localhost", "root", "");mysql_select_db("img");// below line opens the file chosen in the form for reading only$file = fopen($_FILES['image']['tmp_name'], "r");// then we read the file and add slashes to prevent errors when submitting to mysql$image = addslashes(fread($file, filesize($_FILES['image']['tmp_name'])));// inserts the null value as id, and our defined var $image to their corresponding cols.// we use die(mysql_error()) as a error report if something screws upmysql_query("insert into images values('null', '$image')") or die(mysql_error());// if all goes well, echo the below line.echo "image uploaded successfully";}?>
at 3 make view.php :
" this file show images form sql

<?// changes our url id to the var $id$id = $_GET['id'];// connects to the database//change info accordinglymysql_connect("localhost", "root", "");mysql_select_db("img");// selects the binary data blob according to the id specified// by our url$result = mysql_query("select image from images where id = '$id'");// tells php that contents of this page will be an imageheader("(anti-spam-content-type:) image/jpeg");// echoes our mysql query (echoes out the blob data)echo mysql_result($result, 0);?>
How To show images :
you can user this code :
<img src="view.php?id=1" alt="" />
for example if i browse view.php?id=2 then i can view 2 image in sql
with this script you can make secure (right click,save) image gallery or dont upload images
upload in host is not good , but storing data in database is very fast and secure
but my script has one problem i want make filter to members can not upload zip file or php file or an other file . i think with javascript i can do that but plz help me
thanks all
Edited by moderator (see edit history)

Share this post


Link to post
Share on other sites

Glad you found what you were looking for :) Feel free to post any other questions you run into...we're a pretty friendly bunch here.

Share this post


Link to post
Share on other sites

Sometimes it's not a good idea to make the link of the picture intact with your site. I mean, think if somehow anyone post a annoying picture? maybe you should analyze the pictures first.Anyway, if you want to convert the url into just txt, just use htmlentities(). It will discard the function of all HTML tags, so it won't do any HTML commands.

Share this post


Link to post
Share on other sites

how can i analyze picture format i want make one soruce to analyze picture formatand if picture is in jpg format then accept image elsesend message to visitor (not good file format ) some think like this :)end ifi think i do that whith javascript in form tagthanks dear gaea , you and other firends here are nice programmer and good friendif you find some kind of script plz post heredear .hack//GU plz paste htmlentites () here with one samplethanks , i tray to search htmlentites () in http://php.net/
thanks all

Edited by farsiscript (see edit history)

Share this post


Link to post
Share on other sites

Hi all

Iam tired because my code is not working true , i write this code for make one membership script

plz help me and debug this code

thanks

 

Database.sql :

CREATE TABLE news (id tinyint(4) NOT NULL auto_increment,username text NOT NULL,password text NOT NULL,email text NOT NULL,PRIMARY KEY (id)) TYPE=MyISAM;

config.php :

<?php mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("member") or die(mysql_error());?>

make.php :

<?phpif (!isset($_POST['submit'])) {?><form method="POST" action=""><p><input type="text" name="user" size="20" value="username"><br><input type="text" name="pass" size="20" value="password"><br><input type="text" name="email" size="20" value="email"></p><input type="submit" value="submit" name="submit"></form><?php} else {$user = $_POST['user'];$pass = $_POST['pass'];$email = $_POST['email'];include "config.php";$result = MYSQL_QUERY("SELECT * from news WHERE username='$user'");$worked = mysql_fetch_array($result);if($worked){echo "un , roor";}else{mysql_query("INSERT INTO news (username,password,email ) VALUES ('$user','$pass','$email')");echo "Your name and password have been submitted into our database";}}?>

login.htm :

<form method="POST" action="getin.php"><p><input type="text" name="user" size="20" value="username"><br><input type="text" name="pass" size="20" value="password"></p><input type="submit" value="submit" name="submit"></form>

 

 

* this file has error :

getin.php :

<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><?phpinclude "config.php";$username = $_POST['user'];$password = $_POST['pass'];$result = MYSQL_QUERY("SELECT * from news WHERE username='$username'and password='$password'")or die ("Name and password not found or not matched");$worked = mysql_fetch_array($result);$username = $worked[username];$password = $worked[password];$email = $worked[email];if($worked)echo "Welcome $user! Your e-mail address is $email";setcookie( "user", "$user", time()+3600, "/", "", 0 );?></head><body></body></html>

My problem is setcookie , :) when i login with username and password it show me this message :

Welcome admin! Your e-mail address is email

Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\membership\getin.php:4) in c:\wamp\www\membership\getin.php on line 21

 

i know i can make cookie with setcookie(); :)

i want make one page for example test.php and if my members has login can view my test.php page

sorry my english is not very good :)

plz help me , i saw this link : http://ir.php.net/manual/en/function.setcookie.php but i can't debug this code

thanks all

Share this post


Link to post
Share on other sites

hi
i search with google and i find this code :

function mkcookie($cookiename,$cookievalue,$cookietime){setcookie( "membership", "farsiscript");echo $_COOKIE["membership"];echo $HTTP_COOKIE_VARS["membership"]; }
but my problem is :
i can not check cookie in test.php file , i use this code :
<?phpif (isset($_COOKIE['membership'])) {   echo"in";	  exit;   } else {echo" out";	  exit;   }?>
what code i must use to check my cookie ?
thanks , i need your help

Share this post


Link to post
Share on other sites

no body loves me :)
i find this code for get html page soruce and save in sql :

<?php$fd = fopen ("http://http://ww38.yoursite.com/index.htm&%2334;, "r");while (!feof ($fd)) {	$buffer = fgets($fd, 4096);	echo $buffer;}fclose ($fd);?>
you can use this code to get page source , i write this code for sale template script
you can send $buffer to sql or print at page or ....
:)

Share this post


Link to post
Share on other sites

The problem in the getin.php file is that you have html before you tried to send the cookie. If you do that you'll get an error. Try movie everything above the html and then placing the variables where you want them in the html.

Example:

<?phpinclude "config.php";$username = $_POST['user'];$password = $_POST['pass'];$result = MYSQL_QUERY("SELECT * from news WHERE username='$username'and password='$password'")or die ("Name and password not found or not matched");$worked = mysql_fetch_array($result);if ($worked) {$username = $worked[username];$password = $worked[password];$email = $worked[email];setcookie( "user", "$user", time()+3600, "/", "", 0 );}?><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><?phpif($worked) {echo "Welcome $username! Your e-mail address is $email";}?></head><body></body></html>

Edited by Yarrgh (see edit history)

Share this post


Link to post
Share on other sites

savsoft test version 4.0 is a php based application which can create and manage online test .we also provide domain registration and hosting service for this application. you can create various types of questions like true false , short answers and multiple choice questions. you can also create negative marks in the test. In multiple choice questions you can create both check-box and radio button type of question ( in check box type questions member can select multiple options as a correct answer and in radio type question user can select only single option as a answer) . You can integrate (attach) number of any files with a question . It supports image ( jpeg , gif , and png ) , video (flv , wmv , and swf) and audio files ( mp3 and wma ). Its decrypeted version you can edit and modify as your requirementplease try our free online demo available on our website (http://forums.xisto.com/no_longer_exists/). If you did not find your requirements in this application then contact us for customize this application as per your requirement.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.