Anonymusius 5 Posting Whiz in Training

I don't think there is a good answer to this. "Better" is hard to define, I don't actually know Coldfusion but what I saw from it looked utterly weird. That doesn't mean it's a bad language, I heard that you can write very short code in Coldfusion.
Choosing between language's is mostly a matter of taste. If you really think PHP would be better suited confront the network guy and ask him why he choose Coldfusion. If he choose Coldfusion he will most likely know.

Good luck

Anonymusius 5 Posting Whiz in Training

I think you would be better off here: http://www.daniweb.com/forums/forum52.html
Good luck

Anonymusius 5 Posting Whiz in Training

One word: Javascript.

Anonymusius 5 Posting Whiz in Training

As I understand it you want to mask an id you pass through the URL with frames, so that people don't hotlink to it. But anyone reasonably smart wont be fooled by that.
If I understand your problem correctly there are lots of ways to do it. You could check the referrer value to see if their coming from within your domain. People can edit their referrer value but I think it's pretty safe (better then frames).
I could think of more ways but this one is, I think, the best.
I hope this is what you were looking for.

Anonymusius 5 Posting Whiz in Training

with tags. You can replace [sub] and [/sub] with <sub> and </sub>, and then enter it in your DB. You should watch out for unclosed tags though, if you write [sub] and not close it all following text will be subscript. You should be able to figger it out.

Anonymusius 5 Posting Whiz in Training

You can get URL value's with $_GET[] array, in your sample URL (
http://somesite.com/readarticle.php?name=sample.txt) it would be $_GET['name']; . Be warned to use this cause this brings potential security leeks with it. you should read up on the problems with it.

<?php
$file = $_GET['name'];
$f = fopen($file, r);
while ( $line = fgets($f, 1000) ) {
print $line;
}
?>

now if I go to readarticle.php?name=readarticle.php I can see the PHP source.
Good luck with your site.

Anonymusius 5 Posting Whiz in Training

When I tried it in PHPmyadmin I got:

