Jump to content

hotdog1983

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hotdog1983's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank you for the replies. I'll go look into table linking. Both of you recommended keeping all the pageview data instread of deleting them, I was just worried if it's going to slow down the server when the database gets big. But it's better if I can keep them. @The Little Guy, I don't understand that method. If I make 3 columns like that, would I be able to put more than 1 data into the page column? Sorry if I got it wrong.
  2. Hi, I have a mysql table like this ----------------------------------------------- UserID Email Joined Country ----------------------------------------------- Justin jj@a.com 110815 USA ----------------------------------------------- What I want to achieve is to keep the 5 recent pages viewed by each user. For example, --------------------------------------------------------------------------------------------------- UserID Email Joined Country Act5 Act4 Act3 Act2 Act1 --------------------------------------------------------------------------------------------------- Justin jj@a.com 110815 USA 8.php 6.php 5.php 3.php 1.php --------------------------------------------------------------------------------------------------- So only the 5 recent pages are inserted and when the user views the 6th page, the oldest record gets dropped and the 4 last pages moves to the right by 1 column. --------------------------------------------------------------------------------------------------- UserID Email Joined Country Act5 Act4 Act3 Act2 Act1 --------------------------------------------------------------------------------------------------- Justin jj@a.com 110815 USA 8.php 6.php 5.php 3.php --------------------------------------------------------------------------------------------------- And then the last viewed page gets inserted. --------------------------------------------------------------------------------------------------- UserID Email Joined Country Act5 Act4 Act3 Act2 Act1 --------------------------------------------------------------------------------------------------- Justin jj@a.com 110815 USA 11.php 8.php 6.php 5.php 3.php --------------------------------------------------------------------------------------------------- I know how to use php to take the page name value to mysql query but I don't know how to use the SQL commands to do this. Does anyone know how to do this? or is there a better way to do it? Some help would be great, thank you.
  3. Thanks for your reply. I'm in a hurry to finish a site and I actually got that code from watching a Youtube PHP tutorial clip. I thought that the code itself must be correct. After struggling for a few hours, I've come up with this. $query = mysql_query("SELECT * FROM users WHERE username='$username' and password='$password'"); It works as I wished and I hope this one is properly coded. Please advise me if it's not. Thank you!
  4. Thank you for your answer. No, I'm getting wrong password error. When the username and password in the database are abc and abc I can login with abc/abc but not with ABC/abc, abc/ABC, or ABC/ABC.
  5. Hi, I'm making a login page and I want to allow users type in case-insensitive username and password. I'm using utf8_general_ci collation. Here's my PHP code. $username= $_POST['username']; $password = $_POST['password']; if ($email&&$password){ $connect = mysql_connect("localhost","root","") or die("Couldn't connect to the database"); mysql_select_db("nemo") or die("Couldn't find the database."); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) { while ($row = mysql_fetch_assoc($query)) { $dbusername= $row["username"]; $dbpassword = $row["password"]; } if ($username==$dbusername&&$password==$dbpassword) { echo "Logged in"; } else echo "Wrong password." } else die("Username not found."); } else die("Enter your username and password."); After doing some search, I found that collation ending with ci means case insensitive. But I can't log in with ABC if the username in database is abc. I know I can use strtolower to make everything to lower case but I'm really curious why this happens. Thank you.
  6. This is a bit off topic but I'm asking in this board because there are lots of computer geniuses here. I'm trying to get a direct link to a media file on a media storage site. On this website, instead of letting me download the file on the browser directly, it lets me install a small pop-up downloader program (ActiveX maybe?) and download files though it. I tried URL snooper and Wireshare but still could not get any links. URL snooper gives me something like this. http://www.nuripop.com/contents/contents_chk.php?dmethod=C&idx=437304 http://www.nuripop.com/contents/contents_download_start.php?dmethod=C&idx=437304&downkind=0 http://216.151.177.131/function.fopen http://nuripop.com/fs_prg/activex/XBoomUpDown_axn71106.cab#version=1,1,0,6 Is there any way that I can find the link? I'm pretty sure that there must be a link since it comes into my computer. Thank you very much.
  7. Hi guys, I've been struggling with this cURL code that post variables in foreign languages to another site. I tried to encode the UTF-8 characters to html entities before posting them via cURL and I tried lots of these variations... $firstname = htmlentities($_POST['firstname'],ENT_COMPAT,'UTF-8'); $firstname = htmlentities($_POST['firstname'],ENT_COMPAT); $firstname = htmlentities($_POST['firstname'],ENT_QUOTES); $firstname = iconv('utf-8','iso-8859-1',$_POST['firstname']); $firstname = iconv('utf-8','windows-1253',$_POST['cfirstname']); and so on... but the foreign characters I get through cURL look like ì��ë��í��ì�¸ì�� ì �ë�� ë��구ì�¼ê¹�ì��? The way I want to see them is something like this I believe it's called html entities 안녕하세요 저는 so I can see all the other languages on an iso-8859-1 page. Is it possible for cURL to post the variables in html entities?
  8. Thanks again for your reply. I really appreciate it. When I look at the HTTP headers, I see Set-Cookie: PHPSESSID=2btu73afurcpm632sr9dsqpjo2; path=/ I'm not really sure how sessions work.. How do I test if the target site takes session ID from URL? Can I type like www.3rdparty.com/index.php?PHPSESSID=2btu73afurcpm632sr9dsqpjo2 on a different browser like Chrome while I'm logged in on Firefox? Arggggg this is driving me crazy. I got my contact mail form page secured, signup page secured using cURL, and it's going to be funny to see my login page sending plain text data lol. What can I do if I don't have any control over the target site's security policy? I just wanted to make it a bit safer at least at the user end. Thanks again BlueSkyIS, hope you have a good one.
  9. Thanks a lot for your reply. Now I understood why I couldn't be logged in while I can post the data. I found a thread of someone else who had the same issue at http://www.webhostingtalk.com/showthread.php?t=696569 Some one there said Send login data to remote site, and receive the response (result). You can either fopen/fget or cURL. Extract the PHP session ID from the result and put it in a variable like $session. Redirect the user to the remote site, with the session ID: header("location: http://website.tld/after_succesful_login_page.php?PHPSESSID=$session") Do you think this is possible?
  10. Hi guys, what I'm struggling to do is 1) Users land on https://www.mysite.com/login.php 2) Users type their email and password 3) POST data submitted to http://www.3rdparty.com/login.php with cURL 4) Users redirected to http://www.3rdparty.com/index.php (logged in). I've been using this simple form to POST directly to the 3rd party site. <form name="loginform" method="post" target="_blank" action="http://www.3rdparty.com/login.php"> Email <input name="email" type="text"> Password<input name="password" type="password"> <input name="submit" type="submit" id="loginbutton" value="login"></form> This works great. But now I've installed a SSL on my site and I've just realised that using the form above, the data is still POSTed as a plain text because the 3rd party site is not https. So I want to submit the form to my login.php form and let this form take the users to the 3rd party site. So at least the user inputs to my site is encrypted. My new code looks like this. <form name="loginform" method="post" target="_blank" action="login.php"> Email <input name="email" type="text"> Password<input name="password" type="password"> <input name="submit" type="submit" id="loginbutton" value="login"></form> <?php if(isset($_POST['email'])) $email= $_POST['email']; if(isset($_POST['password'])) $password= $_POST['password']; if(isset($_POST['submit'])) $submit = $_POST['submit']; $Curl_Session = curl_init('http://www.3rdparty.com/login.php'); curl_setopt ($Curl_Session, CURLOPT_POST, 1); curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "email=$email&password=$password&submit=$submit"); curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec ($Curl_Session); curl_exec ($Curl_Session); curl_close ($Curl_Session); print $result; ?> What this code is doing now is it's just rendering the www.3rdparty.com's login page (not logged in) on my site. When I type wrong values, it renders www.3rdparty.com's login page with an error message on it. So I think at least the values are being POSTed but it doesn't log me in. All of the cURL codes available out there seem to POST the data and fetch some results back not redirecting the users to another site. My ultimate goal is to POST the form and redirect the users to the 3rd party site's member area as well. I tried header("Location: http://www.3rdparty.com/index.php"); but it just takes user to that page without being logged in. Could anyone give me some hints?
  11. Thank you very much. I'm now looking in to prototype.js and it helps a lot. I really appreciate it.
  12. Thanks a lot for your reply. But um... I'm still trying to understand your answer 1) What I understand is that In the 1st code The whole page will be reloaded as I surf around the website. In the 2nd code Only the content part of the page will be loaded as I surf around the website. Is this correct?
  13. Hi all! I'm a real noob and this is my first time making a website and I haven't hosted it yet. I'm trying to make a website that is fast and secure. My pages look something like this. <?php include("header.php");include("sidebar.php"); ?> HTML CODES <?php include("footer.php"); ?> 1. Are these php files cached after their first load? When I go to another page, those parts seem to stay still. 2. Is this code secure? And now I'm starting to make product pages which will be around 40 pages. So I'm considering something like this... <?php include("header.php");include("sidebar.php"); ?> <a href="index.php?page=a">Page A</a> <?php $page = $_GET['page']; if (file_exists('pages/'.$page.'.php')) { include('pages/'.$page.'.php'); } ?> <?php include("footer.php"); ?> 3. Is it better to make every page like this since it will load header, sidebar, footer only once? 4. How should I protect from the user input data, by making an array of allowed files or by prohibiting "." and "/" ? Thank you in advance.
  14. I'm really new to php and javascript and I'm now doing the hardest part of my website. I have this sidebar.php that contains a price list which is included in index.php. <tr> <td>Product 1</td> <td>30 USD</td> </tr> <tr> <td>Product 2</td> <td>50 USD</td> </tr> <tr> <td>Product 3</td> <td>25 USD</td> </tr> I'm going to add a dropdown menu which will change the prices in different currencies like this. <form method="get" action="sidebar.php"> <select name="currency"> <option value="0">Select Currency</option> <option value="1">USD</option> <option value="2">EURO</option> <option value="3">GBP</option> <option value="4">AUD</option> </select> <input type="submit" value="GO"/> </form> And I got this currency exchange code which works fine. <?php //error_reporting(0); $path=pathinfo($_SERVER['PHP_SELF']); $path=$_SERVER['DOCUMENT_ROOT'].$path['dirname']; require_once("$path/currencyexchange_class.php"); $cx=new currencyExchange(); $cx->getData(); ?> <?php if ($euro=$cx->Convert("USD","EUR",1)){ $euro=number_format($euro,4); echo "€$euro Euros "; } But now I'm not sure how I will combine all these codes. All I want is a currency selection dropdown menu which will use php to calculate the prices in another currency and show them on the table without reloading the page. I think I will need some javascript in here if I don't want the page to reload. I need to launch my website as soon as possible but it's taking too long for me to learn all the javascript and php. I'd really appreciate if someone could show me some direction so I can focus studying on a particular subject. Thank you.
  15. Thank you mjdamato. I actually got the codes I posted working. I enabled cURL on WAMP and they worked. I'm sorry if you went through the code. Actually the google api looks much simpler. I'm trying to get it work (Ive changed them to straight quote marks). Thanks again.
×
×
  • 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.