Hi all.....
I need some real help with loging into my postnuke site via WAP. It was working fine until a little while ago when I lost one of the main files needed.
The following is the PHP file which does the whole login process, it reference's a WML file called LOGIN.WML as a template to gather the username and password. Now - the file I've lost is the LOGIN.WML file. So what I need is for someone to read through the PHP code below and tell me what I need to put in the LOGIN.WML file to get it to work again and display the login boxes....
Thanks in advance for anyone willing to help!!
<?
header('text/vnd.wap.wml');
error_reporting (0);
session_start();
#---- connect to database ---
include("config.php");
$hostname= $pnconfig['dbhost'];
$dbuname=$pnconfig['dbuname'];
$dbpass=$pnconfig['dbpass'];
$dbname=$pnconfig['dbname'];
$link = mysql_connect($hostname, $dbuname, $dbpass) or die("Could not connect");
mysql_select_db($dbname) or die("Could not select database");
#----------------------------
header("Content-type: text/vnd.wap.wml");
$uservalid=0;
$template_file=file("login.wml");
if (!isset($HTTP_SESSION_VARS["login"]))
{
$username=htmlspecialchars($_POST['username']);
$password=htmlspecialchars($_POST['password']);
#print $username." ".$password."\n";
$template_file=file("login.wml");
if ((!empty($password))||(!empty($username)))
{
$query="SELECT pn_uid, pn_email FROM nuke_users WHERE pn_uname='$username' and pn_pass='".md5($password)."' LIMIT 1";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
if ($numrows==1){
#$line = mysql_fetch_array($result);
#$pn_uid=$line['pn_uid'];
#$pn_email=$line['pn_email'];
session_register("login");
$login=$username;
$query = "SELECT song,category FROM nuke_cart WHERE username ='$username'";
$result = mysql_query($query);
if ($numrows = mysql_num_rows($result)<1) {
$message .= "<center>No any ringtone here</center>";
}
else{
while($line = mysql_fetch_array($result))
{
$song=$line['song'];
$category=$line['category'];
$tone = $song;
# $full_path='modules/My_eGallery/gallery/'.$jon.$tone;
$full_path='index.php?tone='.$tone;
$message .='<p><a href="'.$full_path.'">'.$song.'</a></p>'."\n";
}
$template_file=file("download.wml");
}
#-------------
}else
{
$message='
<p>
';
$message .="Incorect login or password";
$message .='
</p>';
}
}
}else
{
if (!empty($_GET['tone']))
{
$tone = $tone.".mmf";
$full_path='/home/superpho/www/www/Tones/'.$tone;
#$full_path='D:/Program Files/Apache/htdocs/Tones/'.$tone;
$fh = fopen("$full_path", "r");
# header('Cache-Control: no-cache, must-revalidate');
# header('Pragma: no-cache');
header("Content-Type: audio/mid\nContent-Disposition: inline; filename=\"".$tone."\"\nContent-length: ".(string)(filesize($full_path)));
fpassthru($fh);
header("Location: index.php");
//echo "Starting Download....Please wait!";
$template_file="";
}else
{
#-----------
$username=$HTTP_SESSION_VARS["login"];
$query = "SELECT song,category FROM nuke_cart WHERE username ='$username'";
$result = mysql_query($query);
if ($numrows = mysql_num_rows($result)<1) {
$message .= "<center>No any ringtone here</center>";
}
else{
while($line = mysql_fetch_array($result))
{
$song=$line['song'];
$category=$line['category'];
$tone = $song;
# $full_path='modules/My_eGallery/gallery/'.$jon.$tone;
$full_path='index.php?tone='.$tone;
$message .='<p><a href="'.$full_path.'">'.$song.'</a></p>'."\n";
}
$template_file=file("download.wml");
}
}
#---------------
}
$n=count($template_file);
for($i=0;$i<=$n;$i++)
{
$template_file[$i] = str_replace("<!-- message -->", $message, $template_file[$i]);
print ($template_file[$i]);
}
?>
Thanks again
Tab