CREATE TABLE `test` (
`id` CHAR( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` INT NOT NULL
) ENGINE = MYISAM

MySQL said:
#1063 - Incorrect column specifier for column 'id'

So I fear that what you are trying to do is impossible. The idea behind auto_increment is that you add 1 for each new record so that every record has a differing ID (I believe it is, at least). Why would you want your ID to be a char? What would ID's like (A, B, C, D, E) differ from (1, 2, 3, 4, 5)?

Unless offcourse your trying to do something different with your auto_increment. You could always do the incrementing in PHP itself.

Anonymusius 5 Posting Whiz in Training
<?php
session_start();
$_SESSION['var'] = $variable;
?>
<?php
session_start();
echo ++$_SESSION['var'];
?>

I guess that should work

Anonymusius 5 Posting Whiz in Training

I guess your problem must lay in the form your using. To did you made a little typo: if($budget == "low"){ $sream = $stream + 3; } if the post variable's aren't initialized will none of these statements evaluate:

if($time == "deadline"){ $custom = $custom + 1; }
            if($time == "nodeadline"){ $stream = $stream + 1; }
            
            if($budget == "low"){ $sream = $stream + 3; }
            
            if($visual == "impressive"){ $custom = $custom + 2; }
            
            if($update == "easyupdate"){ $easyup = $easyup + 1; }
            if($update == "noupdate"){ $selfup = $selfup + 1; }
            if($update == "updateservice"){ $upserve = $upserve + 1; }

Leaving $custom, $stream, $easyup, $selfup, $upserve zero (their value stays zero). Which will respond by none of your if statements evaluating to true:

if($custom < $stream){$report = "streamlined is better for you than custom";}
if($custom > $stream){$report = "custom is better for you than streamlined";}
if($easyup < $upserve){$report2 = "you need our update service with your site";}
if($easyup > $upserve){$report2 = "you need our user-friendly update service with your site";}
if($selfup > $upserve){$report = "you do not need any of our update services";}
if($selfup > $easyup){$report = "you need our update service with your site";}

Which leaves $report (and $report2, which you don't output) a blank string.
So I think your problem lays in your form. you might want to add to help you debugging:

echo "<pre>";
print_r($_POST);
echo "</pre>";

Hope this helps

Anonymusius 5 Posting Whiz in Training

It looks to me like the www folder for Cpanel is wrongly set. it operates in /home/cometora/public_html/ and it calls to /usr/local/apache/htdocs/. This might as well be intended behavior.

My guess would be that Cpanel has a configuration which defines what the root of the web server / Cpaneldirectory is and that is set to /usr/local/apache/htdocs/ while it should be set to /home/cometora/public_html/

Off course this is a guess, the first error is a permission error. It might to be that you need to chmod /usr/local/apache/htdocs/online.txt up to where the webserver can read it.

Good luck

Anonymusius 5 Posting Whiz in Training

Yes, the server can't see the difference between two requests from different windows (different browsers is another story, you got to have the session cookie for it to work)

Anonymusius 5 Posting Whiz in Training

You need to wrap this in a form tag, and then submit it with a <input type="submit">.

Here's how the form is supposed to look, taken that this is the file index.php:

<form action="./index.php" action="POST">
<input type="checkbox" name="ch1" value="checked" /> Choc<br />
<input type="checkbox" name="ch2" value="checked" /> Liqu<br />
<input type="checkbox" name="ch3" value="checked" /> Wine<br />
<input type="checkbox" name="ch4" value="checked" /> Lolli<br />
<input type="submit" value="Test this lil' form"/>
</form>

If a value box was checked the $_POST[name] will be value, so if Choc is checked, $_POST['ch1'] = "checked"; . On the other hand, if the check box was not set, no value will be send. So $_POST['ch1'] won't even be set at all.

Why did you wrap a if(isset($_POST['Sub'])) around it? since there is nothing that will set sup the code under it will never be executed. That might to be your problem.

Good luck with your form, I know I'm not that good at explaining stuff, so feel free to ask if something is not clear.

Anonymusius 5 Posting Whiz in Training

The only thing I use is a text editor with some sort of text highlighting, at this moment bluefish. (And off course an image editor, GIMP for me). If you want feature's to include in such an application look at the feature list of Dreamweaver, that is ought to give you inspiration.

But what are you trying to build? A web application or a desktop application? (I assumed the latter, but since the title is "Web app"

Anonymusius 5 Posting Whiz in Training

Well, to take the easier part first, the printing of each value of an array:

<?php
foreach($array as $key => $val){
echo "$key = $val <br />";
}

Now to separate email addresses, that depends on how the string with the email addresses is formatted. if it's just separated with comma's, I would use explode:

$array = explode(',', $emailString);

But if the separator between the email addresses isn't constant, you should indeed go with regex (with the split function).

Off course there are lots of ways of doing it. I think you could to do it with preg_match_all(); You should post an example of the string you want splitted looks like.

Anonymusius 5 Posting Whiz in Training

This question makes no sense. Pages are read-only. You are probably not formulating this correctly. Post again and explain what you want PHP to do. We'll help you on your way to do it.

Anonymusius 5 Posting Whiz in Training

PHP had a nice build-in library called SimpleXML for parsing XML. Your client needs to have PHP5 though.

Good luck.

Anonymusius 5 Posting Whiz in Training

Maybe post some code? All I can do now is direct you to PHP's session page. http://nl3.php.net/manual/en/ref.session.php

Anonymusius 5 Posting Whiz in Training

I don't see any problems in my first glance, try to put a print_r($names); somewhere and see whether the array contains email adresses valid for PHP to swallow ( http://nl3.php.net/manual/en/function.mail.php ).

BTW, $x = 1; , shouldn't that be $x = 0; ? Or does the file your loading first have an empty line or something like it?

You might to want to check your php.ini is fully configured for sending mail: http://nl3.php.net/manual/en/ref.mail.php .

Anonymusius 5 Posting Whiz in Training

You shouldn't upload it to your production server, especially if it are scripts you don't understand the working off. I'd advice you to get a local server, if your on windows is wamp an very easy option.

If you already uploaded it and got the domain to point at a server just FTP it to the folder of your domain on your server. On that free hosts I had it was, if I remember correctly, the htdocs folder that was the domain folder.

But I'd say you better wait for that friend of yours to help you.

Anonymusius 5 Posting Whiz in Training

If there both installed it should work. I used the debian repository via ubuntu to get apache and mod_php (I believe that's what the plugin is called). How did you install PHP and Apache? Did you compile it yourself?

There might be another problem instead of Apache not seeing PHP, does it serve static pages? Otherwise there might be another problem. Some systems come standard with all ports closed, I bleieve they cal that hardened by default. Maybe you need to open port 80 (I believe they only do that by server releases though).

Good luck

Anonymusius 5 Posting Whiz in Training

If I were you I would go for mysql instead of a textfile, both options are possible and mostly a matter of taste. The advantage of mysql is that you can easily request the last 10 or more results (you don't want to display all the conversation every time).

For refreshing you could go with a meta refresh, which is annoying cause if I'm typing something and it meta refreshes, it's gone (atleast, I think. You could test it). You could use an button to let the user manually refresh it when he/she is ready. Still not a very desirable situation.

In my opinion is the best way to go for an in browser chatroom ajax. Ajax allows you to make a request to the server without reloading the page. It's just Javascript with a new object though, so it isn't that hard.

Keep in mind that you will have to let users time out, some users won't press your fancy logout button.

Good luck with your project.

Anonymusius 5 Posting Whiz in Training

Use a unique identifier in the mysql table (Like an index key or an unique key). Then use something in the direction off:

if( ! isset( $_GET[ 'id' ] ) ){ die( 'No ID specified' ); }
$value = mysql_get_gpc() ? $_GET['id'] : addslashes( $_GET['id'] ) ;
mysql_query( "select * from `dmail_fields` where `id`=`$value`" );

That should return you 1 result with the data you want.

Anonymusius 5 Posting Whiz in Training

http://nl3.php.net/manual/en/ref.mysql.php

Scroll down, to Table of Contents. There is a list of mysql functions. You should especially look at:
mysql_connect();
mysql_select();
mysql_close();
mysql_select_db();
mysql_query();
mysql_fetch_array();
mysql_result();

I assume you already know mysqls query language. If not look on the Internet for tutorials. Ask if you have any more problems.

Anonymusius 5 Posting Whiz in Training

You could use http://www.wampserver.com/en/ or XAMPP (to lazy to search for link ;P). It has most the feature's necessary and works fine. It has PHPmyadmin (Very handy for mysql). If you want to run a server from a USBstick I would recommend http://www.chsoftware.net/en/useware/wos/wos.htm

Good luck and Have Fun.

Anonymusius 5 Posting Whiz in Training

If you want others to access your forum I would advise you against hosting it yourself. It would mean your computer has to be on and running the web server if others want to access it. To are there a lot of free forum packages, like http://www.phpbb.com/ (there are more an maybe even better free forums out there).

If you just want a forum you could also go to http://www.freeforums.org/ or http://www.5wwwww5.com/ (there are to other company's that do this)

If you still want to use vbulletin (since you bought it you probably will). Sign up for a free host, upload your vbulletin stuff, make mysql database, install vbulletin. Easy as that.

Anonymusius 5 Posting Whiz in Training

Since you provide very few information is it hard to help. I'd say you should go with PHP. PHP is very easy to learn and integrates nicely with mysql databases. PHP puts HTML and CSS out, all server side. For more info on PHP go to http://www.php.net/.

Good luck and if you have any questions regarding PHP ask in the PHP forum.

Anonymusius 5 Posting Whiz in Training

Do you think your boss is ok with you posting this? Beside that, can't you trace the problem down to a specific piece fo code? This is to big for me to wade through.

To I like code that's indented.

Anonymusius 5 Posting Whiz in Training

It looks to me like you entered this somewhere in your mediagalary, but that it got parsed. To because that a tag was wrapped around the URL's. Bit weird is the <br"> and that it didn't close the a tag, if it were a parser.

So I ask you, did you nativly pasted this into PHP like:

<?php
//code here
?>
<script type="text/javascript"
src="http://www.example.com/js/swfobject.js">
</script>
<script language="javascript"
src="http://www.example.com/js/player.js">
</script>
<script language="javascript">
var config = new Array();
config["width"] = 400;
config["height"] = 300;
config["clientId"] = "example";
config["bgColor"] = "#FFFFFF";
config["playList"] = "1191";
showSanagaPlayer(config);
</script>
<?php
//code here
?>

or did you enter this somewhere in a form in the media galary your using. If you didn't enter it in a form it's still theoraticly possible to style it with ob_start() and output buffer functions, seems unlikely though. You might wanna add what gallery your using.

Anonymusius 5 Posting Whiz in Training

Put your server online (left click on wamp icon, then put online) and then goto your IP (you said 192.168.0.12) in your browser.

Anonymusius 5 Posting Whiz in Training

I made it work, my solution is however not so pretty looking:

$query = '-- 
-- Database: `anonymusiusform`
-- 

CREATE DATABASE `anonymusiusform` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `anonymusiusform`;

-- --------------------------------------------------------

-- 
-- Table structure for table `enquete`
-- 

CREATE TABLE IF NOT EXISTS `enquete` (
  `id` int(5) NOT NULL auto_increment,
  `ip` varchar(16) NOT NULL,
  `host` varchar(50) NOT NULL,
  `age` varchar(2) NOT NULL,
  `name` varchar(50) NOT NULL,
  `rank` varchar(8) NOT NULL,
  `opmerking` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;';
mysql_connect('localhost', 'username', 'password');

foreach(explode(';', $query) as $value)
{
    if($value == ''){continue;}
    
    mysql_query($value) or die(mysql_error());
}

It works now, I only use the application and it is only in the adminscreen so I will always be able to dump sql in case of a crash in phpmyadmin. If someone has a better solution please tell me.

Anonymusius 5 Posting Whiz in Training

I removed the comments (they were just for fun there, and with enters it actually looked more structured) and it didn't seem to work, still the same error. I google'd a few times and searched through the mysql documentation but I didn't found anything that solve's this. Any help is highly appreciated. Here is the query again, and this time better formatted :) :

-- 
-- Database: `anonymusiusform`
-- 

CREATE DATABASE `anonymusiusform` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `anonymusiusform`;

-- --------------------------------------------------------

-- 
-- Table structure for table `enquete`
-- 

CREATE TABLE IF NOT EXISTS `enquete` (
  `id` int(5) NOT NULL auto_increment,
  `ip` varchar(16) NOT NULL,
  `host` varchar(50) NOT NULL,
  `age` varchar(2) NOT NULL,
  `name` varchar(50) NOT NULL,
  `rank` varchar(8) NOT NULL,
  `opmerking` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

I traced the enter problem down to me not enabling javascript because the site is dogslow (for me) with javascript enabled. So again sorry for my previous post.

Anonymusius 5 Posting Whiz in Training

I have a program which requires a database. So I made a file that could generate the sql to create it (I copied the sql from PHPmyadmin as reference). When I execute the sql I get the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; USE `anonymusiusform`; -- ------------------------------------------------' at line 4

It's always on the first ; that the error occurs. If I execute it in PHPmyadmin it works and correctly creates the database. I think the problem lays with the 'delimiter'. I tried googling it but I didn't found anything to solve my problem. This is the sql my file generate´s:

--  -- Database: `anonymusiusform` --   CREATE DATABASE `anonymusiusform` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; USE `anonymusiusform`;  -- --------------------------------------------------------  --  -- Table structure for table `enquete` --   CREATE TABLE IF NOT EXISTS `enquete` (   `id` int(5) NOT NULL auto_increment,   `ip` varchar(16) NOT NULL,   `host` varchar(50) NOT NULL,   `age` varchar(2) NOT NULL,   `name` varchar(50) NOT NULL,   `rank` varchar(8) NOT NULL,   `opmerking` text NOT NULL,   PRIMARY KEY  (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Any help would be highly appreciated. Edit: The layout seems messed up, I don't get what's wrong. Sorry about it. It doesn't seems to recognize enters anymore.

Anonymusius 5 Posting Whiz in Training

You misspelled mysql_num_rows, I think that because of that it returned false, so 0. And because of that the entire while loop was never executed.

To shouldn't you get every result manually. I think you should do something like:

echo "<table>n<tr><th>Field</th><th>Value</th></tr>n";
foreach(mysql_fetch_assoc($result) as $key => $value)
{
echo "<tr><td>$key</td><td>$value</td></tr>n"
}
echo "</table>";

I didn't test it, but it should work (for one result, if there are more result you should format the table different).

Anonymusius 5 Posting Whiz in Training

Very sorry to bother you, I forgot to add $this->free = true; to the free function, and because of that the class tried to free the result again in the destructor.

Very sorry for the triple post. Feel free to delete this if you have the power to do so.

Anonymusius 5 Posting Whiz in Training

The code owrked when I took it appart, but when I added the mysql_num_row function it crashed:

<?php
mysql_connect('localhost','anonymusius','fake password, so not my real one');
mysql_select_db('anonymusius2');

class query
{
    var $query;
    var $result;
    var $free;

    function query($query)
    {
        $this->query    = $query;
        $this->free     = false;
        $this->result   = @mysql_query($this->query) or die('Error in mysql query:<br />\n' . mysql_error());
    }
    
    function __destruct()
    {
        if($this->free === false){$this->free(); echo "You forgot to free the query result"; $this->free = true;}
    }

    function array_result()
    {
        for($a = 0; ($b = mysql_fetch_array($this->result, MYSQL_ASSOC)) !== false; $a++)
        {
            $array[$a] = $b;
        }
        
        return $array;
    }

    function get_result()
    {
        return $this->result;
    }
    
    function num_rows()
    {
        return @mysql_num_rows($this->result) or die("Error in mysql_num_rows: " . mysql_error());
    }
    
    function free()
    {
        @mysql_free_result($this->result) or die("Error while free-ing result.<br />\nMysql error: " . mysql_error() . "<br />\nObject info:<br />\n" . print_r($this, true));
    }
}

$query = new query("SELECT `style_name`, `style_path` FROM `style` WHERE `style_id`='1'");
echo "Mysql_num_rows(" . $query->num_rows() . ");<br />\n";
print_r($query->array_result());
$query->free();
?>

and I got the error:

Mysql_num_rows(1);
Array (
     [0] => Array
         (
             [style_name] => Basic
             [style_path] => basic 
        )
  ) Error while free-ing result.
Mysql error: 
Object info:
query Object (
     [query] => SELECT `style_name`, `style_path` FROM `style` WHERE `style_id`='1'
     [result] => Resource id #3
     [free] =>
  )
Anonymusius 5 Posting Whiz in Training

I'm learning Object OrĂ¯ented PHP (or whatever you like to call it) and I ran into a problem.

I made this query class:

class query
{
    var $query;
    var $result;
    var $free;

    function query($query)
    {
        $this->query    = $query;
        $this->free     = false;
        $this->result   = @mysql_query($this->query) or die('Error in mysql query:<br />\n' . mysql_error());
    }
    
    function __destruct()
    {
        if($this->free === false){$this->free(); echo "You forgot to free the query result"; $this->free = true;}
    }

    function array_result()
    {
        for($a = 0; ($b = mysql_fetch_array($this->result, MYSQL_ASSOC)) !== false; $a++)
        {
            $array[$a] = $b;
        }
        
        return $array;
    }

    function get_result()
    {
        return $this->result;
    }
    
    function free()
    {
        @mysql_free_result($this->result) or die("Error while free-ing result.<br />\nObject info:<br />\n" . print_r($this, true));
    }
}

When I execute it I got an error:

Error while free-ing result.
Object info:
query Object (
    [query] => SELECT `style_name`, `style_path` FROM `style` WHERE `style_id`='1'
    [result] => Resource id #4
    [free] =>
)

I don't understand what the error in the code is. I do know this class is mostly useless. It was more to train then to use. The error message if you don't free your query in the destructer is because I want to learn myself to free everything everytime, because some language's require that.

Anonymusius 5 Posting Whiz in Training

Well if you search for Anonymusius in images you get nothing, if you search for anonymous you get link.

Pretty funny, It never happened to me that the name Anonymusius was taken, I guess it's pretty unique. If I search for Anonymusius on google I get al kind of results of forums I ever posted on and highscores I ever made :P. Pretty funny (didn't wade through all, so not sure it's all me).

Now I'm wading though it I see my nick is on http://www.coolestnickname.com/index.php/11-Dec-2006/4 :P

Anonymusius 5 Posting Whiz in Training

you are right :sad:

Anonymusius 5 Posting Whiz in Training

Look! some billion pages marred because FUNNY google adsense!

Anonymusius 5 Posting Whiz in Training

Yes, some several BLOGS flooded by horrible google intellitxt

Anonymusius 5 Posting Whiz in Training

I once read:

There are 10 kind of people, those who know binary and those who doesn't

liked that one. Mine is not really original.

Anonymusius 5 Posting Whiz in Training

>>cout << "<input type="text" name="firstname"> " << endl;
That line is ill-formed. count the quotes and you will find that the word text is NOT within quotes.
This is probably what you want

cout << "<input type=" << text << " name=" << firstname << "> " << endl;

I think he rather wants to escape the first quote's since there is no variable text and in HTML wouldn't it make a whole lot of sense to make varaible's on that place differ from time to time. To is differing of the formname's in HTML a bad idea. If you want to send the name with it in the form use hidden fields or something.

cout << "<input type=\"text\" name="firstname"> " << endl;

I think that's what you want

BTW, in HTML I thought it was better to end your input thing's with />, so that would make <input type="text" name="lol" />
If you wanted to set the textfield to the firstname it would be:
<input type="text" name="firstname" value="Default value, you should cout the firstname then here" />

Anonymusius 5 Posting Whiz in Training

cocktails are on their best when the mixture is perfect.

Anonymusius 5 Posting Whiz in Training

anymore cheese and I'm gonna throw up.

Anonymusius 5 Posting Whiz in Training

I'm from the Netherlands, the xth generation, but I put ketchup on everything (except on 'pomme frites', that's good with Mayonnaise ;))

Anonymusius 5 Posting Whiz in Training

with his evil

Anonymusius 5 Posting Whiz in Training

Did he said

Anonymusius 5 Posting Whiz in Training

That tastes eactly like red catchup to me anyways... Havent had too much of it though....

It tasted different for me. I think you to taste with your vision and nose.

I only had it once, I like the red one more :P

Anonymusius 5 Posting Whiz in Training

I don't really care when your birthday is, I'm gonna wish you happy birthday anyway!

Happy birthday!

Anonymusius 5 Posting Whiz in Training

I mostly listen to rap, currently there are some nerd rappers who make so called "nerdcore" where I listen a lot to.

Link to nerdcore song, I just love the C++ reference :P. It are the lyrics but click on download song to hear it. There isn't that much good nerdcore though.