Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Are the links on your website or someone elses? If someone elses, you just need to know the domain name then append it. If yours, use $_SERVER['HTTP_HOST'] to print out the server name, or define it in your script as a constant. If neither please be more descriptive of the problem.
  2. Look into rand That may help you, and insert into the array definition for the first array, just make sure the top most number is the last array key or else you will get errors half the time. <?php $max = count($questions) - 1; // minus 1 since arrays are zero based. $randIndex = rand(0, $max); ?> <h1>Q: <?php echo $questions[$randIndex][1]; ?></h1> Hope that helps ya.
  3. This assumes alot. Mainly that people actually know how to use flash...this is a PHP site not a flash site. I have never used flash with PHP, I actually stopped using flash after Flash 4. That was like in 2000. So for me, this problem is hard for me to solve without doing a ton of research. I would look into a flash/php help forum somewhere, as that would probably have people who integrate php and flash together. There is no doubt the answer could take 5 minutes from someone who knows how to work with FLASH/PHP, for me it would take about an hour at least, which of course you could take that hour and learn the integration of PHP/FLASH and how to integrate it with your code. As all I would be doing to solve this for you is research using google, why should I do that when you are perfectly capable of that?
  4. Always is a harsh word. Actually in testing that may be true, in production you want to hide the real error, and log it in a db/email it to yourself cause you do not want to give hackers any type of inside information to your system. The $res line executes the query, then assigns the resource of that query to $res, to be used by other mysql functions. mysql_query can explain it better than I can.
  5. $sql = "SELECT email FROM tbl_name WHERE email = '" . $email . "' LIMIT 1"; $res = mysql_query($sql); if (mysql_num_rows($res) < 1) { // process email } else { echo 'email in use'; }
  6. I am not sure if this will help, but I know TAG Clouds, sort of do the same thing, except the count. But you can modify the code accordingly...
  7. Umm no... SELECT SUM(value) as valueSum FROM tbl_name WHERE ID IN(1,2,3,4) GROUP BY value Will return valueSum = 20
  8. What are you trying to accomplish with this code? Stating that may give us an idea of how to correct the issue of grabbing a ton of data into grabbing the needed data.
  9. $query = "SELECT * FROM work WHERE tech_id = '$tech_id' AND completed = 'no'; Use AND
  10. You have to initialize variables in your constructor. <?php class business{ public $businesstype; public $region; public $businessname; private $con; public function __construct() { $this->businesstype = $_GET['business']; }
  11. Or you could set a GET variable and make it trigger if that get variable isset and is equal to what it should be. For the actual value I would make an md5 hash of something. That way it could be erase.php but without that variable it will not run.
  12. Notepad++ is great for just coding. For projects I would highly recommend eclipse with the php plugin. It shows syntax errors etc without having to run the code. Great software.
  13. Yea, but MySQL is built to be amazingly fast and can do this very quick even with hundreds of thousands, even millions of records. The DB won't slow him down one bit, its the generating the image for the whole table/displaying the whole table that will make the script crawl. With the return rows being limited to pagination the script will run smooth. Take this site for example, there are 25 topics per page with 2356 pages, and yet it displays dang quick. That is a total of 58,900 rows, just for this forum, now tally all the forums up together....
  14. A cron job. If on linux, if not a scheduled task which would run a script that dumps them. Googling cron job will get you the results.
  15. Thats the point of pagination....actually. Which would be more code, but only run x amount per page. Little code as possible is not always a good thing, depending on the circumstances. In this scenario, he would want more code to break up the results and display links to pages to display the other data.
  16. He is using single quotes for the href etc, the main echo uses double quotes. It will parse it correctly.
  17. <td bgcolor = '#FFFFFF'><a href = 'processalbum.php?album='.$album_name><font face = 'arial' size = '2'>$album_name</a></font></td> Accessed by $_GET['album'].
  18. function escapeString($string) { return (get_magic_quotes_gpc()) ? mysql_real_escape_string(stripslashes($string)):mysql_real_escape_string($string); } Chances are it is because you have get_magic_quotes_gpc on, try using that function instead, which should escape a string properly.
  19. A modification to the profile: <?php session_start(); echo $_SESSION['ID_my_site']; ?> to. <br>Naruto:Tales Of The Sannin.<br><br><img src='http://i246.photobucket.com/albums/gg97/frogjam/vizardavatar.gif' height='300'></center<br> <br> <?php // Connects to your Database mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("members") or die(mysql_error()); $username = $_SESSION['ID_my_site']; $sql = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); while($row = mysql_fetch_array($sql)) { echo "Name:".$row['username']."<br/>"; echo "Level:".$row['level']."<br/>"; echo "Health:".$row['health']."<br/>"; echo "Skill:".$row['skill']."<br/>"; echo "Chakra:".$row['chakra']."<br/>"; echo "Rank:".$row['rank']."<br/>"; echo "Kills:".$row['kills']."<br/>"; echo "Kekkei Genkai:".$row['bloodline']."<br/>"; echo "Location:".$row['location']."<br/>"; echo "Village:".$row['village']."<br/>"; // Then just carry on } ?> <br> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBIWjpEn88rvxnYAlnbvC5ssV7ygIF3bmeRM65Oyp8rjKgjSEgd/1Yi+/1nz8hfPq/uDcDO1arCxl+kNuughppbSmxUx8UJDUZrCZJUsrC2C01G4/jswyy0ZXGGn6pL2uUeRmCVNF8EKJDeQ1jf2SvE1bGL/FHrtNNWqfNaYpktITELMAkGBSsOAwIaBQAwgcQGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIlbCsX1VLJTeAgaA6KpDzL4lVHRNwMSU0ryu/orS2nxwIgSin1mq9ovOzqEFwei9Uutj91TMVMSjRHwCmSylnp4la+XJ2HKbeS8rATiDIjivZ3BrTw3EocKwyaATwRbEe0JxmoMdxR311lMC5SyB0jNAaH1PmKk2ZEoqj8hFQPmEzivOrGDpvW6XcigdV0dOfzB2zGqXEAcFrXYRpp7OSf0lEkx1sQChvOMzmoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUG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6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDgxMTE1MDUwMzUxWjAjBgkqhkiG9w0BCQQxFgQUrVxXwsTog4BXfG1BfSOmsiKGvZcwDQYJKoZIhvcNAQEBBQAEgYA5HecmaobIMi4AbduQEBv3QrKVKvNU0vAM8h590++trknYDT3i7xHitj3IVeSH6eocEi+0v5WCzfRV2seOF2NFeDPMGFMCE5YH/vFF3oC/zQ+bkYTNWX2bYuX12GLhW/ggqx01XcqkhfqugQrxa1Ff5NnJOp+DNZF4vuclXHJjLA==-----END PKCS7----- "> <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt=""> <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </ul> </td> </tr> <tr><td id="foot1">| <a href="#top">t o p</a> |</td></tr> <tr><td id="foot2" colspan="2"> </td></tr> </table> </body> </html> As for the blank pages, that code switched shouldnt have caused that, put the following at the top of your scripts: error_reporting(E_ALL); ini_set("display_errors", 1); To make sure any errors are shown.
  20. mysql_query needs to be ran. Also you need to select the DB <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("register", $con); $sql_check = "SELECT username FROM register WHERE username = '" . mysql_real_escape_string($_POST['username']) . "'"; // needs to be done like this or with { } around the $_POST or else it will not work right. $check = mysql_num_rows(mysql_query($sql_check)); // mysql_query for the check if($check > 0) { echo "username is already in use"; }else { // mysql_select_db("register", $con); move this up top
  21. <?php session_start(); if(!isset($_GET['NPC'])) { echo "You have not selected a NPC to fight! Please select one from below <br><br>"; $NPCS = mysql_query("SELECT * FROM `npc`"); while($Show = mysql_fetch_array($NPCS)) { echo "<a href=\"Attack.php?NPC={$Show['npcname']}\">{$Show['npcname']}</a><br>"; } exit(); } $NPC = mysql_real_escape_string($_GET['NPC']); echo "<a href=\"Attack.php?NPC=" . $NPC . "&Action=Attack\">Attack</a><br> <a href=\"Attack.php?NPC=" . $NPC . "&Action=Run\">Run</a><br>"; $username = $_SESSION['ID_my_site']; if(isset($_SESSION['NPC'])) { $UserSQuery = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserSQuery); $UserH = $_SESSION['health']; $UserA = $UserS['skill']; $UserA *= .1; $NPCSQuery = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCSQuery); $NPCH = $_COOKIE['NPCH']; $NPCA = $NPCS['dmg']; $NPCA *= .1; $NPCX = $NPCS['skillgained']; $NPCH -= $UserA; if($NPCH <= 0) { echo "You win and have gained " . $NPCX . " skill"; $UserA = $UserS['skill'] + $NPCX; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_SESSION['NPC']); exit(); } $_SESSION['NPCH'] = $NPCH; $UserH -= $NPCA; if($UserH <= 0) { echo "You have lost"; $UserA = $UserA * .95; mysql_query("UPDATE `users` SET skill='$UserA' WHERE username='$username'"); unset($_SESSION['NPC']); exit(); } $_SESSION['health'] = $UserH; } else { echo "3"; $UserSQuery = mysql_query("SELECT * FROM `users` WHERE username='$username'"); $UserS = mysql_fetch_array($UserSQuery); $NPCSQuery = mysql_query("SELECT * FROM `npc` WHERE npcname='$NPC'"); $NPCS = mysql_fetch_array($NPCSQuery); $_SESSION['NPC'] = $NPC; $_SESSION['health'] = $UserS['health']; $_SESSION['skill'] = $UserS['skill']; $_SESSION['NPCH'] = $NPCS['health']; } ?> </body> </html> There is the fighting script corrected.
  22. register_globals would set any type of request from a form (when you submit a form it sends data via POST or GET, get by default). What the globals would do is take a form item, such as your text field find, and use that name for the variable name. But that turned how to be a huge security flaw so it is now disabled. Now to access the methods sent from a form, it can be accessed by $_REQUEST ($_GET and $_POST combined) or $_GET, if the form was submitted using get, or $_POST if the form was submitted using POST. Hope that helps. EDIT: The zz is just not in the if statement, so we know that will not be executed. The statement goes as folllows $find = isset($_REQUEST['find'])?trim($_REQUEST['find']):"zz"; If find in request has been set, then set $find equal to that variable trimmed, else set it to zz since that will not be executed in the if statement. Basically that is just a shortened if statement. To the left of the colon ( it means the if was true to the right it is like an "else" statement.
  23. ...ummm <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } $sql_check = "SELECT username FROM register WHERE username = '$_POST[username]'"; $check = mysql_num_rows('$sql_check'); if($check > 0) { echo "username is already in use"; }else { mysql_select_db("register", $con); $sql="INSERT INTO register (username, email, password) VALUES ('$_POST[username]','$_POST[email]','$_POST[password]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "register success!!!"; } ?> Should fix it, you never ended the } the else and had that BLA BLA BLA uncommented. Also mysql_close does not need to be called, it is closed automatically after script executes.
  24. If you still cannot figure it out with the above post the 3 pages and I will get it to use sessions.
  25. I doubt this will work but you can try it: <div id="navbar"> <div id="blah"> <ul> <li><a href="<?php echo get_settings('home'); ?>">Home</a></li> <?php wp_list_pages('title_li=&depth=1'); ?> </div> <div style="float: right"> <form method="get" id="search_form" action="<?php bloginfo('home'); ?>/"> <input type="text" class="search_input" value="To search, type and hit enter" name="s" id="s" onfocus="if (this.value == 'To search, type and hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'To search, type and hit enter';}" /> <input type="hidden" id="searchsubmit" value="Search" /> </div> </ul> </div> To find an answer, I would google CSS align div right or something similiar should be plenty of examples. I just hate CSS cause of how much a pain it is to get right in all the browsers, so yea.
×
×
  • 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.