Jump to content

therealwesfoster

Members
  • Posts

    345
  • Joined

  • Last visited

Everything posted by therealwesfoster

  1. Well how would you do that? This is something I've always wondered about
  2. Here's what I'm trying to do. <?php $do = 100; function setVar($var,$value) { return eval("\$var = $value"); } setVar("do",300); echo $do; // I want it to echo 300. Instead of the original 100 ?> I'm not using the eval right I'm sure. So my question is, how would i be able to set a variable this way? I'm building a class and thats why I'm wanting a function like this. Thanks
  3. Its because you "echoed" something before the HEADER call. No html or anything (besides php) can be called before the header() functions. Put the "echo" line below your header() function and see if it helps And as for passing a variable to the new page, just use GET variabled. Something like header("Location: http://www.dozentips.com/test1/index.php?ref={$uid}");
  4. By 3:14 AM on January 19, 2038, the UNIX timestamp will no be functional anymore. Google it, I'm serious
  5. Good advice. Thanks again. (where'd the topic solved mod go?)
  6. You da man madtechie I modded your code though and am using \r\n. It works just the same Wes
  7. I'm wanting to allow "newline" characters in my preg_match. But how? My code Thanks
  8. Well, i ended up doing this: if (self != top) { document.location.href = "./index.html"; } Works just the same SOLVED (although, if you have an answer to my question, feel free to post it. I like learning new things)
  9. I have 2 frames. TOP and HOME Sometimes the top frame gets removed by accident. I'm needing a short JS script that checks "if TOP frame doesn't exist, redirece to index.html" Which I would think would be like: if (!window.parent.top) { document.location.href = "index.html"; } But it don't work. Help please. Thanks
  10. Can anyone link me to a good site that teaches about the mootools framework? I googled it but found nothing interesting
  11. Change it to: ASC = Ascending DESC = Descending
  12. In your "pilot_view_bid" file, edit your FORM tag to look like this: <p><form id="bid" action="pilot-bid-place.php" method="post"></p> That may be the problem
  13. This is the script: http://devthought.com/textboxlist-meets-autocompletion/ (very nice) Here's my question. I'm not used to mootools or anything like that, so I was wondering if I could get some help modding this script. The users are being pulled from the DB in a JSON format. I'm wanting to be able to pull the username AND their image and show it in the autocomplete dropdown. Please check it out Thanks
  14. I'm sure where else to post this.. but I was curious. I'm always doing modification for people on their scripts, and when I open the file I see: (example) <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="shortcut icon" href="images/logo.ico" /> <link rel="stylesheet" type="text/css" href="css/test.css" media="screen" /> <link rel="stylesheet" type="text/css" href="css/table_main.css" media="screen" /> <link rel="stylesheet" type="text/css" href="css/screen.css" media="screen" /> </head> <body id="bd" > ............ </body> </html> (it actually looks cleaner than what it really is because all the spaces are parsed) Anyway, my point is this. I'm very picky about my code, so before I do anything, I make it look like this: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="shortcut icon" href="images/logo.ico" /> </head> <body id="bd"> ........ </body> </html> I was just wondering if there was a program you could load the file into that would parse alot of the newlines and spaces in order for it to look neater? It would save me alot of time and trouble. Anyway, please let me know
  15. <?php if(isset($_GET['game'])) { if($_GET['page'] == 'roster') { if($_GET['id'] == '1') { // Insert information here for index.php?game=game; this will be the game's home page echo("Insert information here for index.php?game=game; this will be the game's home page"); } } else { // Insert information here for index.php?game=game&page=roster echo("Insert information here for index.php?game=game&page=roster"); } } else { // Insert information here for index.php?game=game&page=roster&id=id; this will be detailed information of rostered member echo("Insert information here for index.php?game=game&page=roster&id=id; this will be detailed information of rostered member"); } ?> I don't see why that wouldn't work
  16. I have an array $a_movie = array(56,78,79,66,57,58,60,59,75,61,62,76,63,80); I'm needing to select all of the entries from the database that have these ID numbers. How would i do that? SELECT * FROM table WHERE id=.... Wes
  17. I'm created an admin panel for uploading images to a site. Now there are 2 ways the user can upload images, and I have questions for each, so please help me out. Method 1. User can upload the images through the admin panel. After the user presses the submit button, the PHP script will resize each image (max 600x600 px) and save it to /gallery/. Also, the script will make thumbnail images for each one and save them to /gallery/thumbs/. And save all instances to the db. Q: 1. I'm only going to show 2 upload fields in the form. But I'm allowing the user to click "Add Another Upload" and it will add another upload field (by using javascript). So the 2 default ones will be named "file1" and "file2", and every field added after that will be "file3", "file4" etc. Get it? So heres the question.. In the PHP script, when I'm receiving all of the $_POST vars, how do I check how many upload fields there were, and how do I know if they were empty or not? Method 2. The user uploads alot of images to /gallery/ via FTP. Then they go into the admin cp and click a button like "Update Database". This script should read the /gallery/ directory and get every image that isn't in the database already. Then it should resize them (max 600x600), create the thumbnails, then save the instances to the database. Q: 1. I'm afraid that this would lag horribly. Any suggestions on anther way to do this? Or does it look good? ----- These are my ideas on how they would work, if there is a better way to do it, please post it. Thanks
  18. Here's something simple I do. <?php $post = array(); // empty var foreach ($_POST as $key => $value) { $post[$key] = addslashes( htmlspecialchars( $value ) ); } echo $post['username']; ?> So now, $post['username'] is the same at $_POST['username'].. except it's cleaned up Or, do it this way to make it a function. <?php function cleanRequest() { $post = array(); foreach ($_POST as $key => $value) { $post[$key] = addslashes( htmlspecialchars( $value ) ); } return $post; } $post = cleanRequest(); echo $post['username']; ?>
  19. You'll need to run an SQL query and have it grab all of the user's who's last activity is less that 15 minutes ago and display the results. Thats as simple as it gets
  20. I have an array like so: $pics = array ( array("name" => "wes", "number" => 14), array("name" => "jared", "number" => 97), array("name" => "amber", "number" => 2) ); So $pics[0]['name'] will equal wes. Well, I'm wanting to use these in a FOR loop, but I'm wanting to first sort them by their number and have it re-arrange the indexes. So once i sort them, I want it to be in the order 0 = amber,1 = wes,2 = jared instead of the current 0 = wes,1 = jared,2 = amber How would I do this? btw, I've read every sorting method in the php manual.. but for some reason I'm still at a loss.. so please provide an example. Thanks
  21. Change your script to this and see what happens: <?php $ni = mysql_real_escape_string($_POST['nickname']); // the mysql_real_escape_string() function prevents SQL injection $ch = mysql_real_escape_string($_POST['channel']); $nipass = mysql_real_escape_string($_POST['nickpassword']); $chpass = mysql_real_escape_string($_POST['chanpassword']); $description = mysql_real_escape_string($_POST['description']); $HOST = 'localhost'; $DBUSER = 'rpope904_x10chat'; $PASS = '*******'; $DATABASE = 'rpope904_x10chat'; $connection = mysql_connect($HOST, $DBUSER, $PASS) or die("Cannot connect to database server!"); $db = mysql_select_db($DATABASE, $connection) or die("Cannot select database!"); $sql = "SELECT nickname FROM users WHERE nickname = $ni"; $sql2 = "SELECT channel FROM users WHERE email = $ch"; $result = mysql_query($sql) or die ("Can not check username.<br />".mysql_error()); $result2 = mysql_query($sql2) or die ("Can not check channel.<br />".mysql_error()); $num = mysql_num_rows($result); $num2 = mysql_num_rows($result2); if ($num > 0) { echo "Error, user already exists!<br />"; echo "<a href="signup.php\">Back to signup..</a>"; } elseif ($num2 > 0) { echo "Someone has already registered that channel.<br />"; echo "<a href=\"signup.php\">Back to signup..</a>"; } else { $query = "INSERT INTO users (nickname,channel,email,nickpassword,chanpassword,description) VALUES ('{$_POST['nickname']}','{$_POST['channel']}','{$_POST['email']}','{$_POST['nickpassword']}','{$_POST['chanpassword']}','{$_POST['description']}')"; $resultB = mysql_query($query,$connection) or die ("Coundn't execute query.<br />".mysql_error()); echo "Sucess! We have created your personal site!<br />"; } Let me know what happens
  22. Change this: $sql = "SELECT nickname FROM users WHERE username = $ni"; to $sql = "SELECT nickname FROM users WHERE nickname = $ni";
  23. Hey, I'm kinda new to php and directories.. ive done it a few times. Here's what I'm needing to do. The folders are organized like so: Pics - /gallery/CatName/ Thumbs - /gallery/CatName/thumbs/ I'm needing to load the last 5 modified folders (the 5 recently created/updated) into an array. How would I do this? I'll also need to load 1 image out of each of the 5 folders (a random one). One more thing, when I load all images from a dir, how do I sort them by their mod date? Thanks!
  24. I'm messing around with string manipulation. Just a hobby. I'm setting $POST vars to regular variables, going to dump them with a function, and format them into a template. All in 1 function... I'm bored I'll try it out
×
×
  • 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.