Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. if you mean insert first found then try this <html> <head> <link href="interface design/css.css" rel="stylesheet" type="text/css"> </head> <body class="bg"> <?php $datein=$_POST['check-in-date']; $dayin=$_POST['check-in-day']; $r_type=$_POST['r_category']; $pac=$_POST['special']; $checkin = "$datein-$dayin" ; $nyt=$_POST['nyts']; $id=$_COOKIE['ID']; mysql_connect('localhost', 'root', 'tmc') or die(mysql_error()); mysql_select_db('tgp') or die(mysql_error()); $room= mysql_query("SELECT r_no FROM room WHERE r_no ='$r_type'")or die(mysql_error()); $found = false; while ($row = mysql_fetch_assoc($room) || !$found) { $room = $row["r_no"]; //ive got error here in this line if(!mysql_query ("INSERT INTO reservation VALUES ('0','$checkin', '$nyt', '$room', '$pac', '$id')")) { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print '<b>reservation failed</b>'; print '</div>'; } else { $found = true; print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print 'Your Information has been successfully added to the database.'; print '<br><br>'; $result=mysql_insert_id(); print "Your Reservation No. is <b>$result</b>"; print '</div>'; } } mysql_close(); ?> </body> </html> if you mean insert all 3 <html> <head> <link href="interface design/css.css" rel="stylesheet" type="text/css"> </head> <body class="bg"> <?php $datein=$_POST['check-in-date']; $dayin=$_POST['check-in-day']; $r_type=$_POST['r_category']; $pac=$_POST['special']; $checkin = "$datein-$dayin" ; $nyt=$_POST['nyts']; $id=$_COOKIE['ID']; mysql_connect('localhost', 'root', 'tmc') or die(mysql_error()); mysql_select_db('tgp') or die(mysql_error()); $room= mysql_query("SELECT r_no FROM room WHERE r_no ='$r_type'")or die(mysql_error()); while ($row = mysql_fetch_assoc($room) ) { $room = $row["r_no"]; //ive got error here in this line if(!mysql_query ("INSERT INTO reservation VALUES ('0','$checkin', '$nyt', '$room', '$pac', '$id')")) { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print '<b>reservation failed</b>'; print '</div>'; } else { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print 'Your Information has been successfully added to the database.'; print '<br><br>'; $result=mysql_insert_id(); print "Your Reservation No. is <b>$result</b>"; print '</div>'; } } mysql_close(); ?> </body> </html> EDIT updated as a note i think your doing this the wrong way.. to start with
  2. OK a reserved-word mean it has a use, so you can not use it as a field name, table, etc, unless you use backticks ie $sql="UPDATE $tbl_name SET comentario='$comentario' WHERE id='$id'"; is fine (trust me on that) but $sql="UPDATE $tbl_name SET UPDATE='$comentario' WHERE id='$id'"; would be wrong.. as UPDATE has a special meaning (thus its reserved), the the 2nd would confuse mySQL thus causing an error
  3. erm.. what? please explain what your trying to do here ?
  4. how does the system know their logged inn!!!! is their user id stored some where ?
  5. this may work, (can't read back, my head is killing me) if ( count($errors[0])>0 && count($errors[1])>0 && count($errors[2])>0 ) { the proble because you have 3 arrays and each have been set to the $errors array has 3 values $user_errors[], $pass_errors[] & $email_errors[], and each of them have values (even if they blank) the above code should work, if the 3 arrays are empty (not blank but empty) personally i would only use 1 array and put all error in that.. i hope this helps
  6. can you click solved bottom left let close this sucker .. Ok mu headack is getting to me now.. better laydown!
  7. yes. read the page in and filter the data you want (RegEx) then create an image from it image example <?php header("Content-type: image/png"); $im = @imagecreate(110, 20) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 0, 0, 0); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, "A Simple Text String", $text_color); imagepng($im); imagedestroy($im); ?>
  8. try <html> <head> <link href="interface design/css.css" rel="stylesheet" type="text/css"> </head> <body class="bg"> <?php $datein=$_POST['check-in-date']; $dayin=$_POST['check-in-day']; $r_type=$_POST['r_category']; $pac=$_POST['special']; $checkin = "$datein-$dayin" ; $nyt=$_POST['nyts']; $id=$_COOKIE['ID']; mysql_connect('localhost', 'root', 'tmc') or die(mysql_error()); mysql_select_db('tgp') or die(mysql_error()); $room= mysql_query("SELECT r_no FROM room WHERE r_no ='$r_type'")or die(mysql_error()); $room = $room['r_no']; //ive got error here in this line if(!mysql_query ("INSERT INTO reservation VALUES ('0','$checkin', '$nyt', '$room', '$pac', '$id')")) { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print '<b>reservation failed</b>'; print '</div>'; } else { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print 'Your Information has been successfully added to the database.'; print '<br><br>'; $result=mysql_insert_id(); print "Your Reservation No. is <b>$result</b>"; print '</div>'; } mysql_close(); ?> </body> </html>
  9. OK fine, try this if ($errors) { echo "<h3>The following errors occured</h3><br>"; foreach ($errors as $err) { foreach ($err as $e) { echo $e; } } } else { echo "You've successfully been added to the db"; }
  10. Maybe see comments <table width="100%" border="0" cellspacing="0" cellpadding="4" class="tblList"> <tr class="songTitle"> <td width="20%">Time</td> <td width="30%">Comment</td> <td width="20%">Mood</td> <td width="20%">Customer</td> <td width="20%">Delete\Edit</td> </tr> <?php //updated if($results > 0){ for ($i=0; $i<count($results); $i++){ ?> <tr> <td align="center" class="tdlisting"><span class="copyText"><?php echo $results[$i]['time']; ?></span></td> <td align="center" class="tdlisting"><span class="copyText"><?php echo $results[$i]['comment']; ?></span></td> <td align="center" class="tdlisting"><span class="copyText"><?php echo $results[$i]['mood']; ?></span></td> <td align="center" class="tdlisting"><span class="copyText"> <?php echo $results[$i]['customer_id']; ?></span></td> <?php //changed //if($_GET['customer_id']==$db->mySQLSafe($_POST['edit']) ) //I think.. kinda hard to read your code if($_GET['customer_id']==$db->mySQLSafe($_POST['edit']) && $_GET['customer_id']==$results[$i]['customer_id'] ) { ?> <td align="center" width="10%" class="tdlisting"><a href="?delete=<?php echo $results[$i]['comment_id']; ?>" class="txtLink">Delete</a>\<a href="?edit=<?php echo $results[$i]['comment_id']; ?>&customer_id=<?php echo $results[$i]['customer_id']; ?>&productId=<?php echo $results[$i]['productId']; ?>&comment_id=<?php echo $results[$i]['comment_id']; ?>" class="txtLink">Edit</a> </td> <?php }else{ echo '<td align="center" width="10%" class="tdlisting"> Nope! </td>';}?> </tr> <?php } // end loop ?> </table>
  11. you have an array in an array.. so function check_user($username) { $user_errors = array(); // Check if taken $taken = mysql_query("SELECT * FROM users WHERE username = '$username'"); if (mysql_num_rows($taken)) $user_errors[] = "Username already exists"; // Check if it is the proper length if ((strlen($username) > 12) || (strlen($username) < 6)) $user_errors[] = "Username must be between 6 and 12 characters"; // Return the errors return $user_errors; } should be function check_user($username) { $user_errors = ""; // Check if taken $taken = mysql_query("SELECT * FROM users WHERE username = '$username'"); if (mysql_num_rows($taken)) $user_errors = "Username already exists"; // Check if it is the proper length if ((strlen($username) > 12) || (strlen($username) < 6)) $user_errors[] = "Username must be between 6 and 12 characters"; // Return the errors return $user_errors; }
  12. LOL, i'll settle for you clicking solved (bottom left)
  13. erm.. thanx but no reserved-words are used in the sql statement!
  14. please use code tags.. too much of a pain to read that!
  15. $GLOBALS[$data] is an ARRAY so you need to treat it like one.. ie foreach($GLOBALS[$data] as $ndata) { echo $ndata; } edit: as a note for the ID use $GLOBALS[$data]['id']
  16. probably the pesky global reg's.. <?php include('includes/db_inc.php'); if(isset($_POST['submit'])) // name of submit button { //Need to filter this.......... $username = $_POST['username']; $password = $_POST['password']; //SQL injection detected here.. Filter the above $sql = "SELECT * FROM merc_users WHERE username='$username' AND password='$password'"; $result = mysql_query($sql); $isAuth = false; while ($row = mysql_fetch_array($result)) { if($row['username'] == $username) { $isAuth = true; @session_start(); session_register('username'); } } } ?> </head> <body topmargin="0" leftmargin="0"> <table width="800" height="489" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="19%" rowspan="3" bgcolor="#B7CA33" scope="col"><img src="images/global_nav_bg.gif" width="152" height="600" hspace="0" vspace="0" /></td> <th width="81%" height="56" nowrap="nowrap" scope="col"><div id="Layer4"><img src="login/images/login_header.gif" width="648" height="316" /></div></th> </tr> <tr> <td height="80"><p> </p> <p> </p> <p> </p></td> </tr> <tr> <td height="79"><form action="index.php" method="post" enctype="multipart/form-data"> <p> <?php if ($isAuth && isset($_POST['submit'])) { printf("<div id=\"system\" align=\"center\">You have logged in successfully. <a href=\"layout.php\">Go to Layout selection</a></div>"); } else if (!$isAuth && isset($_POST['submit'])) { printf("<div id=\"system\" align=\"center\">Login unsuccessful. Check your details and <a href=\"index.php\">try again</a></div>"); } if (!isset($_POST['submit'])) { echo("<table width=\"33%\" height=\"101\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\"> <tr> <td height=\"58\" scope=\"col\"><p align=\"center\">Username <input name=\"username\" type=\"text\" class=\"loginText\" size=\"15\" maxlength=\"15\" /> <br /> <br /> Password <input name=\"password\" type=\"password\" class=\"loginText\" size=\"15\" maxlength=\"15\" /> </p></td> </tr> <tr> <td scope=\"col\"><div align=\"center\" ><input type=\"image\" src=\"login/images/login_btn.gif\" alt=\"Submit\" name=\"submit\" type=\"submit\" value=\"login\"></div></td> </tr> </table>" } ?>
  17. if their on the same level then require_once "meta_tags.inc"; or require_once dirname(__FILE__)."/meta_tags.inc"; should work
  18. Please use the code tag (#) button or [.code] [/.code] (no dot) Not working, doesn't help.. what doesn't work? what about a simple approach <?php $time = time() + 3600; setcookie("ID",$_POST['id'], $time); setcookie("pass",$_POST['password'], $time); ?> <html> <head> <link href="interface design/css.css" rel="stylesheet" type="text/css"></head> <body> <?php #connect to MySQL Server @mysql_pconnect('localhost', 'root', 'tmc') or die(mysql_error()); #connect to database @mysql_select_db('tgp') or die(mysql_error()); //if the login form is submitted // if form has been submitted // makes sure they filled it in if(isset($_POST['id']) && isset($_POST['password'])) { // checks it against the database //need to add a filter here $pass = $_POST['password']; $id = $_POST['id']; $query = mysql_query("SELECT * FROM login WHERE id = '$id' AND password = '$pass'")or die(mysql_error()); //Gives error if user dosen't exist $row = mysql_num_rows($query); if ($row == 0) { ?> <p class="error">Unauthorized Personnel</p> <?php print "Oppps";} }else{ $user = mysql_fetch_array( $query ); echo "<script>"; switch(strtolower($user['userlevel'])) { default: $page = "login2.html"; break; case "admin": $page = "interface design/home.html"; break; case "staff": $page = "interface design/room.html"; break; case "user": $page = "interface design/member.html"; break; } echo " window.location=\"$page\""; echo "</script>"; } }else{ ?> <p class="error">Login Failed!<br>Please Type your Username and Password agian!</p> <?php } ?> //untested
  19. I could be a PHP file just parsing a GIF.. bu you said But NOW.. Yet if you had local access to the php file your probably see the code!!
  20. the best one for, speed and bandwidth as it, stops when it finds the title.. the other read in the whole page..
  21. parser the index file of the site and read the title in <title>blar</title> something like this <?php $HTML = file_get_contents("http://www.phpfreaks.com"); preg_match_all('%<title>([^<]*)</title>%i', $HTML, $result, PREG_PATTERN_ORDER); $result = $result[0]; echo $result; ?> EDIT: LOL, and the winner is haaglin, for his snip from PHP.NET, which proves better that the other two LOL
  22. worst case, try this i assume at the location of the current file is below the includes folder require_once dirname(__FILE__)."/includes/meta_tags.inc";
  23. the "table" probably doesn't exist, is it the exact same error
  24. is the mySQL table called "Table" ? $query = "SELECT * FROM table LIMIT $limitvalue, $limit"; $query_count = "SELECT count(*) FROM table";
×
×
  • 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.