Jump to content

jaku78

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by jaku78

  1. Bumping this so people can see it, I'm patient, but people will not notice it if it's on the bottom of page 3.
  2. It's definately the while loop in the code, any ideas please?
  3. It's not a great idea to try that, it's possible to, but it's better to put the CC info in a POST method than a GET method in the first place, and if you were going to do something like that, you would want to make the CC info encrypted in some way with a good salt.
  4. I'm having some trouble with looping a sequence to get data from SQL to appear, I don't know if it's my technique to get it in PHP, but it always has the same information on each message if there is multiple messages, here is the code: <html> <head> <LINK href="style.css" rel="stylesheet" type="text/css"> <?php $title="Inbox"; require("navtemp.inc"); require("serverinfo.inc"); if (isset($_COOKIE['userid'])) { $username=$_COOKIE['username']; echo "Welcome ".$username." to your inbox!<br />"; echo "<a href='newPM.html' target='_blank'>Compose a new message</a><br />"; } else { die("Your not logged in! Log in!"); } $formset= <<<END <form action='deletemsg.php' method='post'> END; $tablehead = <<<END <table align='center'> <tr border='1'><td>FROM</td><td>SUBJECT</td><td>CREATED</td><td>DELETE</td><td>VIEW</td></tr> END; $tableend = "</table></div></body></html>"; echo $tablehead; $sql="SELECT * FROM myPM WHERE pmto='$username'"; $query=mysql_query($sql) or die(mysql_error()); $countbox=mysql_num_rows($query); if ($countbox > 0) { while ($countbox > 0) { $sql1="SELECT * FROM myPM WHERE pmto='$username'"; $query1=mysql_query($sql1) or die(mysql_error()); $msg1=mysql_fetch_assoc($query1) or die(mysql_error()); echo "<tr><td>".$msg1['pmfrom']."</td><td>".$msg1['pmtitle']."</td><td>".$msg1['pmdate']."</td><td>".$formset."<input type='hidden' name='msg' value='".$msg1['pmid']."'><input type='submit' value='delete'></form></td><td><form method='post' action='viewmsg.php'><input type='hidden' name='viewmsg' value='".$msg1['pmid']."'><input type='submit' value='view'></form></td></tr>"; $countbox = $countbox - 1; } } else { echo "<tr><td rowspan=5>You have no new messages.</td></tr>"; } echo $tableend; ?> The counter seems to work fine, but how it's listing the messages is the problem, any ideas? Thanks in advance!
  5. That seemed to work... thank you!
  6. I made a MySQL inbox for a game I'm making online... but I'm having some trouble. <html> <head> <LINK href="style.css" rel="stylesheet" type="text/css"> <?php $title="Inbox"; require("navtemp.inc"); require("serverinfo.inc"); if (isset($_COOKIE['userid'])) { $username=$_COOKIE['username']; echo "Welcome ".$username." to your inbox!"; echo "<a href='newPM.html' target='_blank'>Compose a new message</a>"; } else { die("Your not logged in! Log in!"); } $formset= <<<END <form action='deletemsg.php' method='post'> END; $tablehead = <<<END <table> <tr border='1'><td>FROM</td><td>SUBJECT</td><td>CREATED</td><td>DELETE</td></tr> END; $tableend = "</table></div></body></html>"; echo $tablehead; echo $formset; $sql="SELECT pmid FROM myPM WHERE to='$username'"; $query=mysql_query($sql) or die(mysql_error()); $msg=mysql_fetch_assoc($query) or die(mysql_error()); foreach ($msg as $id) { $sql1="SELECT * FROM myPM WHERE pmid='$id'"; $query1=mysql_query($sql) or die(mysql_error()); $msg1=mysql_fetch_assoc($query) or die(mysql_error()); echo "<tr><td>".$msg1['from']."</td><td>".$msg1['title']."</td><td>".$msg1['pmdate']."</td><td><input type=checkbox name='".$msg1['pmid']."'>"; } echo "<input type=submit value='Delete Messages'></form>"; echo $tableend; ?> The only clue that SQL gives me that it's near somewhere near these lines: $sql="SELECT pmid FROM myPM WHERE to='$username'"; $query=mysql_query($sql) or die(mysql_error()); Any ideas? Thanks in advance!
  7. I'll be honest, I'm not that great with java, and I'm only wondering about this script so I can use it with PHP and My SQL. I found this scipt from a linked website and I'm wondering, do you think its possible to make it save the coords of items in them? /** * Copyright (c)2005-2007 Matt Kruse (javascripttoolbox.com) * * Dual licensed under the MIT and GPL licenses. * This basically means you can use this code however you want for * free, but don't claim to have written it yourself! * Donations always accepted: http://www.JavascriptToolbox.com/donate/ * * Please do not link to the .js files on javascripttoolbox.com from * your site. Copy the files locally to your server instead. * */ // Variables used for "Draggable IFrame" (DIF) functions var DIF_dragging=false; var DIF_iframeBeingDragged=""; var DIF_iframeObjects=new Object(); var DIF_iframeWindows=new Object(); var DIF_iframeMouseDownLeft = new Object(); var DIF_iframeMouseDownTop = new Object(); var DIF_pageMouseDownLeft = new Object(); var DIF_pageMouseDownTop = new Object(); var DIF_handles = new Object(); var DIF_highestZIndex=99; var DIF_raiseSelectedIframe=false; var DIF_allowDragOffScreen=false; // Set to true to always raise the dragged iframe to top zIndex function bringSelectedIframeToTop(val) { DIF_raiseSelectedIframe = val; } // Set to try to allow iframes to be dragged off the top/left of the document function allowDragOffScreen(val) { DIF_allowDragOffScreen=val; } // Method to be used by iframe content document to specify what object can be draggable in the window function addHandle(o, win) { if (arguments.length==2 && win==window) { // JS is included in the iframe who has a handle, search up the chain to find a parent window that this one is dragged in var p = win; while (p=p.parent) { if (p.addHandle) { p.addHandle(o,win,true); return; } if (p==win.top) { return; } // Already reached the top, stop looking } return; // If it reaches here, there is no parent with the addHandle function defined, so this frame can't be dragged! } var topRef=win; var topRefStr = "window"; while (topRef.parent && topRef.parent!=window) { topRef = topRef.parent; topRefStr = topRefStr + ".parent"; } // Add handlers to child window if (typeof(win.DIF_mainHandlersAdded)=="undefined" || !win.DIF_mainHandlersAdded) { // This is done in a funky way to make Netscape happy with (win) { eval("function OnMouseDownHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}"+topRefStr+".parent.DIF_begindrag(evt, "+topRefStr+") }"); eval("document.onmousedown = OnMouseDownHandler;"); eval("function OnMouseUpHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}"+topRefStr+".parent.DIF_enddrag(evt, "+topRefStr+") }"); eval("document.onmouseup = OnMouseUpHandler;"); eval("function OnMouseMoveHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}"+topRefStr+".parent.DIF_iframemove(evt, "+topRefStr+") }"); eval("document.onmousemove = OnMouseMoveHandler;"); win.DIF_handlersAdded = true; win.DIF_mainHandlersAdded = true; } } // Add handler to this window if (typeof(window.DIF_handlersAdded)!="undefined" || !window.DIF_handlersAdded) { eval("function OnMouseMoveHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}DIF_mouseMove(evt, window) }"); eval("document.onmousemove = OnMouseMoveHandler;"); eval("function OnMouseUpHandler(evt) { if(typeof(evt)=='undefined'){evt=event;}DIF_enddrag(evt, window) }"); eval("document.onmouseup = OnMouseUpHandler;"); window.DIF_handlersAdded=true; } o.style.cursor="move"; var name = DIF_getIframeId(topRef); if (DIF_handles[name]==null) { // Initialize relative positions for mouse down events DIF_handles[name] = new Array(); DIF_iframeMouseDownLeft[name] = 0; DIF_iframeMouseDownTop[name] = 0; DIF_pageMouseDownLeft[name] = 0; DIF_pageMouseDownTop[name] = 0; } DIF_handles[name][DIF_handles[name].length] = o; } // Generalized function to get position of an event (like mousedown, mousemove, etc) function DIF_getEventPosition(evt) { var pos=new Object(); pos.x=0; pos.y=0; if (!evt) { evt = window.event; } if (typeof(evt.pageX) == 'number') { pos.x = evt.pageX; pos.y = evt.pageY; } else { pos.x = evt.clientX; pos.y = evt.clientY; if (!top.opera) { if ((!window.document.compatMode) || (window.document.compatMode == 'BackCompat')) { pos.x += window.document.body.scrollLeft; pos.y += window.document.body.scrollTop; } else { pos.x += window.document.documentElement.scrollLeft; pos.y += window.document.documentElement.scrollTop; } } } return pos; } // Gets the ID of a frame given a reference to a window object. // Also stores a reference to the IFRAME object and it's window object function DIF_getIframeId(win) { // Loop through the window's IFRAME objects looking for a matching window object var iframes = document.getElementsByTagName("IFRAME"); for (var i=0; i<iframes.length; i++) { var o = iframes.item(i); var w = null; if (o.contentWindow) { // For IE5.5 and IE6 w = o.contentWindow; } else if (window.frames && window.frames[o.id].window) { w = window.frames[o.id]; } if (w == win) { DIF_iframeWindows[o.id] = win; DIF_iframeObjects[o.id] = o; return o.id; } } return null; } // Gets the page x, y coordinates of the iframe (or any object) function DIF_getObjectXY(o) { var res = new Object(); res.x=0; res.y=0; if (o != null) { res.x = o.style.left.substring(0,o.style.left.indexOf("px")); res.y = o.style.top.substring(0,o.style.top.indexOf("px")); } return res; } // Function to get the src element clicked for non-IE browsers function getSrcElement(e) { var tgt = e.target; while (tgt.nodeType != 1) { tgt = tgt.parentNode; } return tgt; } // Check if object clicked is a 'handle' - walk up the node tree if required function isHandleClicked(handle, objectClicked) { if (handle==objectClicked) { return true; } while (objectClicked.parentNode != null) { if (objectClicked==handle) { return true; } objectClicked = objectClicked.parentNode; } return false; } // Called when user clicks an iframe that has a handle in it to begin dragging function DIF_begindrag(e, win) { // Get the IFRAME ID that was clicked on var iframename = DIF_getIframeId(win); if (iframename==null) { return; } // Make sure that this IFRAME has a handle and that the handle was clicked if (DIF_handles[iframename]==null || DIF_handles[iframename].length<1) { return; } var isHandle = false; var t = e.srcElement || getSrcElement(e); for (var i=0; i<DIF_handles[iframename].length; i++) { if (isHandleClicked(DIF_handles[iframename][i],t)) { isHandle=true; break; } } if (!isHandle) { return false; } DIF_iframeBeingDragged = iframename; if (DIF_raiseSelectedIframe) { DIF_iframeObjects[DIF_iframeBeingDragged].style.zIndex=DIF_highestZIndex++; } DIF_dragging=true; var pos=DIF_getEventPosition(e); DIF_iframeMouseDownLeft[DIF_iframeBeingDragged] = pos.x; DIF_iframeMouseDownTop[DIF_iframeBeingDragged] = pos.y; var o = DIF_getObjectXY(DIF_iframeObjects[DIF_iframeBeingDragged]); DIF_pageMouseDownLeft[DIF_iframeBeingDragged] = o.x - 0 + pos.x; DIF_pageMouseDownTop[DIF_iframeBeingDragged] = o.y -0 + pos.y; } // Called when mouse button is released after dragging an iframe function DIF_enddrag(e) { DIF_dragging=false; DIF_iframeBeingDragged=""; } // Called when mouse moves in the main window function DIF_mouseMove(e) { if (DIF_dragging) { var pos = DIF_getEventPosition(e); DIF_drag(pos.x - DIF_pageMouseDownLeft[DIF_iframeBeingDragged] , pos.y - DIF_pageMouseDownTop[DIF_iframeBeingDragged]); } } // Called when mouse moves in the IFRAME window function DIF_iframemove(e) { if (DIF_dragging) { var pos = DIF_getEventPosition(e); DIF_drag(pos.x - DIF_iframeMouseDownLeft[DIF_iframeBeingDragged] , pos.y - DIF_iframeMouseDownTop[DIF_iframeBeingDragged]); } } // Function which actually moves of the iframe object on the screen function DIF_drag(x,y) { var o = DIF_getObjectXY(DIF_iframeObjects[DIF_iframeBeingDragged]); // Don't drag it off the top or left of the screen? var newPositionX = o.x-0+x; var newPositionY = o.y-0+y; if (!DIF_allowDragOffScreen) { if (newPositionX < 0) { newPositionX=0; } if (newPositionY < 0) { newPositionY=0; } } DIF_iframeObjects[DIF_iframeBeingDragged].style.left = newPositionX + "px"; DIF_iframeObjects[DIF_iframeBeingDragged].style.top = newPositionY + "px"; DIF_pageMouseDownLeft[DIF_iframeBeingDragged] += x; DIF_pageMouseDownTop[DIF_iframeBeingDragged] += y; } All Contents Copyright © Matt Kruse What I'm trying to do with this I Frame Dragable script is make it possible for graphics to be dragged in a image, and save the coordinates of the dragable image in a SQL server file. If someone has a better idea on how I can do this... Just tell me right now, because this is getting quite confusing for a guy that only knows HTML and PHP.
  8. Straight besides the fact I editted the mysql_connect for personal reasons, and I forgot a " at the end, but don't worry, it isn't a problem in the script I made. You guys don't mind me asking either, but when I want to log out, how do I make it work with the IF statement correctly. This statement: if (isset($_COOKIE['userid'])) If I use unset to unset the cookie, I'm pretty sure that would not unset the WHOLE global $_cookie array. Is there a certain function to delete the cookie so that people can log out? Or is there a better condition.
  9. Hey, I'm trying to get cookies to work on other pages of my website so when a user logs in, the user gets other functions on other webpages... So I have two codes to do this. One that lets the user log in, and if the information is right, a cookies are set. <?php mysql_connect ("localblah", "localblah", "localblah) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("localblah"); $userentry=$_POST['username']; $passentry=$_POST['password']; $hashedpwentry=md5($passentry); $sql = "SELECT * FROM users WHERE username='$userentry'"; $result = mysql_query($sql); $userinfo = mysql_fetch_assoc($result) or die("Your username does not exist!"); if($hashedpwentry != $userinfo['password']) { die("Your login was unsuccessful, please make sure your password is correct."); } else { setcookie("username", $userinfo['username']); setcookie("password", $userinfo['password']); setcookie("userid", $userinfo['userid']); setcookie("equip", $userinfo['equip']); setcookie("name", $userinfo['name']); } ?> <html> <head> <title>Login Processed!</title> </head> <body> <a href='home.php' target='mainFrame'>Please click here to be redirected.</a> </body> </html> I'm pretty sure the error is some way I'm setting up, but I don't know what. Is there something I'm forgetting, and I need a function that will move the cookies to other variables, but I don't know what. And if there is a better way to do what I'm doing, just give me some feedback. Help is appreciated. And added to make sure if needed, here is the if code for getting the cookies I use. if (isset($_COOKIE['userid'])) Thanks in advance!
  10. Thanks, I just tweaked the IF statement to say =! instead of > and it works! Thanks alot Waldir.
  11. I'm having trouble with this user verify script I made. And I know it's the SQL getting confused, whether it is the variable set-up I don't know. This is just a included file, and in the index file, it's already connected to the database, and there is no errors with that because the error is: And count unavailable is apart of one of my SQL function error messages. <?php //User Name Verify function userver($userveri) { $query = "SELECT 'username' FROM 'users' WHERE 'username'='$userveri'"; $sql = mysql_query($query); $nrows = mysql_num_rows($sql) or die("count unavailable"); if($nrows != 0) { echo "The username you have chosen already exists!"; die(); } else { return($userveri); } } ?> Help is appreciated.
  12. $sql3 = "SELECT id from mlbplayers where id=".$matches[1][$i].""; You cannot have code like this. You're confusing the PHP with double quotes IN double quotes. You should have it like this. $sql3 = "SELECT id from mlbplayers where id='.$matches[1][$i].'"; When you cannot use double quotes in html, php, sql, you usually use a alternative like '.
  13. I agree if you store it as binary, it will REALLY add to the size of the database everytime you add those images. It's a good idea store the pathname to the image in a field.
  14. Thank you! I'm now indenting like you said in every one of those situatiosn but now I have another problem, and I wouldn't want to cause alot of spam. Now that that part of the script is working, another part shot up, in the usercheck part, it always gives me a problem. function usercheck($usercheckname) { if(!ereg("^[A-Za-z -]+$",$usercheckname)) { echo "Invalid Username. Try again."; die(); } else { echo "Username Success"; return $usercheckname; } } everytime the function runs it will say the test does not equal the same ereg function format, and the login name I tried to create was "jaku78". I'm trying to make it so it can have all uppercase, lowercase, and numericals but it just isn't working. I know that it has something to do with the EREG statement, but I don't know what, if someone could point me into a tutorial that is centered on the EREG, that might even help. EDIT:I already tried looking at the php.net manual, I will keep searching until I do find it. EDIT2:Fixed it!
  15. I have the case of the unexpected end blues... I've checked the code numerous times for the same amount of curly braces and still cannot find the error! Help is very well appreciated on this matter because I really can't seem to find it. Here is the file: <?php //USERNAME CHECK function usercheck($usercheckname) { if(!ereg("^[A-Za-z -]+$",$usercheckname)) { echo "Invalid Username. Try again."; die(); } else { echo "Username Success"; return $usercheckname; } } //PASSWORD CHECK function pwchecker($pwcheckname) { if(!ereg("^[A-Za-z -]+$",$pwcheckname)) { die("Parse error in your username, please press back and check"); } else { echo "Password Success"; return $pwcheckname; } } //GENDER CHECK function gencheck($gencheck) { if(!ereg("(male|female)",$gencheck)) { die("Parse error in your username, please press back and check again"); } else { echo "Gender Success"; return $gencheck; } //AGE CHECK function agecheck($agecheck) { if(!ereg("[0-9]+",$agecheck)) { die("Parse error in your DOB, please press back and check again"); } else { echo "Age Success"; return $agecheck; } } ?>
  16. I'm still starting PHP for the most part and I've been trying to make a register script for the day and I'm having some trouble, whenever the script runs from a form pre-created this is what appears. This is talking about a included file that holds functions to check the user name. <?php //USERNAME CHECK function usercheck($usercheckname) { if(!ereg("^[A-Za-z -]+$",$usercheckname) { echo "Invalid Username. Try again."; die(); } else { echo "Username Success"; return $usercheckname; } } Now it hasn't even finished through the whole included file yet, but always stops at that line 8, and if I take that off the whole IF statement would not work I believe... Help is appreciated greatly.
×
×
  • 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.