Jump to content

jscix

Members
  • Posts

    197
  • Joined

  • Last visited

    Never

Everything posted by jscix

  1. $change = "ALTER TABLE `tablename` CHANGE `name` `jpname` TYPE(LENGTH) NOT NULL";
  2. Remove the first slash wrong = $localpath = "/var/www/private/ftp/photos/" . $path; correct = $localpath = "var/www/private/ftp/photos/" . $path;
  3. Not that I condone file sharing *coughLOLcough* http://www.torrentvalley.com/ebook_torrents.php :oo
  4. If you have aim I have a large volume of PHP/SQL E-Books.
  5. ah that is a really good idea. Thank you wild. The reason I asked is I have already done a large amount of work, before deciding that logging errors would end up saving me a whole lot of work later on when something goes wrong/breaks.. So being lazy as I am, I wanted a quick fix so I didn't have to replace all the die commands with a modified version. :/
  6. I'm not sure if this is possible, but what I'm curious about is, Is it possible to modify/redefine how a php command such as DIE works? What I would like to do is have the die command also save the text to a log file, is this possible ? eg: die ("Error",$logfilename); anyone? :
  7. Create a function that checks for the input your expecting, since your variable is always gonna be set.
  8. $localpath = "home/photos/" . $path;
  9. This works if you use it as, http://www.example.com?id=filename (solong as the file is .php) <?php $srcontent = "".stripslashes($_GET['id']).".php"; if(!file_exists($srcontent)){ die("File does not exist"); } else { include($srcontent); } ?>
  10. First, What are the users ID's based on? Where are you retrieving them from? If you are using a database to generate a unique id, upon account creation, then you will need to retrive their userid after verifying their information. ie.: $query = "SELECT db.userid FROM db WHERE userid = '$userid' AND password = '$pwd'"; now your $query variable should either return either: an array, or nothing. depending on if their info was correct. If the info was correct, you should set their userid using, $_SESSION['userid'] = $query[0]; Then, When you want to validate if the person has given their correct USERID, before letting the modify anything: <?php session_start(); $userid = $_GET['userid']; if ($_SESSION['userid'] = $_GET['userid']) { // $userid matches the session userid } else { // It doesnt match } ?>
  11. You really shouldn't store a password in a session. But try using: unset ($_SESSION['username']); unset ($_SESSION['password']); unset ($_SESSION['valid_user']); session_destroy();
  12. What I usually do with image uploads is create a table which has two or three columns, Usually a unique identifier for the image, and depending what im doing, an identifier for the user the image belongs to, (and or a file-name also depending on what im doing) for example: **************** PK - primary key FK - foreign key | whatever | - Column | imgid(PK) | userid(Fk) | imagefiledetails | ************************* What I do is name the image using the unique ID that is created upon adding a new entry to the images table. (The imgid) Aftering uploading an image, use the imgid to name your images (E.G: USERIMG + the imgid number) When you want to check if a user has an image uploaded, retrieve the users ID using their username, and/or whatever you are using to identify them, which should also be a column in your images table to associate the user with his/her image. If you retrieve a result from the images table, you can be pretty sure the user has an image uploaded, so just retrive the imgid, and link the image named USERIMG + The Retrived IMGID $example1 = mysql_query("SELECT users.USERID FROM users WHERE users.username='USERNAME'"); $rete1 = mysql_fetch_row($example1); $example2 = mysql_query("SELECT images.imgid FROM images WHERE images.USERID='$rete1[0]'"); $rete2 = mysql_fetch_row($example2); the image name should be: $theimg = "USERIMG" . $rete2[0] . ".file-extention"; I hope that helps you, if even a little.
  13. "/\.pdf(\?.*)?$/i",$file->filename that should work..
  14. ok, below is the code i'm using, however i've also tried logging in, and using an echo session_id(); this isn't working either, I've started the session, it shows up in my sess directory, the variables are being maintained in the session but, session_id() wont return the id.. any idea what could be causing this? This is all the relevant code in using.. session_save_path("tmp/login/"); session_start(); #bunch of stuff between here $setkeys = mysql_query("UPDATE `users` SET `ip` = '" . getenv("REMOTE_ADDR") . "', `sessid` = '" . session_id() . "' WHERE `users`.`uid` =" . $result['0'] . " LIMIT 1 ;"); Anyone? :/
  15. smpt_port = 465 Should it be: smTP_port = 465 ?
  16. Hum, I figured it out. Sorry, The problem was with using the Is_int function, I replaced it with is_numeric. I suppose for some reason explode returns the values as a numeric string?
  17. Basically what this does is retrive the $_get variable 'list', then if it's empty assign it an array of 0, 10 as default, otherwise grab the values on either side of the - delimiter. The problem is, when the default numbers are processed and I print the array I get: Array ( [0] => 0 [1] => 10 ) This works and it prints out 0 and 10. However.. when I specify the numbers, using "blah.php?list=0-10" I get the exact same array: Array ( [0] => 0 [1] => 10 ) However it is not printing out the numbers... It prints a null value... what is happening? anyone? $limitres = ($_GET['list']); if (!isset($limitres)) { $dirty2 = Array(0, 10); } else { $dirty = strip_tags($limitres); $dirty2 = explode("-", $dirty); } if (is_array($dirty2)) { $numof = count($dirty2); if ($numof != "2") { die("Invalid page limiter"); } $pone = $dirty2[0]; $ptwo = $dirty2[1]; if (is_int($pone) && is_int($ptwo)) { $clean1 = ($pone); $clean2 = ($ptwo); } if ($clean1 > clean2) { die("Page limiter format must be lesser number-greater number."); } } print $clean1 . "<br>"; print $clean2 . "<br>";
  18. Best I can do is give you some good reading. Hope it helps some. http://us3.php.net/array http://us2.php.net/count http://us2.php.net/while http://us3.php.net/preg_match http://us2.php.net/list Reading all of these, should give you a good idea of what to do, I'm still learning myself so sorry I couldn't be more help.
  19. Where is it printing the records to? It could be a memory prob of some kind.
  20. Try, unset($username); session_destroy();
  21. hrmm, what I mean is, After I use mysql_fetch_row, and it returns the data from the first-row into the variables, how do I get it to retrive the next row, it seems to only be grabbing the first one every time..
  22. Ok im having a bit of a problem, This code works.. however, when it finds multiple entries, it is only returning the first one (first row I guess?) How can I get this to find all the rows, and move on to the next one after putting the data into vars? <?php $connection = mysql_connect("mysql", "lllll", "lllll"); if (!$connection) { print "Failed to connect to database";} $db_select = mysql_select_db("posts"); if (!$db_select) { print "Failed to find database";} $sendsql = " SELECT * FROM comments WHERE tou IN ( '$curusr' ) LIMIT 0 , 30 "; $sqlq = mysql_query($sendsql); if (!$sqlq) { print "Failed to find"; die();} $dbdata = mysql_fetch_row(($sqlq)); $postid = $dbdata[0]; // post ID $retuidz = $dbdata[1]; //from user $retusrn = $dbdata[2]; // to user $retcom = $dbdata[3]; //comment print_r ($dbdata); ?>
  23. Doh! Thanks alot!!!!!! That saved me a migrain...
×
×
  • 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.