Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
please look at my install thing im tring to do i dont know how to make it work...
Old 04-22-2007, 02:21 PM please look at my install thing im tring to do i dont know how to make it work...
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
hi,

im gonna try and make a really basic CMS which i will problly call K.I.S.S CMS (Keep It Simple Stupid, in case you were wondering)

anyway im starting to make like the "install" script which will create a few files which the pages will refer to for infomation.

ill post em and u can try to see whats going wrong...

This is the first installl page, here you enter basic infomation such as webmaster email...
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<
html>
<
head>
<
title>Dansgalaxy's K.I.S.S CMS - Setup</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" action="install2.php">
Title: <input type="text" name="title" />
<br />
Admin email: <input type="text" name="adminemail" />
<br />
Webmaster Email: <input type="text" name="webmasteremail" />
<br />
URL of this site: <input type="text" name="coreurl" /> Please make like http://YOURSITE.co.uk Or http://YOURSITE.co.uk/kisscms. DO NOT add a trailing / (ie. http://yoursite.co.uk/kisscms/)
<br />
<br />
<input type="submit" value="Create" />
</form>
</body>
</html> 
this info from this form is sent to install2.php

This is install2.php
PHP Code:
<html>
<head>
<title>Dansgalaxy's K.I.S.S CMS - Setup 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
META Settings!
<br />
<br />
<form method="post" action="install3.php">

Meta info:
<br />
Author: <input type="text" name="metaauthor" />
<br />
Copyright: <input type="text" name="metacopyright" />
<br />
Robots: <select name="metarobots">
<option value="index">Index</option>
<option value="index, follow">Index, Follow</option>
<option value="noindex">Noindex</option>
<option value="noindex, nofollow">Noindex, Mofollow</option>
</select>
<br />
<!-- -->
Description:
<textarea name="metadescription">
</textarea>
<br />
Keywords:
<textarea name="metakeywords">
</textarea>
<br />
</form>
 
</body>
</html>
<?php
$config 
"
$title = $_POST['title'];
$adminemail = $_POST['adminemail'];
$webmasteremail = $_POST['webmasteremail'];
$core = $_POST['coreurl'];
"
;
$config "config.php";
$fh fopen($answers'w') or die("Can't open file");
$stringData "$allanswers\n";
fwrite($fh$stringData);
/* $stringData = "Tracy Tanner\n";
fwrite($fh, $stringData);*/
fclose($fh);
?>
This script is SUPOSED to save the infomation from install.php as a file called config.php

it also has a form for entering other info for the metas which is sent to install3.php

install 3 will have the same structure as install2.php and will save the meta info as a file called metainfo.php which will be included in all of the websites webpages... anyways

i need the code in install2 in the $config ="" the things $_post need to be processed so it saves as $adminemail = admin@dansgalaxy.co.uk (or whatever is enterd into the admin email field)

at the moment this script(s) save nothing and produce a error when i click send on install.php (Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in M:\Server\xampp\htdocs\kisscms\install2.php on line 51)

Can someone help?

Lol if anyone understands what i just said that is...

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
 
Register now for full access!
Old 04-22-2007, 03:22 PM Re: please look at my install thing im tring to do i dont know how to make it work...
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
PHP Code:
$config "
$title = $_POST['title'];
$adminemail = $_POST['adminemail'];
$webmasteremail = $_POST['webmasteremail'];
$core = $_POST['coreurl'];
"

should be written:
PHP Code:
$config "
$title = {$_POST['title']};
$adminemail = {$_POST['adminemail']};
$webmasteremail {= $_POST['webmasteremail']};
$core = {$_POST['coreurl']};
"

The { and } are there for hinting the PHP engine that what's between is PHP code, not part of a string variable.
As a general rule, if you are using an array or object notation in a string, always add those {}, it will save you some time.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 04-22-2007, 04:12 PM Re: please look at my install thing im tring to do i dont know how to make it work...
Defies a Status

Posts: 1,606
Trades: 0
One other thought. You may want to have an empty config.php that your script writes to instead of letting it create the file. For some reason I am thinking that may give you some problems on some server configurations.

It may work on your local machine, which is a developement envoirment and then not work on a live server.
__________________
Colbyt

Please login or register to view this content. Registration is FREE
colbyt is offline
Reply With Quote
View Public Profile
 
Old 04-22-2007, 04:44 PM Re: please look at my install thing im tring to do i dont know how to make it work...
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Thanks ill try that,

as long as the dir is writable i dont think it will cause any problem. but if there is i will do that

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 04-22-2007, 10:01 PM Re: please look at my install thing im tring to do i dont know how to make it work...
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
PHP Code:
$config "
$title = {$_POST['title']};
$adminemail = {$_POST['adminemail']};
$webmasteremail {= $_POST['webmasteremail']};
$core = {$_POST['coreurl']};
"

The { and } are there for hinting the PHP engine that what's between is PHP code, not part of a string variable.
As a general rule, if you are using an array or object notation in a string, always add those {}, it will save you some time.]
The problem is that the vars will try to be interpeted in double quotes, so your best to write the string as:

PHP Code:
$config  '$title =          "' $_POST['title'] . '";' "\n";
$config .= '$adminemail =     "' $_POST['adminemail'] . '";' "\n";
$config .= '$webmasteremail = "' $_POST['webmasteremail'] . '";' "\n";
$config .= '$core =           "' $_POST['coreurl'] . '";' "\n"
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-23-2007, 08:04 AM Re: please look at my install thing im tring to do i dont know how to make it work...
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
yes i did have alittle problem it was creating the file like = "somin"

but now i have the code as:
PHP Code:
\$title = \"{$_POST['sitename']}\";
\$adminname = \"
{$_POST['adminname']}\";

\$adminemail = \"
{$_POST['adminemail']}\";
\$webmasteremail = \"
{$_POST['webmasteremail']}\";
\$core = \"
{$_POST['coreurl']}\"; 
with the \ so that it ignores the $somin bits and just writes them and so for the bits where i want " written, once i get the hang of it its quite easy,
hopefully i gonna make it so that it has like css file creaters and stuff hopefully when its dont i can write it in a way to it just uses a template file for the layout and colours etc are just included or inserted into that...


Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to please look at my install thing im tring to do i dont know how to make it work...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18342 seconds with 12 queries