Search found 33 matches

by Payton
Thu Jul 01, 2010 1:18 pm
Forum: PHP - Code
Topic: Run query inside a loop statement
Replies: 6
Views: 1591

Re: Run query inside a loop statement

Are you doing anything to filter the search query? I suggest mysql_real_escape_string. You'll probably want to do more to filter it, though.
by Payton
Wed Jun 30, 2010 1:03 pm
Forum: PHP - Code
Topic: Loop question
Replies: 4
Views: 150

Re: Loop question

Ah, right, thanks for pointing that out to me.
by Payton
Wed Jun 30, 2010 12:43 am
Forum: PHP - Code
Topic: Loop question
Replies: 4
Views: 150

Re: Loop question

Don't use a for loop. Just a simple foreach that break s out if the connection works. $connected = false; foreach ($servers as $server) { // do whatever // if (it connected and everything worked) { $connected = true; break; // } } if ($connected) { // all good } else { // ran out of servers to chec...
by Payton
Tue Jun 29, 2010 10:10 pm
Forum: The Enterprise
Topic: A rant about this guy's "services"
Replies: 4
Views: 6953

Re: A rant about this guy's "services"

Those are very good points and have changed a lot of my feelings toward the situation. I'll consider all of that.
by Payton
Tue Jun 29, 2010 10:07 pm
Forum: PHP - Code
Topic: Loop question
Replies: 4
Views: 150

Loop question

Okay, so here's what I'm trying to do: Using a file that stores an array of connection data with their respective ID(s), I want to start a socket connection. However, if the default connection fails, I want there to be a loop that adds one to the most recent connection's ID, and then attempts to rec...
by Payton
Fri Jun 25, 2010 1:19 am
Forum: The Enterprise
Topic: A rant about this guy's "services"
Replies: 4
Views: 6953

Re: A rant about this guy's "services"

You're jealous because this guy is making a good living with relatively little effort. Is it ethical? Maybe not. Is there really much you can do? No. Focus on you. Have you heard the saying "you do you, im going to do me"? You need to worry about what you're doing not what this guy is doi...
by Payton
Fri Jun 11, 2010 5:02 pm
Forum: The Enterprise
Topic: A rant about this guy's "services"
Replies: 4
Views: 6953

A rant about this guy's "services"

First of all, please browse this website for a couple of minutes: http://anonym.to/hinctechal.com/ I could go on and on all day about the way "his" website looks, but that's not really why I'm making this topic. I am making this topic to present some questions to you guys (and for the sake...
by Payton
Tue Jun 08, 2010 2:21 am
Forum: PHP - Code
Topic: [Challenge - Beginner] Database Connection
Replies: 15
Views: 2533

Re: [Challenge - Beginner] Database Connection

Here's a MySQL connection method I've been meaning to test... index.php <?php $directory = dirname(__FILE__); require("./{$directory}/config.php"); $con = mysql_connect($db['host'], $db['user'], $db['pass']) or die('Connection failed: ' mysql_error()); mysql_select_db($db['name'], $con) or...
by Payton
Tue Jun 08, 2010 2:05 am
Forum: PHP - Code
Topic: Sending separate threads with PHP?
Replies: 1
Views: 211

Sending separate threads with PHP?

Hi Devnetwork,

I was wondering how I would go about making a program that counts to, say, ten, but sends a different thread for each number. Would I have to incorporate this fork business and OOP, or are there other ways?
by Payton
Wed Apr 14, 2010 12:09 am
Forum: PHP - Code
Topic: Hey there PHPDN
Replies: 2
Views: 125

Re: Hey there PHPDN

Thanks, I'll look into all of that.
by Payton
Tue Apr 13, 2010 5:27 pm
Forum: PHP - Code
Topic: Hey there PHPDN
Replies: 2
Views: 125

Hey there PHPDN

Hey everyone. I feel like I've gotten past beginner coding (see the bottom of this post for some of my scripts) and would like to move to "better" coding. By better I mean: Slightly more challenging. A broader knowledge of functions and how they work. Something that ensures my sites will b...
by Payton
Wed Jan 06, 2010 10:43 pm
Forum: PHP - Code
Topic: General PHP question.
Replies: 18
Views: 1883

Re: General PHP question.

Since you offered I do have some questions. Sorry for bumping the topic.

Why do you write the variables like this?

Code: Select all

$username = (isset($_POST['username'])) ? $_POST['username'] : "";
    $password = (isset($_POST['password'])) ? $_POST['password'] : "";
by Payton
Tue Jan 05, 2010 10:16 am
Forum: PHP - Code
Topic: General PHP question.
Replies: 18
Views: 1883

Re: General PHP question.

Wow, that looks quite different. After reading everything you typed up there, I am kind of scared to even use my script. 8O I'll take a look over your modification and see what you did differently, thanks.
by Payton
Tue Jan 05, 2010 12:34 am
Forum: PHP - Code
Topic: General PHP question.
Replies: 18
Views: 1883

Re: General PHP question.

Okay, with everyone's help, this is the final product. <?php   /* Ramen Login script Version 1.0 Thanks to http://forums.devnetwork.net for their help :P */   include('../files/functions.php'); //Include our functions.   //Check to see if the form has been submitted. if (isset ($_POST['submit'])) { ...
by Payton
Mon Jan 04, 2010 11:26 pm
Forum: PHP - Code
Topic: General PHP question.
Replies: 18
Views: 1883

Re: General PHP question.

About the password encryption; would hashing the password ($hash = sha1($password);) and then switching $password in sprintf to $hash work? Here is the code: $username = mysql_real_escape_string($_POST['username']);         $password = mysql_real_escape_string($_POST['password']));                 $...