Jump to content

creata.physics

Members
  • Posts

    261
  • Joined

  • Last visited

    Never

Everything posted by creata.physics

  1. do you have a demo account set up with a demo pin? Registration page says: Before you can continue registering you will need to choose how you will continue registering an account. With no options to follow. Can't really test anything without access to the script. Okay, noticed that register link on the index page takes me here: http://testing.ultimate-battle-online.com/main/start/ Should take me here: http://testing.ultimate-battle-online.com/main/register/ Registration failure, after form was process I recieved this error: Fatal error: Call to undefined function remove_invisible_characters() in /home/uboeleme/Obsidian-Moon-Engine/classes/core_security.php on line 112
  2. I show loading images for my javascript codes that request data using the ajax function provided. This is how I'd show a progress bar on a simple click function that makes an ajax call: $(document).ready(function () { // Once the item with the id, div_id_that_triggers_function is clicked, we'll start running the function $('body').on('click','#div_id_that_triggers_function',function () { // Show the normally hidden loading bar $("#loading").fadeIn("slow"); $.ajax({ url: "index.php", // This can also be GET, depending on how your script is set up type: "POST", data: { value: 1 }, cache: false, success: function (data) { // Once the function is successfully ran, finish up by removing loading bar $("#loading").fadeOut("slow"); } }); return false; }); }); First thing I do is start showing the loading bar when the function starts. Loading is just an empty div, <div id="loading"></div>. The css has the display property set to none so it isn't shown unless I have it fadeIn() with jquery. You'll of course need to change the data values to fit your script, and load, append, prepend, etc whatever you need upon completion. Know that I'm very new to javascript so my method may not be the best or practical, but it does work as is quite simple.
  3. I don't think it would be considered a model. I believe what you're looking for is a registry. Zend Framework uses it, I believe the Symphony framework also uses it too but I'm not sure. Google search 'registry class php' and you'll get the answers you're looking for, I'm sure.
  4. PHP Manual said this: If PHP has decided that filename specifies a local file, then it will try to open a stream on that file. The file must be accessible to PHP, so you need to ensure that the file access permissions allow this access. If you have enabled safe mode, or open_basedir further restrictions may apply. So if safe_mode or oben_basedir is enabeld then you'll have some issues and there are some workarounds, though I think if safe mode is on you'll get an error specific to that.. Also, please double check your permissions, I don't think it is likely that this issue is related to actual code. It's most likely going to have to do with permissions, just like the error states. This is of course in addition to kickens post, so start of with what he suggested.
  5. Zend Framework uses a registry to store objects and data, which is like using globals. Here's some useful information: http://www.phppatterns.com/docs/design/the_registry
  6. under $check, can you add: print_r($check); underneath, copy&paste the output into something like phpmyadmin, and see what the results are. it will give you the error if any. it will also help you determine if the session club and team are set.
  7. well, your php's logic is kind of weird on one spot. i removed an unnecessary redirect. i also cleaned up your code a bit so it can be read a bit easier. i commented out the redirect that doesn't make sense. if you don't understand it, feel free to ask what you don't understand. <?php session_start(); $email = $_SESSION['email']; $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); if(!empty($email) && isset($email) &&!empty($password) && isset($password)) { $password = md5("$password"); require "includes/init/db_con.php"; $query = mysql_query("SELECT * FROM users WHERE email = '$email'"); $numrows = mysql_num_rows($query); if($numrows != 0) { $row = mysql_fetch_assoc($query); $dbemail = $row ['email']; $dbpassword = $row ['password']; if($dbemail === $email && $dbpassword === $password) { $_SESSION['email'] = $dbemail; header("location: http://localhost/control/home.php"); } else { // Login failed because email or password did not match header('Location: login.php?login_failed'); } } else { // Log in failed because the sessions email did not match a user record? #header('Location: login.php?login_failed'); } } require "includes/overall/header.php"; if($_GET['login_failed']){ echo "Login Box will appear with messages"; } require "includes/overall/footer.php";
  8. Hello eldan88. Since check_required_fields() is a custom function with its own paramaters made by the creator, it will only required those paramaters unless otherwise stated. So having $_POST as the second paramater when the function is being called is pointless and does nothing, you can remove it if that's what you're getting at.
  9. Thats a bunch haku. I've marked the topic as solved, your method actually shows the loading image when mine didn't, so I appreciate that a bunch. I have a question if you have the time. Why did you define the function clickListener() inside of function($)?
  10. I went ahead and looked at jquery's .load function and it seems appropriate. I'm now using this code which does work: $(document).ready(function(){ $(".buttonLoad").click(function() { $("#loading").html('<img src="images/loader.gif" />'); $(".result").load("index.php?component=roadmap&module=ajax&action=toggle"); $("#loading").hide(); }); }); I'm just not sure if this is the best way to go about this method. It doesn't seem like it's ajax.
  11. Hello friends. I've recently started to learn javascript because it is quite amazing and very necessary for what I'm doing. So I'm trying to just grab some basic concepts and build small test scripts using the jquery framework. What I've started on is a script that allows users to pull data from another page and output the content. I've been able to pull all data from my database and output it when clicking the input button. My issue is that, if I click the button more than once without refreshing the page, the script will only be called once. I want to have a button, once the button is clicked, a random username is outputted in a div. Here's what I got going on right now: <script type="text/javascript"> $.ajax({ url: 'index.php?component=roadmap&module=ajax&action=toggle', success: function(data) { $(".buttonLoad").click(function() { $("#loading").html('<img src="images/loader.gif" />'); $(".result").html(data); $("#loading").hide(); }); } }); </script> Load a random user from the databse. <input type="button" class="buttonLoad" value="Load!" /> <div class="result"></div> I'm using the function ajax() because the jquery framework said it is the function that underlies all ajax requests, which is what this is, so it seemed like my best bet. I'll also post the php code just in case: $random = $this->db->fetch_row("select user_name from zxt_users order by RAND() limit 1"); @header( "Content-type: text/html;charset=utf-8" ); print $random['user_name']; exit(); Like I said, the script does work, just once. I'm guessing the issue is with the function ajax() only allowing the same request once but I'm not sure which is why I'm here for help. If anymore information is required I'll be more than happy to provide it.
  12. from what you're saying, you're still getting the success message even after submitting the form. this is a generic way to process form data and not show the form if it was submitted <?php if( isset( $_POST['process'] ) ) { // here you'll have all form submitted data print_r($_POST); echo '<br/>form submitted, data needs to be checked still'; } else { ?> <form action="" method="post"> <input type="text" name="somedata" /> <input type="submit" name="process" /> </form> <?php } if that doesn't help you with your situation, then yeah, go ahead and post the full code. if the code i posted doesn't do what you want, then make sure you clarify on exactly what you need to happen.
  13. definitely not enough information here. you're saying you want a message to be added along with a users bet when created. well what is your database structure like? how do bets work? why can't you add an additional field into your sql table called message and store the content there? we need more code and more information, thanks.
  14. break; is in the wrong spot. You need break after you set the value to the variable you want to return. Here's an example: $arr = array('one', 'two', 'three', 'four', 'five'); foreach( $arr as $val ) { echo $val; break; } You'll only get the first result that way, or the first result that matches your condition. So your code would look like this: $fl=getsomelist(); // gives an array $userList=''; foreach ($fl as $f) { if ( strlen($f) <= (200) ) { $userList .= $f; break; } }
  15. you're right, i didn't even read the entire thread and just skimmed through it, definitely my fault. i really don't understand why I even come to these forums unless i'm fully capable, motivated and willing to help others. sorry for being a douche
  16. Psycho already answered your question, that's probably why nobody else stopped by to reply in this thread. Based on what you've talked to yourself about, you didn't bother reading Psycho's post, which is another reason why nobody else stopped by to say anything. You'll need an alternative query to check for record existance. Your checks will need to consist with what duplicate data you do not want to enter. I'm going to post an example on how to prevent from adding another record in an sql server with php to handle the processing. $check_if_data_exists = mysql_query("select unique_field from sql_table where unique_field = '{$unique_value}'"); if( mysql_num_rows( $check_if_data_exists ) == false ) { // you'll insert data here, because mysql_num_rows returned that there was not any matching records } else { echo 'This data already exists'; } mysql_num_rows will return the number of rows if the query returned any results, or it will return false if no rows were found. You'll need to alter the query to benefit your script and also check if there is more than one field that is not allowed to have matching data.
  17. this will work <?php include "../includes/config.php"; if (isset($_COOKIE["ValidUserAdmin"])) { require ( "../includes/CGI.php" ); require ( "../includes/SQL.php" ); $cgi = new CGI (); $sql = new SQL ( $DBusername, $DBpassword, $server, $database ); if ( ! $sql->isConnected () ) { die ( $DatabaseError ); } ?> <html> <head> <title>PokerMax Poker League :: The Poker Tournamnet League Solution</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="../includes/style.css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="#F4F4F4"> <?PHP include ("header.php"); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td valign="top" bgcolor="ghostwhite" class="menu"><?PHP include ("leftmenu.php"); ?></td> <td bgcolor="#FFFFFF"> </td> <td valign="top" align="left" width="100%" bgcolor="#000000"><h1><br /> <img src="images/home.gif" width="25" height="25" /> PokerMax Poker League :: <font color="#CC0000">Assign Players to Tournaments</font></h1> <br /> <p>If you are running multiple tournaments on your website, this feature will allow you to assign any of your players to tournaments which you are running.</p> <?php if ( $cgi->getValue ( "op" ) == "AssignPlayer" ) { foreach($cgi->getValue('playerid') as $player_id) { $player_store[] = $player_id; $result = mysql_query("SELECT playerid FROM {$score_table} WHERE playerid = '". $sql->quote( $player_id ) ."' AND tournamentid = '" . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . "'") or die ("$DatabaseError"); $chkd_email = mysql_numrows($result); if ($chkd_email != "") { print "<p class=\"red\"><strong>The Player has already been assigned to this tournament</strong></p>"; } else { mysql_query("INSERT INTO ".$score_table." VALUES ( '', " . $sql->quote ( $player_id ) . ", " . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . ", '0', '$dateadded' )") or die ("$DatabaseError"); } } } if( isset( $player_store ) and is_array( $player_store ) ) { $player_list = implode( ',', $player_store ); $players_added = "<p align='center' class='red'>The player(s): <strong>$player_list</strong> have been assigned to the poker tournament.</p>";} ?> <br> <?php echo $players_added; ?> <form method="post"> <input name="op" type="hidden" value="AssignPlayer"> <select name="playerid[]" selected multiple="multiple" size="6"> <?PHP $rows = $sql->execute ( "SELECT * FROM " . $player_table . " ORDER BY playerid ASC", SQL_RETURN_ASSOC ); for ( $i = 0; $i < sizeof ( $rows ); ++$i ) { $row = $rows [ $i ]; ?> <option value="<?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?>"> <?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?> - <?php echo $cgi->htmlEncode ( $row [ "name" ] ); ?> </option> <?php } ?> </select> <em>and assign to the tournament =></em> <select name="tournamentid" size="1"> <option value="">Select Tournament ....</option> <?PHP $rows = $sql->execute ( "SELECT * FROM " . $tournament_table . " ORDER BY id DESC", SQL_RETURN_ASSOC ); for ( $i = 0; $i < sizeof ( $rows ); ++$i ) { $row = $rows [ $i ]; ?> <option value="<?php echo $cgi->htmlEncode ( $row [ "tournamentid" ] ); ?>"> <?php echo $cgi->htmlEncode ( $row [ "tournament_name" ] ); ?> </option> <?php } ?> </select> <input type="submit" value="Assign Player" ONCLICK="return confirm('Are you sure you want to add this player to the tournament?');" /> </form> <br /></td> </tr> </table> <?PHP include ("footer.php"); ?> </body> </html> <?php } else { header("Location: index.php"); exit; } ?> I've made a small script to accomplish this same goal in a simplified manor. <?php if( isset( $_POST['process'] ) ) { foreach( $_POST['playerid'] as $player ) { $player_list[] = $player; mysql_query("insert into table( key ) values ('$player')"); } } if( isset( $player_list ) and is_array( $player_list ) ) { echo implode(',', $player_list) . " were chosen"; } ?> <form action="" method="post"> <select multiple="multiple" name="playerid[]"> <option value="Bob">Bob</option> <option value="Matt">Matt</option> <option value="Tim">Tim</option> </select> <input type="submit" name="process"> </form> It would benefit you if you looked at the second code first and understand exactly how it works. you'd then be able to integrate the same functionality into your current script on your own and be able to debug it a lot easier since you can backtrack and see where you went wrong.
  18. Really I don't see how this is an issue. If you truly are understanding the code you're writing then you'd know exactly where to place what. Here's a suggestion that would help you figure out what your issue is: take out all the html code from your class variables. There is no reason that I can see why you are having your html in config.php, it all can be put into category.php without taking away any functionality.
  19. Try what I said in my post before this and see how that turns out. Your html for displaying the success messages( the message saying what users have been added) still displays. Previously I set it to only display if the playerid post data was submitted along with the form. So we are trying to get that message to show only when you submit the form. You need to understand the logic of your script and how to manipulate each function you have properly. If $cgi->getValue returns post data value, then you need to understand when, where, why and how to use it. Anyway, if what I posted in the post before yours does not work, then go ahead and post your full code once more. It would benefit you 100% more if you completely understood the code you use.
  20. That's fine. Try changing it to this: $playerid = $cgi->getValue('playerid'); if( isset( $playerid ) )
  21. Can you please post the code in [*code*] or [*php*] tags? I'm not sure if you're posting the full code or not. Also, to help you with your problem without the need of your code you can read this page: http://www.php.net/manual/en/language.operators.assignment.php Here's an example from that page, it seems like this is what you want to do: $b = "Hello "; $b .= "There!"; // sets $b to "Hello There!", just like $b = $b . "There!";
  22. That's my fault. I should have taken that into consideration. You can add this code where ever you want. $players_added = ''; if( isset( $cgi->getValue('playerid') ) ) { $player_list = implode( ',', $cgi->getValue('playerid') ); $players_added = "<p align='center' class='red'>The player(s): <strong>$player_list</strong> have been assigned to the poker tournament.</p>"; } You can then replace: <p align="center" class="red">The player(s): <strong><?php echo implode(',', $cgi->getValue('playerid') ); ?></strong> have been assigned to the poker tournament.</p> with: <?php echo $players_added; ?> That should fix the issue.
  23. Take some time into reading about arrays and how to handle them. <?php include "../includes/config.php"; if (isset($_COOKIE["ValidUserAdmin"])) { require ( "../includes/CGI.php" ); require ( "../includes/SQL.php" ); $cgi = new CGI (); $sql = new SQL ( $DBusername, $DBpassword, $server, $database ); if ( ! $sql->isConnected () ) { die ( $DatabaseError ); } ?> <html> <head> <title>PokerMax Poker League :: The Poker Tournamnet League Solution</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="../includes/style.css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="#F4F4F4"> <?PHP include ("header.php"); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td valign="top" bgcolor="ghostwhite" class="menu"><?PHP include ("leftmenu.php"); ?></td> <td bgcolor="#FFFFFF"> </td> <td valign="top" align="left" width="100%" bgcolor="#000000"><h1><br /> <img src="images/home.gif" width="25" height="25" /> PokerMax Poker League :: <font color="#CC0000">Assign Players to Tournaments</font></h1> <br /> <p>If you are running multiple tournaments on your website, this feature will allow you to assign any of your players to tournaments which you are running.</p> <?php if ( $cgi->getValue ( "op" ) == "AssignPlayer" ) { foreach($cgi->getValue('playerid') as $player_id) { $result = mysql_query("SELECT playerid FROM {$score_table} WHERE playerid = '". $sql->quote( $player_id ) ."' AND tournamentid = '" . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . "'") or die ("$DatabaseError"); $chkd_email = mysql_numrows($result); if ($chkd_email != "") { print "<p class=\"red\"><strong>The Player has already been assigned to this tournament</strong></p>"; } else { mysql_query("INSERT INTO ".$score_table." VALUES ( '', " . $sql->quote ( $player_id ) . ", " . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . ", '0', '$dateadded' )") or die ("$DatabaseError"); } } } ?> <br> <p align="center" class="red">The player(s): <strong><?php echo implode(',', $cgi->getValue('playerid') ); ?></strong> have been assigned to the poker tournament.</p> <form method="post"> <input name="op" type="hidden" value="AssignPlayer"> <select name="playerid[]" selected multiple="multiple" size="6"> <?PHP $rows = $sql->execute ( "SELECT * FROM " . $player_table . " ORDER BY playerid ASC", SQL_RETURN_ASSOC ); for ( $i = 0; $i < sizeof ( $rows ); ++$i ) { $row = $rows [ $i ]; ?> <option value="<?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?>"> <?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?> - <?php echo $cgi->htmlEncode ( $row [ "name" ] ); ?> </option> <?php } ?> </select> <em>and assign to the tournament =></em> <select name="tournamentid" size="1"> <option value="">Select Tournament ....</option> <?PHP $rows = $sql->execute ( "SELECT * FROM " . $tournament_table . " ORDER BY id DESC", SQL_RETURN_ASSOC ); for ( $i = 0; $i < sizeof ( $rows ); ++$i ) { $row = $rows [ $i ]; ?> <option value="<?php echo $cgi->htmlEncode ( $row [ "tournamentid" ] ); ?>"> <?php echo $cgi->htmlEncode ( $row [ "tournament_name" ] ); ?> </option> <?php } ?> </select> <input type="submit" value="Assign Player" ONCLICK="return confirm('Are you sure you want to add this player to the tournament?');" /> </form> <br /></td> </tr> </table> <?PHP include ("footer.php"); ?> </body> </html> <?php } else { header("Location: index.php"); exit; } ?>
  24. See if it works using this: <?php include "../includes/config.php"; if (isset($_COOKIE["ValidUserAdmin"])) { require ( "../includes/CGI.php" ); require ( "../includes/SQL.php" ); $cgi = new CGI (); $sql = new SQL ( $DBusername, $DBpassword, $server, $database ); if ( ! $sql->isConnected () ) { die ( $DatabaseError ); } ?> <html> <head> <title>PokerMax Poker League :: The Poker Tournamnet League Solution</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="../includes/style.css" rel="stylesheet" type="text/css" /> </head> <body bgcolor="#F4F4F4"> <?PHP include ("header.php"); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td valign="top" bgcolor="ghostwhite" class="menu"><?PHP include ("leftmenu.php"); ?></td> <td bgcolor="#FFFFFF"> </td> <td valign="top" align="left" width="100%" bgcolor="#000000"><h1><br /> <img src="images/home.gif" width="25" height="25" /> PokerMax Poker League :: <font color="#CC0000">Assign Players to Tournaments</font></h1> <br /> <p>If you are running multiple tournaments on your website, this feature will allow you to assign any of your players to tournaments which you are running.</p> <?php if ( $cgi->getValue ( "op" ) == "AssignPlayer" ) { foreach($cgi->getValue('playerid') as $player_id) { $result = mysql_query("SELECT playerid FROM ".$score_table." WHERE playerid = " . $sql->quote ( $cgi->getValue ( "playerid" ) ) . " AND tournamentid = " . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . "") or die ("$DatabaseError"); $chkd_email = mysql_numrows($result); if ($chkd_email != "") { print "<p class=\"red\"><strong>The Player $player_id has already been assigned to this tournament</strong></p>"; } else { mysql_query("INSERT INTO ".$score_table." VALUES ( '', " . $player_id . ", " . $sql->quote ( $cgi->getValue ( "tournamentid" ) ) . ", '0', '$dateadded' )") or die ("$DatabaseError"); } } ?> <br> <p align="center" class="red">The player <strong><?php echo $_POST['playerid']; ?></strong> has been assigned to the poker tournament.</p> <?php } ?> <form method="post"> <input name="op" type="hidden" value="AssignPlayer"> <select name="playerid[]" multiple="multiple" size="6"> <?PHP $rows = $sql->execute ( "SELECT * FROM " . $player_table . " ORDER BY playerid ASC", SQL_RETURN_ASSOC ); for ( $i = 0; $i < sizeof ( $rows ); ++$i ) { $row = $rows [ $i ]; ?> <option value="<?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?>"> <?php echo $cgi->htmlEncode ( $row [ "playerid" ] ); ?> - <?php echo $cgi->htmlEncode ( $row [ "name" ] ); ?> </option> <?php } ?> </select> <em>and assign to the tournament =></em> <select name="tournamentid" size="1"> <option value="">Select Tournament ....</option> <?PHP $rows = $sql->execute ( "SELECT * FROM " . $tournament_table . " ORDER BY id DESC", SQL_RETURN_ASSOC ); for ( $i = 0; $i < sizeof ( $rows ); ++$i ) { $row = $rows [ $i ]; ?> <option value="<?php echo $cgi->htmlEncode ( $row [ "tournamentid" ] ); ?>"> <?php echo $cgi->htmlEncode ( $row [ "tournament_name" ] ); ?> </option> <?php } ?> </select> <input type="submit" value="Assign Player" ONCLICK="return confirm('Are you sure you want to add this player to the tournament?');" /> </form> <br /></td> </tr> </table> <?PHP include ("footer.php"); ?> </body> </html> <?php } else { header("Location: index.php"); exit; } ?> What you were doing inserting the array $_POST['playerid'] to the playerid field of the database. You need to loop though $_POST['playerid'] as it is an array to get the values you are needed. What I did was end the foreach loop before your success message gets shown. I also changed your query that inserts new data into the database by actually assigning the appropriate value to the playerid field. Try that code, see if it works. If it doesn't, come back and we'll go from there.
  25. Can you post the full code you are now using please?
×
×
  • 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.