Jump to content

How to make a script to upload the webpage onto the server


Recommended Posts

Example like creating this topic and then the server will generate the php file and the link and it will be shown into the list topic and then someone will click this topic to view it

All I know use php code to create a php file into the server and place it into the server folder. When I try to type the address with the name of the file and the web browser say it is not found.

What code or method that I am missing
I am not quite sure what you are trying to ask but I will try and explain the process of what happens when a post is made which should help you a little better , first thing to do I guess is to strip away all the crap from teh url and break down what it means

When a post is made on a forum or anything like this it creates and entry in a database , that entry is referanced by a specific field  which is completely customisable by you , In the case of me replying to you there is first the php page that everythign gets it's info from ( index.php ) , the next part is telling you what action your doing , in this case it's "action=post " which tells index.php to pull any required info from it to be able to do this , next it goes to the database and finds your topic "116927 " and pulls down all the information from the needed fields ( such as your post info , the data created , number of replies ect ect ) what the file searches for and what those items mean in the url , are all defined in index.php  or an include page within index.php  using  the $get function

In summary , When a post is made there is no php file created , it is all index.php doing the work , each url is created from the code in index.php , and the information pulled from the database by index.php ( or any other file ) So effectivly one row in the database , is a thread ( same goes for posts or anythign else)





Now sorry to keep it short and breif however I don't want to waste your time reading it if this isn't the info you need . I am hapy to explain it a bit further if it is ,


Yeah thats the idea ,

the basic thing to remember is that your php files will request the same info each time , however the variables you pass in the url will decide what is displayed to you ,

eg  the php for

http://www.phpfreaks.com/forums/index.php?action=post;topic=116927 & http://www.phpfreaks.com/forums/index.php?action=post;topic=116 

are the exact same , the only difference is that the url is telling the script to access topic_id *** which would be a field in the database , you pull the relivant info by doign somethign like  he following 

example url :Example Url : http://www.anypage.com/index.php?id=***
( the ** can be any anythign to match entries in a database alpha or numeric 'numberic is advised')

[code]$id = $_GET['id']; <-- tells it to get the id variable from the url

mysql_connect("SERVERNAME", "USERNAME", "USERPASSWORD")
or die(mysql_error());
mysql_select_db("DATABASENAME") or die(mysql_error());

$data=mysql_query(" SELECT * FROM TABLENAME where FIELDNAME='$id' ")
or die(mysql_error());
$info= mysql_fetch_array($data) ;
[/code]

What the above code does is that it looks in the url to see what id equals , lets say for examples sake it's 88 so our full url is http://www.anypage.com/index.php?id=88.  Then we have the relivant info inorder to connect to the database needed.  from there It takes the value of $ID (number 88 ) and it searches for that number inside of the field that you have specified (where it says FIELDNAME)

This row is then pulled from the database , and you are able to pull out information from each field with the following format

[code]
. $info['field1'] .
. $info['field2'] .
. $info['field3'] .[/code]

ect ect ...

Obiously you are goign to want to be carefull in deciding what fields to make value's in the url so make sure your searching for something that is going to not have any duplicates ( such as topic id )

Hope that gives you a bit more understanding , and glad I was on the right track with what you wanted


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.