premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Look up how to properly use framesets via HTML first. Once you can create a static page with framesets then look into the dynamic part. The actual frameset page can be html, the pages linked inside the frameset, however, would need to be .php. But since this is a school project and you will not learn by me doing it for you. Research basic html framesets.
-
<?php $lines = file('runningclubs.txt'); echo '<select id="club" name="club">'; foreach($lines as $line) { if ($line == $getuserprofile['club']) $line = 'value="' . $line . '" SELECTED'; else $line = 'value="' . $line . '"'; echo '<option ' . $line . '>'.$line.'</option>'; } echo '</select>'; ?> Should do it, given that the club index of the getuserprofile should be the line you want to be selected.
-
what...no dinner and a movie first? you sure do get right to the point Bow chicka wow wow!
-
<frameset> <!-- this is not in php --> <?php echo '</frameset>'; // this is php ?> But why would you need php to make a frameset? That is basic HTML and should not require php at all....?
-
fopen fread fwrite fclose In replace of fread there is file_get_contents or file There should be examples there but here is a basic example: <?php $file = "counter.txt"; $contents = file($file); $counter = $contents[0] + 1; $fh = fopen($file, "w"); fwrite($fh, $counter); fclose($fh); echo "The counter is now: " . $counter; ?>
-
[SOLVED] Session is not encoding my string properly
premiso replied to parka's topic in PHP Coding Help
I do not know if the pages Content-Language is set to something else maybe that affects it? Check your phpinfo and if anything weird is going on with the language. Or maybe it is giving out garbled junk with sessions cause the session files are being trashed? But yea, check your configurations etc. -
<? /**-------------------------------------------------------------------------------------------------------------------------------- * Register.php * * Displays the registration form if the user needs to sign-up, * or lets the user know, if he's already logged in, that he * can't register another name. * * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) * Last Updated: August 19, 2004 */ include("include/session.php"); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>REGISTER PAGE - BICYCLE WORLD</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> <!-- body { background: #FFF; color: #000; font: 62.5% "Lucida Grande", Verdana, Geneva, Helvetica, sans-serif; margin: 0; padding: 0; background-color: #CCCCCC; } #navigation { background: #AFD5E0 url("bg-nav.gif") repeat-x; border: 1px solid #979797; border-width: 1px 0; font-size: 1.1em; margin-top: 1em; padding-top: .6em; } #navigation ul, #navigation ul li { list-style: none; margin: 0; padding: 0; } #navigation ul { padding: 5px 0 4px; text-align: center; } #navigation ul li { display: inline; margin-right: .75em; } #navigation ul li.last { margin-right: 0; } #navigation ul li a { background: url("tab-right.gif") no-repeat 100% 0; color: #06C; padding: 5px 0; text-decoration: none; } #navigation ul li a span { background: url("tab-left.gif") no-repeat; padding: 5px 1em; } #navigation ul li a:hover span { color: #69C; text-decoration: underline; } /*\*//*/ #navigation ul li a { display: inline-block; white-space: nowrap; width: 1px; } #navigation ul { padding-bottom: 0; margin-bottom: -1px; } /**/ /*\*/ * html #navigation ul li a { padding: 0; } /**/ // .style5 {font-family: "Tattoo Ink"} .style5 { font-size: 50px; font-family: "Tattoo Ink"; color: #993300; font-weight: bold; } .style6 {font-size: 1.1px} .style7 {font-size: medium} --> </style> </head> <body> <div id="navigation"> <ul> <li></li> <p class="style5">~BICYCLE WORLD~ </p> <li><span class="style6"><span class="style7"><a href="index.html"><strong>[</strong>HOME<strong>]</strong></a></span></span></li> <li class="style7"><a href="register.php"><strong>[</strong>REGISTER<strong>]</strong></a></li> <li class="style7"><a href="login.php"><strong>[</strong>LOGIN<strong>/</strong> LOGOUT<strong>]</strong></a></li> <li class="style7"><a href="#"><strong>[</strong>ADD PARTS<strong>]</strong></a></li> <li class="last"><span class="style7"><a href="#"><strong>[</strong>SEARCH<strong>]</strong></a></span></li> </ul> </div> <p align="center" class="style7"> </p> <p align="center" class="style7">REGISTRATION PAGE</p> <p align="center" class="style7"> </p> </body> </html> <table width="528" border="0" align="center"> <tr> <td><div align="justify"><span class="style8"> <html> <title>Registration Page</title> <body> <? /** * The user is already logged in, not allowed to register. */ if($session->logged_in){ echo "<h1>REGISTERED</h1>"; echo "<p>We're sorry <b>$session->username</b>, but you've already registered. " ."<a href=\"index.html\">RETURN TO HOME PAGE</a>.</p>"; } /** * The user has submitted the registration form and the * results have been processed. */ else if(isset($_SESSION['regsuccess'])){ /* Registration was successful */ if($_SESSION['regsuccess']){ echo "<h1>Registered!</h1>"; echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, " ."you may now <a href=\"login.php\">log in</a>.</p>"; } /* Registration failed */ else{ echo "<h1>Registration Failed</h1>"; echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, " ."could not be completed.<br>Please try again at a later time.</p>"; } unset($_SESSION['regsuccess']); unset($_SESSION['reguname']); } /** * The user has not filled out the registration form yet. * Below is the page with the sign-up form, the names * of the input fields are important and should not * be changed. */ else{ ?> <h1>REGISTER</h1> <? if($form->num_errors > 0){ echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>"; } ?> <form action="process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr> <tr><td>Email:</td><td><input type="text" name="email" maxlength="50" value="<? echo $form->value("email"); ?>"></td><td><? echo $form->error("email"); ?></td></tr> </td><td><? echo $form->error("city"); ?></td></tr> <tr><td colspan="2" align="right"> <input type="hidden" name="subjoin" value="1"> <input type="submit" value="JOIN"></td></tr> <tr><td colspan="2" align="left"><a href="index.html">RETURN TO HOME PAGE</a></td></tr> </table> </form> <? } ?> </body> </html> </span> </div></td> </tr> </table> Should fix it. Read the error, there is output before you use it, so move it before output.
-
You have to echo or print it out to the browser. Since PHP is not HTML they do not work right together without the echo tag or being outside of PHP. Also bright pink font is just annoying.
-
Because session_start has to be called before any output is sent to the page. So you have output sent to the page. Post code for more help.
-
Try this: print ( 1 == 1 ) ? 'true' : 'false'; That should work. I do not think print works as part of the assignment. It would be like saying $var = print 'true'; which (I believe) is invalid.
-
foreach($_POST['OptionGroups'] as $Gval => $Gvalue) { if (is_array($Gvalue)) { foreach($Gvalue as $val => $value) { } } } Given that post data can be somewhat un-reliable. I would add an is_array check. I would also make sure that your form posts a multi-dimm array. My bet is it does not.
-
do a print_r on the $parsed variable and see if the array is populated or not. If so look at the host key, my case could be off. If it is not populated, check that the $url contains valid data.
-
How to limit the request url to a single domain name?
premiso replied to ivytony's topic in PHP Coding Help
You can check referrer, but that can be spoofed. Really this is a form of hotlinking, I would look into Hot linking tutorials that help prevent people from using your site for information. Not sure how much that will help, but take a look into it. -
Dunno, Look at your html markup. I would suggest a syntax highlighting editor that also finds matching tags, such as Notepad ++ this way you can verify if you are missing a closing tag somewhere, if you are not then it is the CSS that is at fault. EDIT: Hope it is a missed tag, debugging CSS sucks!
-
I believe this would work: $parsed = parse_url($url); echo $parsed['host']; As it returns an associative array.
-
Use the if statement with is_array, if it is not an array then do not run the foreach.
-
A good way to fix this, view the source of the page that is messed up, save it to a file on your desktop like test.html, then modify the CSS styles till it displays like it should, note the part you change then go back to your script and fix accordingly. That is the best way to debug CSS errors on a dynamic page imo.
-
parse_url You have to have at least version 5.1.2 of PHP to use the second parameter. My bet is you switched hosts or they downgraded.
-
Hard to help without the "listbans()" function code. But the issue is going to be css related, perhaps a missed </div> tag or something. EDIT: Yea, but that would require like quoting that and too much work for me imo Although I wish he would have just posted the urls instead of the full size images now....
-
All arrays have keys, or indexes as they say. A regular array is 0-based. So $array[0] will print out the first element of the array. There are also associative arrays, meaning the keys are actual words. So $array['first'] would print out the value located at index 'first' So for each element in the array, assign the index of that array to $key and the value at that index to $value. The invalid argument means you are not using an array. Make sure the value you are using is an array with is_array before using it to avoid that warning in the future.
-
trying to have a function within a loop ..help please!
premiso replied to cyandi_man's topic in PHP Coding Help
Outside the loop, functions are global as they are, put it outside the loop and call it inside the loop and it should work fine. -
I meant view the source of the php created page and look at how it is coming up. It may be the fact that mystyle.css is not where the site is trying to find it, maybe try and define an absolute path to it.
-
So what is the question? Also the first image is not viewable if you click on it, and too small to see regularly.
-
[SOLVED] $_SERVER['REMOTE_ADDR'] and validation, for db insert
premiso replied to Lodius2000's topic in PHP Coding Help
Welcome to world of Websites. You can ban a username, but what keeps them from creating a new account. You can ban the email addr, but whats to stop them from changing emails. You can ban an IP but what is to stop them from logging on via a different location or creating a new account different location or even just using a proxy. You could set a cookie on their computer, but once they clear cookies they are allowed back in... Just ban the username, and hope they are not smart enough to get around the ban. If they are, well you just keep on banning. Not much help, but that is where it lays, you are stuck between a rock and a hard spot with everyone else.