Jump to content

deadmann

Members
  • Posts

    3
  • Joined

  • Last visited

deadmann's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. hello, i'm new to php... i like to design a form, which receive feedback. the proces is like this: 1.i check cookie if exist, i dont ask any more for feedback 2.if not exist, i check for session, cause all action and form are in same page... if session empty or not exist, i send user to form... else if is set, i send him for validate data, and if data is valid, for data registeration. the problem i face, is it show me success msg, but there's no record once i check my mySQL tables... table = > mrl_feedback Fields => id int auto_increment not null name tinytext email tinytext message text [[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]] The code is belo this msg: [[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]] <?php define('HOST_NAME', 'localhost'); define('USERNAME', 'deadmann_*******'); define('PASSWORD', '*******************'); define('DATABASE', 'deadmann_**********'); if(isset ($_COOKIE['MRLFeedbackPassed']) ) { echo'<html><head></head>' .'<body bgcolor="black"><font color="white">' .'<H1>Multi-realm Launcher</H1></font></body></html>'; } else { session_start(); if(isset ($_SESSION['mrl_feedback']) && ($_SESSION['mrl_feedback']!='')) { if (isset ($_POST['msg']) && (!empty ($_POST['msg'])) && (strlen($_POST['msg'])>5) ) { if(! mysql_connect(HOST_NAME, USERNAME, PASSWORD)) { die('<html><head></head>' .'<body bgcolor="black"><font color="white">Cannot connect to ' .'server.</font></body></html>'); exit; } if(! mysql_select_db(DATABASE)) { die('<html><head></head>' .'<body bgcolor="black"><font color="white">Cannot connect to ' .'database.</font></body></html>'); exit; } mysql_query("insert into mrl_feedback (name,email,message) " ."values ({$_POST['name']},{$_POST['email']}" .",{$_POST['msg']})"); mysql_close(); setcookie('MRLFeedbackPassed','is set',time()+60*60*24*365,'/','deadmann.heliohost.org',TRUE); echo '<html><head></head>' .'<body bgcolor="black"><font color="white">Your feed back ' .'has been send successfully.</font></body></html>'; } else { if( (!isset ($_POST['msg'])) || (empty ($_POST['msg']))) { header("Location: feedback.php?error=1"); $_SESSION['mrl_feedback']=''; exit; } else if(isset ($_POST['msg']) && (strlen($_POST['msg'])<=5)) { header("Location: feedback.php?error=2"); $_SESSION['mrl_feedback']=''; exit; } } } else { ?> <html> <head></head> <body bgcolor="black"> <form action="<?php echo $GLOBALS['PHP_SELF']?>" method="post"> <table> <tr> <td><font color="white">Name:</font></td> <td><input type="text" name="name"/></td> <td rowspan="2"> <?php if(isset ($_GET['error'])) { if($_GET['error']==1){ echo '<font color="red">*You must fill<br/> message field.</font>'; } else if($_GET['error']==2){ echo '<font color="red">*Message<br/> length is<br/> too low.</font>'; } else { echo '<font color="green">Feedback</font>'; } } else { echo '<font color="green">Feedback</font>'; } ?> </td> </tr> <tr> <td><font color="white">Email:</font></td> <td><input type="text" name="email"/></td> <td></td> </tr> <tr> <td><font color="white">Message:</font></td> <td><input type="text" name="msg"/></td> <td><input type="submit" value="Send"/></td> </tr> </table> </form> </body> </html> <?php $_SESSION['mrl_feedback']='is set'; } } ?>
  2. Issue fixed... Oh sry man, the matter was about i search over internet to find the connection, so once i see people used steive... i though the server they used is same to the one i use, and i never could imagine that even the other server which say provide nothing special for it's user can have a MySQL lunched over it... so now, i tried to check if my website is up and the required time passed, then after see nothing happened, i clicked on viewing cPanel, and "BOOM" the url bar say johnny... don't tell me both server have MySQL, and i tried to connect with johnny instead of steive and success
  3. Hello there, i'm new user, trying to connect to my sql with remote connection from my computer, through navicat application,... I already make a user name inside cPanel.. also allow my home ip, the public Ip google say, and in the end any thing domain % to access... i'm wonder if i try to connect with currect Port, but the thing i use is 3306. I receive : 2003 - Can't connect to MySQL server on 'stevie.heliohost.org' (10060) i also try the thing you see in attachment
×
×
  • Create New...