Jump to content

Exc.BluePhoenix

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Exc.BluePhoenix's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. awesome, awesome... that helps a lot, I got working now, with no problems. Thanks a lot... Topic Solved.
  2. Thanks for the replies. I tried the query SELECT title FROM tablename ORDER BY id DESC LIMIT 3 However, all it echo's is Resource id #3. I'm positive its because I must have made the table wrong. My table has two fields. Id field, and the title field. Here is the whole code I use <?php /*Connect to mysql server*/ $link=mysql_connect("localhost","ODBC","pass"); if(!$link) { die('Failed to connect to server, here is your error : ' . mysql_error()); } /*Select database*/ $db=mysql_select_db("lpcs1"); if(!$db) { die("Could not select db"); } //Create query $query="SELECT title FROM lpcs ORDER BY id DESC LIMIT 3"; $result=mysql_query($query); echo $result; ?> If you can please tell me what does the Resource id #3 result means? and if its the fact that my SQL table must be made in a certain way, or its my php code wrong? Thanks for your replies and earlier help.
  3. Hello, I have a very simple form made, with two fields id field and title field I made a php script that inserts the information put in the fields to a db. For example 1 for the id and the title South Park Movie. So lets say i put 3 more titles. What i want to do is to display this information in a part of my website, by taking the information from the db that i previously inserted the info in. However, i only want to take 3 of the 4 titles (since i only want to display the titles, the id is only there because i think it makes the extracting/taking process easier) I want to take the newest titles, so I would want to take title with id 2 3 4 but NOT 1, cause its now old. So my question is how can i do this? a MySQL query? I really dont have a clue on how to extract information from the db in blocks of 3 (in this case) and im hoping someone can show me how or direct me somewhere, to learn how to. If you dont understand my question please reply, and I will try my best to explain it better.
  4. Hello, I have a registration script that I want to mod the one below. <?php /*Start session*/ session_start(); /* Array to store validation erros*/ $errmsg_arr = array(); /* Validation flag*/ $errflag = false; /*mysql_conncect, takes 3 arguments. If the var link is succeful, go on, if not die, echo msg.*/ $link = mysql_connect("localhost","username,"password"); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } /*Select db, if unable return error message.*/ $db = mysql_select_db("users"); if(!$db) { die("We are sorry but at this moment we are unable to connect to the Database. Please try again later."); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $firstname = clean($_POST['firstname']); $lastname = clean($_POST['lastname']); $email = clean($_POST['email']); $username = clean($_POST['username']); $password = clean($_POST['password']); $cpassword = clean($_POST['cpassword']); /*I took the validation check so its less code to read*/ //Check for duplicate login ID $query = "SELECT count(*) AS c FROM users WHERE username='$username'"; $result = mysql_query($query); if($result) { $result_array = mysql_fetch_assoc($result); if($result_array['c'] > 0) { $errmsg_arr[] = 'Username already in use'; $errflag = true; } @mysql_free_result($result); } else { die("Query failed"); } //If there are input validations, redirect back to the registration form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: form.php"); exit(); } //Create INSERT query $query = "INSERT INTO users(firstname, lastname, email, username, password) VALUES('$firstname','$lastname', '$email', '$username','".md5($_POST['password'])."')"; $result = mysql_query($query); //Check whether the query was successful or not if($result) { header("location: register-success.php"); exit(); }else { die("Query failed"); } ?> This code registers users. However, I am not really looking for that, what I would like it to are the following: I want it to send the information to a database, but I also want it to echo that information into a different page so that the user can copy and paste all the information that he/she input into the form. I don't want it to register anyone, just echo the information put in the form by the user in a different page. That is what I'm hoping to do, if there is a better script out there to do this or modify please advise me how to get it, (I tried google but I really don't know what to put for the script I'm looking for) Thank you for your time, if there is need for clarification don't hesitate to ask for some, since I might have not explain myself correctly.
  5. Hello, My question is the following, does anyone here know of a script that takes in information through a form. Then when you click submit it generates the information you input it into a nice table or just plain text, that i can later organized? Example of what I mean -- Name: ___________ Last Name:__________ Submit Then it outputs the information, so that the user can copy it or whatever it may be. If anyone knows where to find a script like that I would appreciate or if you know a script that could be modify, and you would so kindly stir me to that direction. Any help is welcome, even if its minimal. Thank you very much.
  6. Hello, I am looking for an apache module that caps the speed at a set amount, when users download from my server. For example, if its a member, I would want the download speed at 200kb/s, however if its a guest I would want the speed cap at 40 kb/s. I am also looking for a module that makes so you cannot download more than one file at the same time, and that sets a limit on the number of files, for example only two files can be downloaded a day from the same IP. Kinda like Mega Upload and Rapid Share. Any information about this would be extremely welcome. Thanks in advance.
  7. I cannot find the Topic Solved button. I will repost this in the Apache part of the forum. Thanks again for all your help.
  8. ah alright thanks man.
  9. I apologize if the title is bad. Hello, I am looking for a php script that caps the speed at a set amount, when users download from my server. For example, if its a member, I would want the download speed at 200kb/s, however if its a guest I would want the speed cap at 40 kb/s. I am also looking for as script that makes so you cannot download more than one files at the same time, and that sets a limit on the number of files, for example only two files can be downloaded a day from the same IP. Kinda like Mega Upload and Rapid Share. Any information about this would be extremely welcome. Thanks in advance.
  10. Thanks for the reply once again. However, what do they do? I still try to place them in my script, it still does not run, I put under the $links. A thing that it does do know, is that if i put a name and pass, I login, it loads, does nothing, if I erase the name and password and click the login again, it puts back the name and pass in the textbox. Does not know if that helps identify the problem. Thanks again.
  11. That is supposed to be a test condition. If the user is logged in already then those variables should be available, therefore the script goes and echo you are already logged in, and then shows the links. Please know that is what I think it does, I can very much be wrong, if you know a better way please let me know. Thanks for you quick reply.
  12. Hello, I having a problem with the script below, its supposed to be a simple login system, however when I run it, it does absolutely nothing. I am testing it on my local computer using WAMP 1.7.2. My reasoning on what this does is as follows: It checks to be sure the user is not logged in, if the user is, it tells them, gives links and it exits. If you are not it, a query is perform to look for user and pass in a db, if no results is returned, give error message, if something is found, give links so that they can proceed. However, once again, nothing is return when I put text in the form and click login, not even an error message. Any suggestion are greatly appreciated as to what is the problem here, thank you in advance. <?php session_start() ?> <?php $links = "<A HREF='form.htm'>Click here to proceed to the Main Page</A><BR><BR>"; $links .="<A HREF='logout.php'>Click here to log out.</A>"; if ($user && $pass) { /* This is a test condition, to see if the user is already logged in*/ if($logged_in_user == $user) { /*This exact condition is what check if the user is already logged in*/ echo $user.", You are already logged in.<BR><BR>"; echo $links; exit; } /* Not logged in user, or using a diff name*/ $db=mysql_connect("localhost","user","password") or die(mysql_error()) ; mysql_select_db("userlist",$db); $result = mysql_query("SELECT * FROM users WHERE username = '".$user."' AND password = PASSWORD('".$pass."')"); if(!$result) { /* If the result is not return*/ echo "Sorry, there seems to be a problem at the moment, we cannot enter you details, please try again later"; exit; } if(mysql_num_rows($result) > 0) { $logged_in_user = $user; session_register("logged_in_user"); echo "Welcome, ".$logged_in_user.".<BR><BR>"; echo $links; exit; } else { echo "Invalid login. Please try again, thank you!.<BR><BR>"; } } else if ($user || $pass) { echo "Please fill in both fields.<BR><BR>"; } ?> This is the form that goes with it. <form method="post" action="login.php"> Username: <input name="user" type="text"> Password: <input name="pass" type="password"> <input type="submit" value="Login"> </form>
  13. Oh really, well thank you. I will do so. Again thanks.
  14. Okay lets say it is, even though I dont know what cms is. Does that do what I asked before? Like let users pay at paypal? If there is no PayPal module can you please tell me how can I redirected users to paypal to pay after completing my form, that is the piece of information that I am missing. thank you, for the reply.
  15. Hello everyone, Can anyone explain what a paypal module is or a module? The best dumb down definition I got for module was, A plugin or add-on that increases functionality to your site. Will this module let me redirect the users after they completed my form to pay at PayPal? Is that what it does? I looked but I cannot get around what EXACTLY does this module do or make it work, complicated as hell. Do I even need a module to do this? (let people pay using PayPal) Is there any tuts that show what I ask or similar or give any base on the subject? If this is not a php question and the wrong place to post this please recommend the correct area, thank you. However, I have seen a PayPal module from what I can tell its written in php. Its by Open Source E-Commerce Solutions http://www.oscommerce.com But I don't required a whole E-commerce site, I just need it a form and be able to let people pay. (using PayPal) Thank you and have a nice day.
×
×
  • 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.