Jump to content

Recommended Posts

Hello everyone,

 

I've never formally introduced myself, and what with this new style and all I figured I'd take the opportunity and say hello. I've been a forum stalker for a while now and have only posted when my other communities draw a blank.

 

First, my name is Steven. I'm a 16 year old self-taught web developer from Colorado, USA. I have 5 years with (X)HTML and CSS, and almost 5 with PHP. I never really succeed at getting a decent site up and maintaining it, so I generally let my server sit around and do nothing but store random files for me. :D I've most recently become addicted to MyBB development, and I've been wasting a fair amount of hours developing plugins and other random stuff for it.

 

I have OCD and will probably rewrite your code if you have horrendous code practices, even if I have nothing to contribute. I'm a pretty big Grammar Nazi as well. I hope I'll fit in somewhere here. ;)

 

With all due respect,

Steven

Link to comment
https://forums.phpfreaks.com/topic/184140-never-formally-introduced-myself/
Share on other sites

PHP at 11 huh? Something tells me this was more along of declaring variables and adding them together type PHP? Aka, you didn't really know what you were doing?

 

My compliments if you understood what you were doing at 11 though. I know I never would have been able to.

PHP at 11 huh? Something tells me this was more along of declaring variables and adding them together type PHP? Aka, you didn't really know what you were doing?

 

My compliments if you understood what you were doing at 11 though. I know I never would have been able to.

 

haha, from what I remember it wasn't anything special; just experimentation. I'll hit up the archives of the forum I was on at that time and see if I can find what the hell I was doing. :D

 

Ha... you better watch out now. I'll hunt your topics with comments on your code style and quality :anim_reading:

 

Anyways, welcome :hail_freaks:

 

haha, I'll be sure to tailor my practices just for you. ;)

 

Thanks everyone!

Welcome to the phpfreaks, grammer nazi, Altec ;)

 

Glad to see some people who are not lazy in writing and actually care about how they present themselves. Granted, by divulging that you have OCD and will rewrite poor code, you've done two things; a) run the risk of driving yourself nuts as there is plenty of poor code to go around, and b) in essence painted a large target on your back for those who are knowledgeable enough in good coding practices and have read this thread. Something tells me you'll be watched more closely now (as Dan mentioned). No pressure. lol

 

In any case, I'm sure you'll fit in nicely here.  :D

 

Cheers

Welcome to the phpfreaks, grammer nazi, Altec ;)

 

Glad to see some people who are not lazy in writing and actually care about how they present themselves. Granted, by divulging that you have OCD and will rewrite poor code, you've done two things; a) run the risk of driving yourself nuts as there is plenty of poor code to go around, and b) in essence painted a large target on your back for those who are knowledgeable enough in good coding practices and have read this thread. Something tells me you'll be watched more closely now (as Dan mentioned). No pressure. lol

 

In any case, I'm sure you'll fit in nicely here.  :D

 

Cheers

 

Thanks. :D I hope people don't kill me too much.

Whoaoohahahaha (or whatever an evil laugh looks like in writing)...

 

Anyway, I assume you know die() for error handling is frowned upon?

 

I'm really at a loss as to why this is happening. Here is my code:

<?php

mysql_connect('localhost','user','pass') or die('Error connecting to database: '.mysql_error());
mysql_select_db('database') or die('Error selecting database: '.mysql_error());

if(isset($_POST['submit']) && $_SERVER['REQUEST_METHOD'] == "POST") {
     $ipcheck = "SELECT `ip` FROM `iplog`";
     $ips = mysql_fetch_array(mysql_query($ipcheck));
     foreach($ips as $ip) {
         if(stristr($ip,$_SERVER['REMOTE_ADDR'])) {
             die('You have already signed.');
         }
     }
     
     function clean($string) {
         $string = trim(stripslashes(strip_tags($string)));
         return $string;
     }
     
     foreach($_POST as $key => $value) {
         $data[$key] = clean($value);
     }
     
     if(empty($data['name'])) {
         die('Name is a required field.');
     } if(empty($data['comments'])) {
         $data['comments'] = 'No comment.';
     }
     
     $namecheck = "SELECT `name` FROM `signatures`";
     $namelist = mysql_fetch_array(mysql_query($namecheck));
     foreach($namelist as $names) {
         if(stristr($names,$data['name'])) {
             die('You have already signed.');
         }
     }
     
     $data['ip'] = $_SERVER['REMOTE_ADDR'];
     $data['timestamp'] = time();
     
     $data['name'] = mysql_real_escape_string($data['name']);
     $data['comments'] = mysql_real_escape_string($data['comments']);
     
     $ipquery = "INSERT INTO `iplog` (name,ip,timestamp) VALUES ('{$data['name']}','{$data['ip']}','{$data['timestamp']}')";
     mysql_query($ipquery) or die('Error inserting IP into log: '.mysql_error());
     
     $query = "INSERT INTO `signatures` (name,comments,timestamp) VALUES ('{$data['name']}','{$data['comments']}','{$data['timestamp']}')";
     mysql_query($query) or die('Error inserting signature: '.mysql_error());
     
     header("Location: http://www.tf2petition.phreakyourgeek.com/index.php?show=1");
}

?>

As you can see from 487 and the following signatures, something is wrong:

 

www.tf2petition.phreakyourgeek.com/index.php?page=7

 

I should probably get this fixed as traffic is incredibly high right now, but I don't see a loophole or a bug that would cause someone to be able to post four times. frown.gif Database structure for the iplog table is:

 

www.media.phreakyourgeek.com/db_structure.png

 

I count 7 of them. But, without having seen any code from MyBB, I imagine it is a big fat mess as well.

Whoaoohahahaha (or whatever an evil laugh looks like in writing)...

 

Anyway, I assume you know die() for error handling is frowned upon?

 

I count 7 of them. But, without having seen any code from MyBB, I imagine it is a big fat mess as well.

 

Actually, I started MyBB development a while after that post and the development standards drastically changed my personal style. The actual MyBB code is actually pretty clean, although a majority of it goes against their own development standards. :P

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.