Jump to content


  • Posts

  • Joined

  • Last visited


Posts posted by cmgmyr

  1. How come you didn't make the form? It seems simple enough to do...


    I had one experience with an outsource company the I hired...I had this one project that was really just a pain in the ass and I didn't feel like working on it anymore, plus didn't have the time so I decided to look for someone to finish it. So I put an ad up through guru.com and found a company that sounded half way decent. In the project description I clearly put "This needs to be done within 1-2 weeks at the most...please do not bid if you can not complete this within that time frame" Simple right? Well after I got half the money in escrow (that day) I sent him more detailed information and told him to let me know it he needed anything else. After a week went by I finally heard back from him and he was asking simple/dumb questions, I answered those so he could move one. 2 weeks went by, 3 weeks went by...on the 5th week of bearly hearing from him my client despirately needed this project done. So I had to stay up all night (after working a regular 9 hour day) to finish this stupid project. Needless to say he didn't get paid.


    moral of the story: just do it yourself, it's a lot easier, and NEVER pay anyone until you have a finished product that works like what was agreed to in the initial contract.

  2. I have a private messaging system on my site right now thats pretty simple and gets the job done. But I want to make it better and more efficient.


    Right now I have:

    CREATE TABLE `mail` (
      `mid` int(11) NOT NULL auto_increment,
      `uidto` int(11) NOT NULL default '0',
      `uidfrom` int(11) NOT NULL default '0',
      `subject` text NOT NULL,
      `message` text NOT NULL,
      `status` tinyint(1) NOT NULL default '0',
      `status2` tinyint(1) NOT NULL default '0',
      `date` datetime NOT NULL default '0000-00-00 00:00:00',
      PRIMARY KEY  (`mid`)

    for the database. What I'm doing is if you reply to a message it puts the last message below it and you type your new message on top

    This is my reply
    This is this original

    so as you can imaging after a few messages back and fourth the body of the message gets pretty big.


    What I want to do is set it up kind of like Facebook. Having parent_id's for messages and having a recursive function flip through them all in a "conversation" instead of having the whole conversation in one DB entry.


    What do you think about doing this the new way with the recursive function? Do you forsee any problems with this? Any other ideas that you would like to pass along?




  3. I tried to do this (which i don't know if its right)

    $_SESSION['customers_id'] = $customers_id;   
    $_SERVER['SSL_SESSION_ID'] = $customers_id; 


    and this for my user checking

    function getUser(){
    	if(isset($_SESSION['customers_id'])) return $_SESSION['customers_id'];
    	if(isset($_SERVER['SSL_SESSION_ID'])) return $_SERVER['SSL_SESSION_ID'];


    It didn't work with this set up. Any ideas?

  4. Ok, i have a site that uses both http and https. I have the login on the http side and once I go to checkout items (in the https side) I get re-directed to the login page (which is supposed to happen when someone isn't logged on). I only get redirected in FF and Opera, IE works fine...go figure. Anyways...how can I use the same session information on both sides?




  5. isn't the point of email supposed to be fast??? I don't want to play a game and go swimming everytime I want to send an email :)



    ...you must have to be pretty bored to use this.

  6. good advise roop. I have some more for you too. What I like to do is to think of what I use all the time. Like clean4DB for example. If I will be using a function a lot, or if it's something fairly complex I will put it into a class. Even something as simple as formatting numbers can help you a lot, and if you design them right they can be pretty helpful.


    For example I have

    function curFormat($price, $dec=2){
    	return number_format($price, $dec);

    in that same functions class that I showed you earlier. So whenever I have a number that I want to format I use



    So if I do

    $number = 150;
    echo $func->curFormat($number);
    //echos 150.00


    Now say I calculate how long a page takes to load. it would look like this

    $page_time = 0.005653133;
    echo $func->curFormat($page_time, 6);
    //echos 0.005653


    See how you can easily adapt a simple function to apply to more then one purpose? if so...now you have the idea of OOP!

  7. Here is what I usually do...


    $rownum = 0;
    while($row = $db->fetch($result)){
    //DB stuff here
    $tr = $rownum % 2;
    echo "<tr class=\"tr".$tr."\">";
    //out put information
    echo "</tr>";


    in the css



    ...something like that, hope it helps

  8. Then wouldn't you want this:


    }elseif($count == 1){ 
    while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
    $site = $row['redirect_url'] ;
    echo "<META HTTP-EQUIV=Refresh CONTENT=\"2; URL=$site\">";


    because if you have more then 1 row returned you want a link, not a refresh.

  9. i usually have a "functions" class that I have all of that misc stuff in. Here is a really simple example:

    //This file holds the main functions
    class func{
    //Clean user input for the DB queries
    function clean4DB($input){
    	$output = mysql_real_escape_string($input);
    	return $output;
    $func = new func();
    $string = "This is a member's bad input";
    $cleaned = $func->clean4DB($string);
    //Now you can put $cleaned in a DB

  10. take a quick look at: http://www.stargeek.com/php_login_tutorial.php


    I changed a couple things around (not tested) but I think you will get the idea.

    class login(){
    function MakeTableLogins($database, $host, $db_user, $db_pass) {//create the logins table
    	$linkID = mysql_connect($host, $db_user, $db_pass); 
    	mysql_select_db($database, $linkID); 
    	mysql_query("create table logins (user char(32), pasword char(32))", $linkID); 
    function Encrypt($string) {//hash then encrypt a string 
    	$crypted = crypt(md5($string), md5($string));
    	return $crypted;
    function AddUser($database, $host, $db_user, $db_pass, $username, $password) { //add user to table logins 
    	$linkID = mysql_connect($host, $db_user, $db_pass);
    	mysql_select_db($database, $linkID);
    	$password = $this->Encrypt($password);
    	$username = $this->Encrypt($username);
    	mysql_query("insert into logins values ('$username', '$password')", $linkID);
    function Login($database, $host, $db_user, $db_pass, $user, $password) { //attempt to login false if invalid true if correct 
    	$auth = false;
    	$user = $this->Encrypt($user);
    	$linkID = mysql_connect($host, $db_user, $db_pass);
    	mysql_select_db("$database", $linkID);
    	$result = mysql_query("select password from logins where user = '$user'", $linkID);
    	$pass = mysql_fetch_row($result);
    	if ($pass[0] === ($this->Encrypt($password))){
    		$auth = true;
    	return $auth;
    $l = new login();
    $password = 'test12345';
    $new_password = $l->Encrypt($password);
    echo "This is your new password: ".$new_password;


    then you can apply it pretty much to anything else. Obviously you should clean up the functions alot, there's no reason to pass DB login information that many times...but I think you'll get it.


    hope that helps

  • 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.