Jump to content

jasonc

Members
  • Posts

    860
  • Joined

  • Last visited

Posts posted by jasonc

  1. I have a music related site and wish for snippets of my collection to be played in the background while visitors browse.

    I would like the music to continue playing even if a link is clicked.

    I have taken a 10 - 20 sec snip of each track and uploaded all of the snippet files to the site ready to play.

    I would like to have them play at random, but not restart playing when they browse the sites pages.

    ( yes i will have the option to turn OFF the sound if they want and that will be cookie based (hope they have this enabled) so it remembers next time they visit.

    hopefully this can be done.

    thanks

    J
  2. thank you very much for your help, this worked a treat. i now have a new command to play around with and get to know.

    J


    [!--quoteo(post=366218:date=Apr 18 2006, 11:22 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 18 2006, 11:22 PM) [snapback]366218[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    why, if you already have the data in a text file?
    Try

    [code]$songs = file('songlist.txt');

    $rand_titles = array_rand($songs, 5);

    foreach ($rand_titles as $k) {
              echo $songs[$k], '<br />';
    }[/code]
    [/quote]
  3. if i get an error accessing mysql how can i re run that part of the script until it can, or until it has let say re runned 5 or so times then shows the error?

    I think what I am asking is something along the lines of this.
    forgive the bad syntax but i hope you get the idea.


    while(no error accessing mysql) {
    ....try to get data....
    }




    thank you
  4. I have a large file with a list of songs, i wish to chose at random 5 of these to be shown on my web page.

    the problem i have is reading this file to get the info from it.

    i have the php script that randomise 5 numbers all i need is to know how to extract the lets say

    the 5, 17, 26, 55, 105 and er 300 th lines from a text (tracks.txt) file.

    I known in the past that scripts can write a file but how can i read a line from one?

    also been told be a friend that when i do this i also need to be sure that the file can be read many time at the same time.

    I was going to use my database but decided against that as i have had problems in the past with them.
    also adding the data to it would take ages too.

    thank you in advance for your help.
  5. i am wanting to change my exisiting home page to frames, i use at the moment this.

    <?
    include("header.php");
    include("mainpage.php");
    include("footer.php");
    ?>

    my header file contains a scroller marquee and each time someone click a link anywhere in the site this marquee restarts, i would like this to continue without restarting until all info is shown then to restart like normal.

    i have been told to use frames with iframes in them like this.



    my index.php file...

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <frameset rows="80,*,80" frameborder="NO" border="0" framespacing="0">
    <frame src="UntitledFrame-10.htm" name="topFrame" scrolling="NO" noresize >
    <frame src="UntitledFrame-7.htm" name="mainFrame">
    <frame src="UntitledFrame-9.htm" name="bottomFrame" scrolling="NO" noresize>
    </frameset>
    <noframes><body>

    </body></noframes>
    </html>



    UntitledFrame-10.htm....

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <IFRAME FRAMEBORDER=0 SCROLLING=NO SRC="../header.php"></IFRAME>
    </body>
    </html>




    UntitledFrame-7.htm....

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    middle text
    </body>
    </html>




    UntitledFrame-9.htm....

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <IFRAME FRAMEBORDER=0 SCROLLING=NO SRC="../footer.php"></IFRAME>
    </body>
    </html>


    .....


    the header does not show at all. the middle part seems ok, and the footer is shown but it is not all shown only about 30% of the left hand side of it is seen.


    any ideas anyone?

    thanks in advance.
  6. Please can you provide information on how you would do this.

    thank you



    [!--quoteo(post=364279:date=Apr 13 2006, 05:50 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Apr 13 2006, 05:50 AM) [snapback]364279[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    That's right -- basically, as long as you can trap the call the generates the error, you can handle it however you see fit (and so you should). Silent errors -- or even worse, errors that the user sees and can do nothing about -- should never exist.

    I always get annoyed when I see the typical "an error has ocurred.... please contact the webmaster". If they know an error occurs, the webmaster should be contacted automatically! That's how it works on every project I've ever written.
    [/quote]
  7. i can not use the following code as this is what i use at the moment.

    the header file has the scroller and this need to be static and not be reloaded as the scroller restarts.

    any other ideas?

    thanks





    [!--quoteo(post=360347:date=Mar 31 2006, 02:30 PM:name=Poi)--][div class=\'quotetop\']QUOTE(Poi @ Mar 31 2006, 02:30 PM) [snapback]360347[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Try this:

    [code]<html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <iframe src="header.php" name="topFrame" width="100%" height="100%">
    <iframe src="index.php" name="mainFrame" width="100%" height="100%">
    <iframe src="footer.php" name="bottomFrame" width="100%" height="100%">
    <noframes><body>

    </body></noframes>
    </html>[/code]
    Then when you have a link IN a frame make it look like "<a target="[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]mainframe[!--colorc--][/span][!--/colorc--]" href="[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]url[!--colorc--][/span][!--/colorc--]">[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]Your text[!--colorc--][/span][!--/colorc--]</a>"

    And edit the parts in red

    Or simply use php:
    [code]
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <?php  
    include 'header.php';
    include 'index.php';
    include 'footer.php';
    ?>
    <noframes><body>

    </body></noframes>
    </html>[/code]
    [/quote]
  8. i wish to have a blogger scroll across the screen but when a link is clicked on my site the current scroll bar marque does a refresh and starts scrolling from the start again. i would like to have it continue without intruption.

    using frames would enable me to load links in to a frame and not the whole page.

    i have tried the following and it did not work!

    any ideas?


    thanks



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <frameset rows="*,*,*" cols="*" framespacing="0"" frameborder="NO" border="0">
    <frame src="header.php" name="topFrame" width="100%" height="100%">
    <frame src="index.php" name="mainFrame" width="100%" height="100%">
    <frame src="footer.php" name="bottomFrame" width="100%" height="100%">
    </frameset>
    <noframes><body>

    </body></noframes>
    </html>

  9. yes html frames.

    if possible i would like not to use javascript.
    a lot of my users disable this.

    i have now found a few sites that do similar but these did not work as the frames did not resize correctly some where a bit bigger or twice as big as the content.

    i wish to have my header file and footer file in the top and bottom of the page and have the main page in the middle of them both, and also have a blogger scroller between the header and the main page.


    header.php
    blogger.php
    mainpage.php
    footer.php


    hope someone can help us out.

    thanks
  10. below is the code that is created by the php file.

    <form method="POST" action="orderpage.php">
    <input name="submit" type="submit" value="Log Out">

    <table border="3">
    <tr width=\"100%\">
    <td width="204" align="center"><img border=0 src="fruit and veg images/banana.jpg"><br>
    <table width=200 border=0>
    <tr>
    <td><div align="center">banana</div></td>
    </tr>
    </table>
    <br>
    1.00p kg<br>
    (0.45p lb *)<br>
    Required Weight in kgs
    <select onchange="form.banana.value=0; form.bananaLB.value=0;" name=bananaKG>
    <option selected value=0>0kg</option>
    <option value=1>1kg</option>
    <option value=2>2kg</option>
    <option value=3>3kg</option>
    <option value=4>4kg</option>
    <option value=5>5kg</option>
    <option value=6>6kg</option>
    <option value=7>7kg</option>
    <option value=8>8kg</option>
    <option value=9>9kg</option>
    <option value=10>10kg</option>
    </select> <br>
    Required Weight in lbs
    <select onchange="form.banana.value=0; form.bananaKG.value=0;" name=bananaLB>
    <option selected value=0>0lb</option>
    <option value=1>1lb</option>
    <option value=2>2lb</option>
    <option value=3>3lb</option>
    <option value=4>4lb</option>
    <option value=5>5lb</option>
    <option value=6>6lb</option>
    <option value=7>7lb</option>
    <option value=8>8lb</option>
    <option value=9>9lb</option>
    <option value=10>10lb</option>
    </select> </td>
    </tr>
    </table>
    <p><input type="submit" value="Preview Order" name="submit"><input type="submit" value="Reset" name="submit"></p></form>note about buying by LB's and if buying by item when it is sold by weight it is going to be around that weight and should not be sold at the stated price until it is weight correctly in KG.
  11. [!--quoteo(post=356483:date=Mar 19 2006, 08:29 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 19 2006, 08:29 PM) [snapback]356483[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    What are you trying to do? Cause you've programmed it to set to zero on each change:

    [code]onchange=form.banana.value=0; form.bananaLB.value=0;[/code]
    [/quote]


    if option one selected option two is set to '0' if option two is selected option one is set to '0'

    option one is bananaKG option two is bananaLB

    ignor the 'banana.value=0' this is for a third option if needed.

    has no effect at the moment.

    i select one and it should clear the other but it doesn't it keeps it value.

  12. below is part of the code that does not work, i have placed it into a new file and tried to get it to work

    when one option is selected the other clears back to '0' and vise versa.

    it did work at one point but something is wrong now can not see what it is myself

    can anyone spot what is missing or wrong?

    thanks




    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <form name="form" method="post" action="">
    <select onchange=form.banana.value=0; form.bananaLB.value=0; name=bananaKG>
    <option selected value=0>0kg</option><option value=1>1kg</option><option value=2>2kg</option>
    <option value=3>3kg</option><option value=4>4kg</option><option value=5>5kg</option>
    <option value=6>6kg</option><option value=7>7kg</option><option value=8>8kg</option>
    <option value=9>9kg</option><option value=10>10kg</option></select>
    <br>
    <select onchange=form.banana.value=0; form.bananaKG.value=0; name=bananaLB>
    <option selected value=0>0lb</option><option value=1>1lb</option><option value=2>2lb</option>
    <option value=3>3lb</option><option value=4>4lb</option><option value=5>5lb</option>
    <option value=6>6lb</option><option value=7>7lb</option><option value=8>8lb</option>
    <option value=9>9lb</option><option value=10>10lb</option></select>
    <input type="submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>
  13. <?php
    session_start();
    if(!(isset($_SESSION['results']))) {
    session_register(results);
    }

    please can someone tell me if the above code is ok or not, i need to check if the array 'results' is set or not, as i think i am resetting the array each time the page is visited. nione of the array values stay when the page is re-entered after click a submit button.

    thanks for you help.
  14. [!--quoteo(post=354025:date=Mar 11 2006, 10:16 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 11 2006, 10:16 PM) [snapback]354025[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    you need to post all your pages ok first post the first page the user goto first ok.
    index.php to check what wrong step buy step ok.
    [/quote]


    I have posted all files!

    they visit the index page and that just says hi and stuff then they click a link for go to the orderpage.php

    i wanted to have the signin part on the orderpage as well, they signin and the sign in box does not show anymore until they logout or close window.

    i want them to see the order form but not be allowed to submit the order as the submit buton will not show unless they are signed in.

    i have tried 100's yes 100' or site that have a script that you sign in with but none are like what we need.

  15. hi thanks for that it does make sence but i now have another problem it shows error about the sessions already started in another file or something so moved the start session to the main file and took it out of the one that has the login part, still not working.

    below is a test login that i have done it is the same as i have but with out the rest of the file, it is still showing the same errors.

    can you spot anything i have missed?

    i have taken this from a few scripts a friend gave me a while ago.

    or have you got a better way that this can be done?

    hope you are better at it than me.



    thanks



    orderpage is our main page.


    <?
    session_start();
    include("../dbconfigfile.php");

    include("../logintest/login.php");

    echo('<form method="POST" action="logintest/orderpage.php">');

    if ($_POST['submit'] != 'Send Order') {
    if ($_POST['submit'] != 'Preview Order') {echo('<input type="submit" value="Preview Order" name="submit">');}

    if ($_POST['submit'] == 'Preview Order' && $_SESSION['sess_name'] && $_SESSION['sess_passwd']) {echo('<input type="submit" value="Send Order" name="submit">');}

    echo('<input type="submit" value="Reset" name="submit">');
    }
    echo('</form>');
    ?>



    login page is well the login page that is include()d in the orderpage

    <form action="<? echo($self_url); ?>/logintest/mem_auth.php" method="post" name="login">

    <table width="275" border="0" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
    <tr valign="middle" bgcolor="#00CC33">
    <td height="16" colspan="2"> <div align="center"><b><font color="#990000" size="3" face="verdana"><em>Customer
    Login</em></font></b></div></td>
    </tr>
    <tr>
    <td height="11" colspan="2" align="left"><div align="center"><font size="2" face="Tahoma"><b></b></font></div></td>
    </tr>
    <tr>
    <td width="140" height="22" align="left">
    <p align="center"><font size="1" face="Tahoma"><b>E-mail:</b></font>
    <input type="text" name="email" size="20" maxlength="100" class="webforms">
    </td>
    <td width="135">
    <div align="center"><font size="1" face="Tahoma"><b>Password:</b></font>
    <input type="password" name="passwd" size="20" maxlength="20" class="webforms">
    </div></td>
    </tr>
    <tr>
    <td height="12"> <p align="center"><font face="verdana" size="1">Resend
    activation email<br>
    </font></td>
    <td height="12"> <div align="center"><font face="verdana" size="1">Lost
    your password?</font></div></td>
    </tr>
    <tr>
    <td height="21" colspan="2"> <p align="right"><? echo "<input type=hidden name=\"".session_name()."\" value=" . session_id() . ">"; ?>
    <input type="hidden" name="form" value="sent">
    <input name="submit" type="submit" style="font-size: 8pt;" value="Log in" class="formbutton">
    </td>
    </tr>
    <tr bordercolor="#999999" bgcolor="#00CC33">
    <td height="19"> <div align="center"><font font size="2" face="Tahoma"><b>Sign
    up here!</b><br>
    </font></div></td>
    <td height="19"><div align="center"><font font size="2" face="Tahoma"><b>Contact
    Us</b></font></div></td>
    </tr>
    </table>
    </form>





    and mem_auth is that part that tests if the login is correct


    <?php

    session_start();

    session_destroy();

    session_start();

    include("../dbconfigfile.php");

    $servernames = $_SERVER['REMOTE_ADDR'];

    if ($_POST['login'] == 'sent') {

    if (trim($_POST['email']) == "" || trim($_POST['passwd']) == "") {

    echo("<head><meta http-equiv=\"Refresh\" content=\"1;URL=/logintest/orderpage.php\"></head><body>Login details cannot be blank!</body></html>");

    $_SESSION = array();

    session_destroy();

    mysql_close;

    exit;

    } elseif (ereg('@', trim($_POST['email']))) {

    $_SESSION['sess_name'] = trim($_POST['email']);

    $_SESSION['sess_passwd'] = md5(trim($_POST['passwd']));

    header("Location: $self_url" . "?".session_name() . "=" . session_id());

    mysql_close;

    exit;

    } elseif (is_numeric(trim($_POST['email']))) {

    $res = mysql_query("select * from customers where username='" . trim($_POST['email']) . "' && password='".trim($_POST['passwd'])."'");

    if (mysql_num_rows($res) != 0) {

    $_SESSION['sess_name'] = mysql_result($res, 0, "email");

    $_SESSION['sess_passwd'] = md5(trim($_POST['passwd']));

    header("Location: $self_url" . "?".session_name() . "=" . session_id());

    mysql_close;

    exit;

    } else {

    echo("<head><meta http-equiv=\"Refresh\" content=\"1;URL=/logintest/orderpage.php\"></head><body>Invalid login details!</body></html>");

    $_SESSION = array();

    session_destroy();

    mysql_close;

    exit;

    }

    } else {

    echo("<head><meta http-equiv=\"Refresh\" content=\"1;URL=/logintest/orderpage.php\"></head><body>Invalid login details!</body></html>");

    $_SESSION = array();

    session_destroy();

    mysql_close;

    exit;

    }

    } else {

    echo("<head><meta http-equiv=\"Refresh\" content=\"1;URL=/logintest/orderpage.php\"></head><body>You are not authorized to view this area!</body></html>");

    $_SESSION = array();

    session_destroy();

    mysql_close;

    exit;

    }

    ?>
  16. below is the code i have written myself by looking at the php.net site.

    it does the session bit by adding to the url address, the ?PHPSESSID=3d7....

    but it does not allow me to set a variable so i can gray out the submit button at the bottom of the page if they have not logged in.

    i do not want to use cookies or java as most of my visitors have disabled it.

    can someone please see if you can work out where i am going wrong or suggest a method of finding out if they have signed in like making a variable 'loggedin' = 'yes' so i can use this at the bottom of my page.

    thanks


    <?
    session_start();
    session_destroy();
    session_start();
    include("dbconfig.php");

    $res = mysql_query("select * from customers where username='" . trim($_POST['username']) . "' && password='".trim($_POST['passwd'])."'");

    if (mysql_num_rows($res) != 0) {
    $_SESSION['sess_name'] = mysql_result($res, 0, "username");
    $_SESSION['sess_passwd'] = md5(trim($_POST['password']));
    $loggedin = 'yes';
    header("Location: $self_url" . "?".session_name() . "=" . session_id());
    exit;
    } else {
    $loggedin = 'no';
    ?>
    <form name="loginform" method="post" action="newlogin.php">
    <table width="28%" height="120" border="0">
    <tr>
    <td height="20" colspan="2"><div align="center"><b><font color="#990000" face="verdana"><em>Customer Login</em></font></b></div></td>
    </tr>
    <tr>
    <td height="43"><div align="center"><b>E-mail:<br><input type="text" name="username"></b></div></td>
    <td><div align="center"><b>Password:<br><input type="password" name="passwd"></b></div></td>
    </tr>
    <tr>
    <td height="26" colspan="2"><div align="right"><input type="submit" name="Login" value="Login"></div></td>
    </tr>
    <tr>
    <td height="21"><div align="center"><a href="<? echo($self_url); ?>signup.php"><b>Sign up here!</b></a><br></div></td>
    <td><div align="center"><a href="<? echo($self_url); ?>contact.php"><b>Contact Us</b></a></div></td>
    </tr>
    </table>
    </form>
    <?
    }
    echo("loggedin =".$loggedin.'.');

    ?>
    <form name="form1" method="post" action="newlogin.php">
    <?
    if ($loggedin == 'yes') {
    ?>
    <input type="submit" name="Submit" value="Submit">
    <?
    }
    ?>
    </form>
  17. [!--quoteo(post=349788:date=Feb 27 2006, 09:53 AM:name=tim_perrett)--][div class=\'quotetop\']QUOTE(tim_perrett @ Feb 27 2006, 09:53 AM) [snapback]349788[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    AJAX it is, thats the only way you will do that....

    www.ajaxfreaks.com

    Tim Perrett
    [/quote]

    ajax is a forum with some help pages with scripts.
    what an i actually looking for on this site.
    a link would be helpfull to an idiot like me.
    i am not very bright!
  18. [!--quoteo(post=349702:date=Feb 27 2006, 12:00 AM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Feb 27 2006, 12:00 AM) [snapback]349702[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Your only other option for storing each field as they are entered is ajax.
    [/quote]

    your say ajax, but what am i looking for?

    i have posted my question there.

    thanks

    Jason
  19. Hi,

    Thanks for a quick response.

    Yes i know i could use cookies, but want to make this as streamlined as possible.

    i know as i do myself, disable cookies from being stored on my pc, this is why i would like to have it stored in the database.

    how else can i do this?


    Jason
  20. my page has lots of options and i want to be sure that the selection are kept in case they lose their connection of what ever.

    each person has a login name and password.

    while they make their selection i want the database updated on each change, so that they can come back later to finish off, without having to full out everything from the start again.

    how else can i do this?

    Thanks

    Jason
  21. I have a form that is filled in and each part that has something done to it i want added to a database on my server, for that user.

    I have a onchange=update() in my form and this would then call the script to update the database.

    is this possible.

    or is there another way i can do this.

    i tried to use in the update.js file


    function update()
    {
    <?
    echo("hello");
    ?>
    }

    just to see if anything happen, and it did not.

    how can i execute php while in a js file?

    is there another way to do this?

    thanks you in advance for your help.


    Jason
×
×
  • 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.