
Copilot 🤖
Members-
Posts
19 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Copilot 🤖's Achievements

Newbie (1/5)
0
Reputation
-
So, I decided to do a little science project using some simple HTML and PHP as I'm 13 and got bored. So I was doing this and realized I didn't know how to center the radio button below the image. Here's a link to see what I've basically got so far: <html> <head> <title> Names to Faces </title> </head> <body> <p>Names to Faces (NtF) is a Science Project that was created to see if people see certain names as looking a certain way. We will give you 15 names and 4 pictures for each name for you to choose which of those pictures matches the name.</p> <p><strong>Question 1</strong>: Who is named Mike?</p> <div name="answer1div"> <input type="radio" name="answer1" value="a"><img src="mike1.jpeg" /></input> <input type="radio" name="answer1" value="b"><img src="mike2.jpeg" /></input> <input type="radio" name="answer1" value="c"><img src="mike3.jpeg" /></input> <input type="radio" name="answer1" value="d"><img src="mike4.jpeg" /></input> </div> </body> </html>
-
Line 168 - http://phpfi.com/347769 When I try to run this query in mysql.exe it returns the expected data: SELECT SUM(`gold`), SUM(`tk`), SUM(`yk`) FROM `hits` WHERE `nick`='Rezert'; However, when I run the query in my PHP, it returns an empty array although it does say mysql_num_rows() != 0 Thanks in advance, Rezert
-
Tried that. I get a 500 Internal Server Error
-
I'm trying to setup a MVC system and I want it to look nice. The MVC system is in C:\xampp\htdocs\system\. The home directory is C:\xampp\htdocs\. I have ModRewrite enabled. Okay, so this works: RewriteEngine On RewriteRule ^(.*)/$ /system/index.php?send=$1 But it has to have an ending slash on the URL or it gives me a 404. If I try this: RewriteEngine On RewriteRule ^(.*)$ /system/index.php?send=$1 I get a 500 Internal Server Error, but if I do this: RewriteEngine On RewriteRule ^/(.*)$ /system/index.php?send=$1 I get 404s at these: http://localhost/system/Home http://localhost/system/Home/ http://localhost/system/Home/page2 http://localhost/system/Home/page2/ That means it's not even finding index.php, right? Although this works: http://localhost/system/ and http://localhost/system. Wtf. Please help.
-
OH! Thank you so much.
-
This works fine on the first page (5 Entries). On the second page though it gets the 5 then everything on the 3rd page. Even if I hard code 5 - 10. www.mlfmp.com <?php // Simple News Script function bb_decode($text) { $text = htmlspecialchars($text, ENT_QUOTES); $patterns = array("/\[b\](.*?)\[\/b\]/i", "/\[i\](.*?)\[\/i\]/i", "/\[u\](.*?)\[\/u\]/i", "/\[url\]http:\/\/(.*?)\[\/url\]/i", "/\[url=http:\/\/(.*?)\](.*?)\[\/url\]/i", "/\[img\](.*?)\[\/img\]/i"); $replaces = array("<b>$1</b>", "<i>$1</i>", "<u>$1</u>", "<a href='http://$1'>$1</a>", "<a href='http://$1'>$2</a>", "<img src='$1' />"); $retval = preg_replace($patterns, $replaces, $text); $retval = str_replace(array("", "", "", "", "", ":clap:", ""), array("<img src='images/smileys/smile.gif' alt='smile.gif' />", "<img src='images/smileys/sad.gif' alt='sad.gif' />", "<img src='images/smileys/tongue.gif' alt='tongue.gif' />", "<img src='images/smileys/biggrin.gif' alt='biggrin.gif' />", "<img src='images/smileys/blink.gif' alt='blink.gif' />", "<img src='images/smileys/clap.gif' alt='clap.gif' />", "<img src='images/smileys/lol.gif' alt='lol.gif' />"), $retval); return $retval; } $host = "localhost"; $username = "zenpets_news"; $password = "####"; $database = "zenpets_news"; $conn = mysql_connect($host, $username, $password); mysql_select_db($database, $conn); $rows = mysql_num_rows(mysql_query("SELECT * FROM `news`", $conn)); $rowspp = 5; $range = 3; $pages = ceil($rows / $rowspp); if($rows == 0) { $body = "<p><i>There is no news to display!</i></p>"; } else { if(isset($_GET['pg']) && is_numeric($_GET['pg'])) { $current = intval($_GET['pg']); } else { $current = 1; } if($current > $pages) { $current = $pages; } elseif($current < 1) { $current = 1; } $prev = $current - 1; $next = $current + 1; $offset = ($current * $rowspp) - $rowspp; $onset = ($current * $rowspp); $result = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT $offset, $onset", $conn); $body = "<table width='400px'> "; while($row = mysql_fetch_array($result)) { $comments = mysql_num_rows(mysql_query("SELECT * FROM `comments` WHERE `nid`='" . $row['id'] . "'", $conn)); $body .= "<tr> <td colspan='2'><center><strong><h2>" . $row['title'] . "</h2></strong></center></td> </tr> <tr> <td>Written By:</td> <td>" . $row['author'] . "</td> </tr> <tr> <td>Date and Time:</td> <td>" . $row['date'] . "</td> </tr> <tr> <td colspan='2'>News Post:</td> </tr> <tr> <td colspan='2'>" . nl2br(bb_decode($row['post'])) . "</td> </tr> <tr> <td></td> <td><a href='/comments.php?id=" . $row['id'] . "'>(" . $comments . ") View Comments</a></td> </tr> <tr> <td><br /><br /></td> </tr> "; } $body .= "</table> "; if($pages > 1) { $body .= "<p name='navbar' align='center'> "; if($current > 1) { if($current - 1 != 1) { $body .= "<a href='" . $_SERVER['PHP_SELF'] . "?pg=1'><<</a> "; } $body .= "<a href='" . $_SERVER['PHP_SELF'] . "?pg=" . $prev . "'><</a> "; } for($i=(($current - $range) - 1);$i<(($current + $range) + 1);$i++) { if($i > 0 && $i <= $pages) { if($i == $current) { $body .= "<strong>" . $i . "</strong> "; } else { $body .= "<a href='" . $_SERVER['PHP_SELF'] . "?pg=" . $i . "'>" . $i . "</a> "; } } } if($current < $pages) { $body .= "<a href='" . $_SERVER['PHP_SELF'] . "?pg=" . $next . "'>></a> "; if($current + 1 != $pages) { $body .= "<a href='" . $_SERVER['PHP_SELF'] . "?pg=" . $pages . "'>>></a> "; } } $body .= " </p>"; } } ?>
-
Okay, so a while ago I tried to use AJAX to make my login (which uses PHP sessions) AJAX. Now the problem is, responseText returns what is on the page, but won't set cookies or sessions. So I'm wondering if it's possible to do an AJAX login...I'm sure I've seen it somewhere before. Also, I created an AJAX something else but I remember that I was not able to do if(ajax.readyStatus == 4) because it was going to slow. I had to use a while statement and a function to repeat every 1 second to check if it was 4 yet. Did I do something wrong?
-
<?php echo "<pre>"; echo htmlentities("</title> <body>"); echo "</pre>"; ?>
-
It wouldn't let me edit... Anyways, I'll just create a function that logs in every time and just uses the page I need as the destination.
-
I think I know what's wrong. I am including that login script on every page and I should only do it once...let me try this... Erm...no, that was not it...sorry for the triple post. I didn't realize lol...I'll edit from now on.
-
I took out the unlink("cookies") and went to that file...it looks like this: # Netscape HTTP Cookie File # http://www.netscape.com/newsref/std/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. .neopets.com TRUE / FALSE 1245511475 np_randseed 48209782833739562 .neopets.com TRUE / FALSE 1221975475 neoremember rezzyboy .neopets.com TRUE / FALSE 1205975475 wc_ids 0 .neopets.com TRUE / FALSE 1245511475 neologin rezzyboy%2BTT5ZZCFWMCZB9ZBB .neopets.com TRUE / FALSE 1221975475 toolbar rezzyboy%2BC%2Bce6e360dd6763e0d49759e192b8a8ef8 .neopets.com TRUE / FALSE 1213969476 nupi 0 .neopets.com TRUE / FALSE 1213969476 nupid 0 .neopets.com TRUE / FALSE 1213969476 npid 0 .neopets.com TRUE / FALSE 1245511476 np_uniq pending .neopets.com TRUE / FALSE 1245511476 xt6Yr4e33D 10296997547675126158185 .neopets.com TRUE / FALSE 1214061876 adnets_hash blsip_pixel%3A1213975476%7Erenew%3A1%7E
-
I have never used arrays in it though. o.0 I just display $retlogin and it looks like it's logging in fine...I'm very confused now. Oh yeah, I added the destination part also.
-
Okay, I just came across a second problem. I tried doing this: <?php /****************************************************************** * Script created by Rezert * * Script created for everyone at www.virtualpetlist.com and * * www.mlfmp.com * * * * Contact Me: * * AIM: LethalLiquid * * MSN: [email protected] * * YIM: LethalLiquid * * * * Thanks to DarkerAngel * * of www.phpfreaks.com for showing me the hidden field * *****************************************************************/ $title = "Neopets! Portal"; // Title of the portal. $url = "http://mlfmp.com/"; // Your main website's URL. $user = "RezzyBoy"; // A neopets username. (Needed to check some data.) $pass = "password"; // The account's password. (Needed to check some data.) $refun = "RezzyBoy"; // Your username for the refferal page. $links = array( "Home" => $url, "Dailies" => "dailies.php", "Neopets Login" => "http://www.neopets.com/loginpage.phtml", "Neoepts Signup" => "http://www.neopets.com/refer.phtml?username=" . $refun ); // Links that will be displayed // DO NOT EDIT BELOW TIHS LINE \\ $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)"; $cl = curl_init(); curl_setopt($cl, CURLOPT_URL, "http://www.neopets.com/login.phtml"); curl_setopt($cl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($cl, CURLOPT_USERAGENT, $agent); curl_setopt($cl, CURLOPT_REFERER, "http://www.neopets.com/hi.phtml"); curl_setopt($cl, CURLOPT_POST, 1); curl_setopt($cl, CURLOPT_POSTFIELDS, "username=" . $user . "&password=" . $pass); curl_setopt($cl, CURLOPT_COOKIEJAR, "cookies"); curl_setopt($cl, CURLOPT_RETURNTRANSFER, 1); $retlogin = curl_exec($cl); curl_close($cl); ?> and my second page has this: <?php include "config.inc.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.neopets.com/winter/snowager.phtml"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_REFERER, "http://www.neopets.com/login.phtml"); curl_setopt($ch, COOKIEFILE, "cookies"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $retsnow = curl_exec($ch); curl_close($ch); unset($ch); if(preg_match('/That <font color="#FF0000"><strong>username\/password<\/strong><\/font> combination is invalid./', $retlogin)) { die("This script was configured incorrectly. Please enter a valid username and password in the config.inc.php"); } if(preg_match('/The Snowager is awake!!! You better run before it eats you!!!/', $retsnow)) { $snow = "The snowager is awake."; } else { $snow = "The snowager is asleep."; } echo $snow; unlink("cookies"); ?> Now the problem is it's saying "The snowager is asleep." when it's really awake. So I echo()ed $retsnow and it shows the login form. I'm like WTF!?!?! because I logged in with config.inc.php Any help would be muchly appreciated, Rezert And before you say it's cuz $pass = "password"; I just changed that...
-
Ah yes, I used to have that but I forgot to install it. Thanks a lot, I should be able to figure something out. =]
-
Okay, so I'm pretty good with PHP, including cURL, MySQL, GD Library, and REGEX. I'm not the best though. Now I remember when I was like 10 (2 years ago) I wanted to make a Neopets! portal I saw on some sites. However, I only new HTML. Now here's what it's supposed to display: Snowager is Awake/Sleeping The Current Band Is: (Current Band) And a couple things like that. Now my only problem is that I can't figure out how to login to Neopets w/ cURL because the login form is two pages long. Any help would be greatly appreciated, Rez