Jump to content

Boerboel649

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Boerboel649's Achievements

Member

Member (2/5)

0

Reputation

  1. This ought to be a simple question... I have a page which has the following PHP code: <?php if ($_SERVER['HTTP_REFERER'] != 'URLremoved') header("Location:/rostercpanel/login.php "); ?> Now, what I want to do, is add some other URL's, that are authorized URL's to come from. I've tried the 'or' and the '||' operators, but I have a feeling I'm doing it wrongly. Could someone please give me the code for this? If I didn't make myself clear enought let me know and I'll go into more detail. Thanks!
  2. Hi all, I have a form which places values into a MySQL DB. On this form, one of the input boxes is for height, in which we use single quotes/ apostrophes (eg 6' 3") However, whenever you try to do the single quote/apostrophe and submit it, it MySQL gives an error. I was wondering if there was some way to get it to work without always having to type in a backlsash before the single quote. What PHP code can I use to make this work? Here's the code that submits the form: <? $fname = $_POST['fname']; $lname = $_POST['lname']; $nickname = $_POST['nickname']; $number = $_POST['number']; $position = $_POST['position']; $height = $_POST['height']; $weight = $_POST['weight']; $other = $_POST['other']; $query = "INSERT INTO players (fname, lname, nickname, number, position, height, weight, other)"; $query .= "VALUES('$fname', '$lname', '$nickname', '$number', '$position', '$height', '$weight', '$other')"; mysql_query($query, $dbh) or die("MySQL Error: The following errors have been encountered. If you cannot resolve this issue, please contact the webmaster. <br /> {$query} <br /> ". mysql_error()); echo "You have successfully completed the following: $query"; ?> Thanks!
  3. Thanks spraypray12! That worked, I just had to change the URL to redirect to. Here's final code: <?php if ($_SERVER['HTTP_REFERER'] != 'www.steamfootball.com/authorize.php') header("Location:/login.php "); ?>
  4. Good idea kenrbnsn, however having trouble getting it to work... here's the code: <?php $condition = "www.myurl.com/referer.php"; if ($HTTP_REFERER != $condition) header("www.myurl.com/redirectpage.php "); ?> It isn't redirecting me at all...
  5. This a super quick and easy question (I hope...) Basically I'm righting a little script that will check the HTTP Referer, and if it equals such and such then to do nothing (ie let the user remain on that page.) If it doesn't equal that then it's gonna redirect them to another page. Basically what I need is how to say "do nothing" in PHP... Would it go something like this? if(blahblahblah){ } ?? Thanks!
  6. Yes, I do have a database connection and selection in my code, just did not post it here. Like I said, I have code that works wonderfully without the pop up window. Made the function name the same as the function name in the href link, still doesn't work. Anyone? Thanks!
  7. Hi all, I've been trying to get this to work and it still isn't working... Here's the closest... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript"> <!-- Idea by: Nic Wolfe (Nic@TimelapseProductions.com) --> <!-- Web URL: http://fineline.xs.mw --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=650,left = 515,top = 200');"); } // End --> </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $query = mysql_query("SELECT id, fname, lname FROM players ORDER BY lname"); while ($result = mysql_fetch_array($query)) { $id = $result['id']; $fname = $result['fname']; $lname = $result['lname']; echo "<a href=\"javascript:openpopUp('info.php?id=". $id ."')>"; echo $fname; echo " "; echo $lname; echo '</a><br>'; } ?> </body> </html> But all this is doing is pulling up one result from the database, and nothing happens when you click on that. The following code will pull up all the database entry, and evertyhing works fine, but obviously no pop up window... <?php $query = mysql_query("SELECT id, fname, lname FROM players ORDER BY lname"); while ($result = mysql_fetch_array($query)) { $id = $result['id']; $fname = $result['fname']; $lname = $result['lname']; echo '<a href="info.php?id=' . $id . '">'; echo $fname; echo " "; echo $lname; echo '</a><br>'; } ?> Anyone know what to do? Thanks!!!
  8. Thanks, however, it's not working... For one thing, it only pulls up one database entry when I try to use that code. For another thing, it doesn't even open up the window for that one... <head> <SCRIPT LANGUAGE="JavaScript"> function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=600,left = 540,top = 225');"); } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php $query = mysql_query("SELECT id, fname, lname FROM players ORDER BY lname"); while ($result = mysql_fetch_array($query)) { $id = $result['id']; $fname = $result['fname']; $lname = $result['lname']; echo "<a href=\"javascript:popUp('info.php?id=". $id ."')>"; echo $fname; echo " "; echo $lname; echo '</a><br>'; } ?>
  9. Thanks! One problem... When I put the <SCRIPT LANGUAGE="JavaScript"> ?In the within the head tags, I beleive it no longer recognizes the PHP code as PHP. What do I do with that?
  10. Yes, I've tried implementing Javascript, but it didn't work. So if anyone knows how to get it to work using Javscript in PHP, or another way, please help! Thanks!!!!
  11. Hi all, I have a roster script that pulls players from a DB, and when clicked on, a new window opens, and it shows that players stats. Here's my code: <?php $query = mysql_query("SELECT id, fname, lname FROM players ORDER BY lname"); while ($result = mysql_fetch_array($query)) { $id = $result['id']; $fname = $result['fname']; $lname = $result['lname']; echo '<a href="info.php?id=' . $id . '">'; echo $fname; echo " "; echo $lname; echo '</a><br>'; } ?> I want to make the window that shows the players stats more customizable (e.g. regulate window size, make it non-resizable, no scrollbars, etc. etc.) Sooo... is this possible, and if so, how? I've tried different stuff to no avail. Thanks!!!!!!
  12. Thanks! here's my final code to get that to work... <?php $_GET['id']; $query = mysql_query("SELECT fname, lname, nickname, number, position, height, weight, other FROM players WHERE id = '$id'"); while ($result = mysql_fetch_array($query)) { $fname = $result['fname']; $lname = $result['lname']; $nickname1 = $result['nickname']; $nickname2 = "\"$nickname1\""; $number = $result['number']; $position = $result['position']; $height = $result['height']; $weight = $result['weight']; $other = $result ['other']; $fullname = "$fname $nickname2 $lname"; echo nl2br("$fullname\n"); echo nl2br("$number\n"); echo nl2br("$position\n"); } ?>
  13. As you can see in my code, I tried that but it's not working!
  14. Hi all, This should be a quick simple question. How do you start new lines in text in PHP? I thought I knew how but it's not working. It just puts it all on one line. Here's my code: <?php $_GET['id']; $query = mysql_query("SELECT fname, lname, nickname, number, position, height, weight, other FROM players WHERE id = '$id'"); while ($result = mysql_fetch_array($query)) { $fname = $result['fname']; $lname = $result['lname']; $nickname1 = $result['nickname']; $nickname2 = "\"$nickname1\""; $number = $result['number']; $position = $result['position']; $height = $result['height']; $weight = $result['weight']; $other = $result ['other']; $fullname = "$fname $nickname2 $lname"; echo "$fullname\n"; echo "$number\n"; echo "$position\n"; } ?> I would think that the \n would do it, but it's not! Thanks!
×
×
  • 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.