Hi, I want to ask a few questions that I can't seem to find..
1) I'm creating a "shortcut" system on my website, where users can add shortcuts from pages by clicking the link and it will write the URL and the users ID into the database, the only problem I don't know how PHP can grab the URL of the page?
2) I can't seem to get cookies working on my site:
Code: //get the posted values
$email1=($_POST['user_name']);
$email=htmlspecialchars($_POST['user_name'],ENT_QUOTES);
$pass=sha1($_POST['password']);
$post_autologin=($_POST['checkbox']);
//MYSQL
$abc = mysql_query("SELECT * FROM accounts WHERE email='".$email1."'") or die(mysql_error());
$a = mysql_fetch_array($abc);
//Select whatever..
$sql="SELECT user_id, email, password FROM accounts WHERE email='".$email."'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$userid = $a['user_id'];
$displayname = $a['display_name'];
$_SESSION['user_id']=$userid;
$_SESSION['email']=$email;
//if username exists
if(mysql_num_rows($result)>0)
{
//compare the password
if(strcmp($row['password'],$pass)==0)
{
echo "yes";
if($post_autologin == YES)
{
$password_hash = sha1($pass); // will result in a 32 characters hash
setcookie ($cookie_name, 'usr='.$email.'&hash='.$pass, time() + $cookie_time);
}
$_SESSION['user_id']=$userid;
$_SESSION['email']=$email;
$_SESSION['dname']=$displayname;
}
else
echo "no";
}
else
echo "no"; //Invalid Login
?>
Is this correct? Its a Ajax login I found but when I check the checkbox and close the browser it logs me out.. I use $_SESSION['user_id] in places where I want stuff to show for logged in users, where do I put $_COOKIE['user_id']???
http://mymediaupload.com/media.php?v=130 if you look on this page and click "More by Cheryl Cole" it shows the current song, how would I get it to view the rest of the songs by that artist and not the one thats playing?
This is what I have..
Code: if($_GET['morelikethis'])
{
$name2 = mysql_real_escape_string($_GET['morelikethis']);
$s = mysql_query("SELECT * FROM music WHERE musicartist LIKE '".$name2."%' ORDER BY `musicartist` ASC LIMIT 0,6") or die(mysql_error());
$t = mysql_query("SELECT * FROM music WHERE musicartist LIKE '".$name2."%' ORDER BY `musicartist` ASC") or die(mysql_error());
$u = mysql_query("SELECT * FROM music WHERE musicartist LIKE '".$name2."%' ORDER BY `musicartist` ASC LIMIT 1,5") or die(mysql_error());
$len = 19;
while($x = mysql_fetch_array($s))
{
$q3 = mysql_query("SELECT * FROM accounts WHERE user_id = ".$x['musicuploaderid']."") or die(mysql_error());
$q4 = mysql_fetch_array($q3);
echo "<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="40"><img src="".$x['musicalbumart']."" height="40" width="40"></td><td width="5"></td>";
echo "<td align="left" valign="top"><a target="_top" title="".$x['musictitle']." - ".$x['musicartist']."" href="media.php?v=".$x['musicid']."">";
echo (strlen($x['musictitle']) > $len ? substr($x['musictitle'], 0, $len).".." : $x['musictitle']);
echo "
";
echo (strlen($x['musicartist']) > $len ? substr($x['musicartist'], 0, $len).".." : $x['musicartist']);
echo "</a>
<a target="_top" title="Click here to go to ".$q4['display_name']."'s Station" href="stations.php?s=".$q4['user_id']."">".$q4['display_name']."</a>";
echo "</div></td>
</tr>
</table>";
echo "
<hr noshade color="#c0c0c0">
";
}
if(mysql_num_rows($t)<=0)
{
echo "<div id="content">There is no results</div>";
}
if(mysql_num_rows($t)>=6)
{
echo "<table width="90%" align="center"><tr><td><div id="sub4">More..</div></td></tr></table>";
}
}
Thanks
Join Query Help
Hi all,I am having problems with the below code, which we shall call 'my first join query'! Suprise suprise its not working and I am getting an error I have not seen before:QuoteParse error: parse
javascript in php code causes page to display white
Hi All,Odd one this, I've got the following code (below) which is a simple log in form. The client wanted a pop to inform you when you've not completed a field and an asterix to appear.This is fine.
How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and use ORDER BY to re-order whether DESC or ASCHow can i do the ORDER BY without re-order first 50
http to https
Hi,Is there any specific method/condition to move an http:// page to https:// ?
Get relative path from absolute path
How would one go about getting the relative path to a file from its absolute path?
Undefined Index Notice In Internet Explorer Only
I am getting the following notice: QuoteNotice: Undefined index: jrox in /home/ycsn/public_html/mem/includes/html/templates/template_member_home_page.php on line 20It only appears within Internet
Problem!
I have another problem, when i run this code i get this error "Parse error: syntax error, unexpected T_ELSE in /home/a1408362/public_html/admin.php on line 41". I can't see why in the code
WM transfer order: confirm different batch than proposed by system
Hi folks,
JQuery, Masterpage, and Control issue
Hey everyone, I am using JQuery in several sites so I thought it would be best to place the library reference in the masterpage. It works great everywhere, except when my javascrip is called from
Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bottom of the page:Code: <!--ddgbsre_erd_sdd--><?php